Migrate more Secure settings to Global.

Migrate networking, storage, battery, DropBox, and PackageManager
related Secure settings to Global table.

Bug: 7232014, 7231331, 7231198
Change-Id: I772c2a9586a2f708c9db95622477f235064b8f4d
This commit is contained in:
Jeff Sharkey
2012-09-26 22:03:49 -07:00
parent 8b36157b58
commit 8c87045d09
2 changed files with 28 additions and 20 deletions

View File

@@ -330,6 +330,14 @@ public class ConnectivityManager {
public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI; public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI;
/**
* Default value for {@link Settings.Global#CONNECTIVITY_CHANGE_DELAY} in
* milliseconds.
*
* @hide
*/
public static final int CONNECTIVITY_CHANGE_DELAY_DEFAULT = 3000;
private final IConnectivityManager mService; private final IConnectivityManager mService;
public static boolean isNetworkTypeValid(int networkType) { public static boolean isNetworkTypeValid(int networkType) {

View File

@@ -378,8 +378,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
// read our default dns server ip // read our default dns server ip
String dns = Settings.Secure.getString(context.getContentResolver(), String dns = Settings.Global.getString(context.getContentResolver(),
Settings.Secure.DEFAULT_DNS_SERVER); Settings.Global.DEFAULT_DNS_SERVER);
if (dns == null || dns.length() == 0) { if (dns == null || dns.length() == 0) {
dns = context.getResources().getString( dns = context.getResources().getString(
com.android.internal.R.string.config_default_dns_server); com.android.internal.R.string.config_default_dns_server);
@@ -715,9 +715,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
/** Check system properties for the default value then use secure settings value, if any. */ /** Check system properties for the default value then use secure settings value, if any. */
int defaultDelay = SystemProperties.getInt( int defaultDelay = SystemProperties.getInt(
"conn." + Settings.Secure.CONNECTIVITY_CHANGE_DELAY, "conn." + Settings.Global.CONNECTIVITY_CHANGE_DELAY,
Settings.Secure.CONNECTIVITY_CHANGE_DELAY_DEFAULT); ConnectivityManager.CONNECTIVITY_CHANGE_DELAY_DEFAULT);
return Settings.Secure.getInt(cr, Settings.Secure.CONNECTIVITY_CHANGE_DELAY, return Settings.Global.getInt(cr, Settings.Global.CONNECTIVITY_CHANGE_DELAY,
defaultDelay); defaultDelay);
} }
@@ -2997,11 +2997,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (VDBG) log("handleInetConditionChange: starting a change hold"); if (VDBG) log("handleInetConditionChange: starting a change hold");
// setup a new hold to debounce this // setup a new hold to debounce this
if (mDefaultInetCondition > 50) { if (mDefaultInetCondition > 50) {
delay = Settings.Secure.getInt(mContext.getContentResolver(), delay = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Secure.INET_CONDITION_DEBOUNCE_UP_DELAY, 500); Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
} else { } else {
delay = Settings.Secure.getInt(mContext.getContentResolver(), delay = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Secure.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 3000); Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 3000);
} }
mInetConditionChangeInFlight = true; mInetConditionChangeInFlight = true;
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END, mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
@@ -3070,9 +3070,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mGlobalProxy = null; mGlobalProxy = null;
} }
ContentResolver res = mContext.getContentResolver(); ContentResolver res = mContext.getContentResolver();
Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, host); Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, host);
Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, port); Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, port);
Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclList); exclList);
} }
@@ -3084,10 +3084,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private void loadGlobalProxy() { private void loadGlobalProxy() {
ContentResolver res = mContext.getContentResolver(); ContentResolver res = mContext.getContentResolver();
String host = Settings.Secure.getString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST); String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST);
int port = Settings.Secure.getInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, 0); int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0);
String exclList = Settings.Secure.getString(res, String exclList = Settings.Global.getString(res,
Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST); Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
if (!TextUtils.isEmpty(host)) { if (!TextUtils.isEmpty(host)) {
ProxyProperties proxyProperties = new ProxyProperties(host, port, exclList); ProxyProperties proxyProperties = new ProxyProperties(host, port, exclList);
synchronized (mGlobalProxyLock) { synchronized (mGlobalProxyLock) {
@@ -3118,8 +3118,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
private void handleDeprecatedGlobalHttpProxy() { private void handleDeprecatedGlobalHttpProxy() {
String proxy = Settings.Secure.getString(mContext.getContentResolver(), String proxy = Settings.Global.getString(mContext.getContentResolver(),
Settings.Secure.HTTP_PROXY); Settings.Global.HTTP_PROXY);
if (!TextUtils.isEmpty(proxy)) { if (!TextUtils.isEmpty(proxy)) {
String data[] = proxy.split(":"); String data[] = proxy.split(":");
String proxyHost = data[0]; String proxyHost = data[0];
@@ -3162,8 +3162,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
void observe(Context context) { void observe(Context context) {
ContentResolver resolver = context.getContentResolver(); ContentResolver resolver = context.getContentResolver();
resolver.registerContentObserver(Settings.Secure.getUriFor( resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Secure.HTTP_PROXY), false, this); Settings.Global.HTTP_PROXY), false, this);
} }
@Override @Override