summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-09-26 22:03:49 -0700
committerJeff Sharkey <jsharkey@android.com>2012-09-27 16:22:53 -0700
commit625239a05401bbf18b04d9874cea3f82da7c29a1 (patch)
treeb7d6cdc6c51342262763ad251870350759800ed3 /services/java/com/android/server
parente00d33cf05a111c9be605d3d59db911cd983fcb9 (diff)
downloadframeworks_base-625239a05401bbf18b04d9874cea3f82da7c29a1.zip
frameworks_base-625239a05401bbf18b04d9874cea3f82da7c29a1.tar.gz
frameworks_base-625239a05401bbf18b04d9874cea3f82da7c29a1.tar.bz2
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
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r--services/java/com/android/server/BatteryService.java8
-rw-r--r--services/java/com/android/server/ConnectivityService.java40
-rw-r--r--services/java/com/android/server/DevicePolicyManagerService.java6
-rw-r--r--services/java/com/android/server/DeviceStorageMonitorService.java20
-rw-r--r--services/java/com/android/server/DropBoxManagerService.java26
-rw-r--r--services/java/com/android/server/NsdService.java6
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java4
-rw-r--r--services/java/com/android/server/net/NetworkStatsService.java6
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java13
9 files changed, 65 insertions, 64 deletions
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index fe8529b..0b4871d 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -463,10 +463,10 @@ public class BatteryService extends Binder {
private final void logOutlier(long duration) {
ContentResolver cr = mContext.getContentResolver();
- String dischargeThresholdString = Settings.Secure.getString(cr,
- Settings.Secure.BATTERY_DISCHARGE_THRESHOLD);
- String durationThresholdString = Settings.Secure.getString(cr,
- Settings.Secure.BATTERY_DISCHARGE_DURATION_THRESHOLD);
+ String dischargeThresholdString = Settings.Global.getString(cr,
+ Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
+ String durationThresholdString = Settings.Global.getString(cr,
+ Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
if (dischargeThresholdString != null && durationThresholdString != null) {
try {
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 891cac7..033aa1e 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -378,8 +378,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
// read our default dns server ip
- String dns = Settings.Secure.getString(context.getContentResolver(),
- Settings.Secure.DEFAULT_DNS_SERVER);
+ String dns = Settings.Global.getString(context.getContentResolver(),
+ Settings.Global.DEFAULT_DNS_SERVER);
if (dns == null || dns.length() == 0) {
dns = context.getResources().getString(
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. */
int defaultDelay = SystemProperties.getInt(
- "conn." + Settings.Secure.CONNECTIVITY_CHANGE_DELAY,
- Settings.Secure.CONNECTIVITY_CHANGE_DELAY_DEFAULT);
- return Settings.Secure.getInt(cr, Settings.Secure.CONNECTIVITY_CHANGE_DELAY,
+ "conn." + Settings.Global.CONNECTIVITY_CHANGE_DELAY,
+ ConnectivityManager.CONNECTIVITY_CHANGE_DELAY_DEFAULT);
+ return Settings.Global.getInt(cr, Settings.Global.CONNECTIVITY_CHANGE_DELAY,
defaultDelay);
}
@@ -2997,11 +2997,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (VDBG) log("handleInetConditionChange: starting a change hold");
// setup a new hold to debounce this
if (mDefaultInetCondition > 50) {
- delay = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
+ delay = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
} else {
- delay = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 3000);
+ delay = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 3000);
}
mInetConditionChangeInFlight = true;
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
@@ -3070,9 +3070,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mGlobalProxy = null;
}
ContentResolver res = mContext.getContentResolver();
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, host);
- Settings.Secure.putInt(res, Settings.Secure.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_HOST, host);
+ Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, port);
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclList);
}
@@ -3084,10 +3084,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private void loadGlobalProxy() {
ContentResolver res = mContext.getContentResolver();
- String host = Settings.Secure.getString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST);
- int port = Settings.Secure.getInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, 0);
- String exclList = Settings.Secure.getString(res,
- Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
+ String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST);
+ int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0);
+ String exclList = Settings.Global.getString(res,
+ Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
if (!TextUtils.isEmpty(host)) {
ProxyProperties proxyProperties = new ProxyProperties(host, port, exclList);
synchronized (mGlobalProxyLock) {
@@ -3118,8 +3118,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
private void handleDeprecatedGlobalHttpProxy() {
- String proxy = Settings.Secure.getString(mContext.getContentResolver(),
- Settings.Secure.HTTP_PROXY);
+ String proxy = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.HTTP_PROXY);
if (!TextUtils.isEmpty(proxy)) {
String data[] = proxy.split(":");
String proxyHost = data[0];
@@ -3162,8 +3162,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
void observe(Context context) {
ContentResolver resolver = context.getContentResolver();
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.HTTP_PROXY), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.HTTP_PROXY), false, this);
}
@Override
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 83fa55b..9607624 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -2124,9 +2124,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
exclusionList = exclusionList.trim();
ContentResolver res = mContext.getContentResolver();
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, data[0]);
- Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, proxyPort);
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, data[0]);
+ Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, proxyPort);
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclusionList);
}
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java
index 750a2fb..a4c376d 100644
--- a/services/java/com/android/server/DeviceStorageMonitorService.java
+++ b/services/java/com/android/server/DeviceStorageMonitorService.java
@@ -163,8 +163,8 @@ public class DeviceStorageMonitorService extends Binder {
mFreeMem = Long.parseLong(debugFreeMem);
}
// Read the log interval from secure settings
- long freeMemLogInterval = Settings.Secure.getLong(mContentResolver,
- Settings.Secure.SYS_FREE_STORAGE_LOG_INTERVAL,
+ long freeMemLogInterval = Settings.Global.getLong(mContentResolver,
+ Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
DEFAULT_FREE_STORAGE_LOG_INTERVAL_IN_MINUTES)*60*1000;
//log the amount of free memory in event log
long currTime = SystemClock.elapsedRealtime();
@@ -190,8 +190,8 @@ public class DeviceStorageMonitorService extends Binder {
mFreeMem, mFreeSystem, mFreeCache);
}
// Read the reporting threshold from secure settings
- long threshold = Settings.Secure.getLong(mContentResolver,
- Settings.Secure.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
+ long threshold = Settings.Global.getLong(mContentResolver,
+ Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD);
// If mFree changed significantly log the new value
long delta = mFreeMem - mLastReportedFreeMem;
@@ -309,15 +309,15 @@ public class DeviceStorageMonitorService extends Binder {
* any way
*/
private long getMemThreshold() {
- long value = Settings.Secure.getInt(
+ long value = Settings.Global.getInt(
mContentResolver,
- Settings.Secure.SYS_STORAGE_THRESHOLD_PERCENTAGE,
+ Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
DEFAULT_THRESHOLD_PERCENTAGE);
if(localLOGV) Slog.v(TAG, "Threshold Percentage="+value);
value = (value*mTotalMemory)/100;
- long maxValue = Settings.Secure.getInt(
+ long maxValue = Settings.Global.getInt(
mContentResolver,
- Settings.Secure.SYS_STORAGE_THRESHOLD_MAX_BYTES,
+ Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES,
DEFAULT_THRESHOLD_MAX_BYTES);
//evaluate threshold value
return value < maxValue ? value : maxValue;
@@ -329,9 +329,9 @@ public class DeviceStorageMonitorService extends Binder {
* any way
*/
private int getMemFullThreshold() {
- int value = Settings.Secure.getInt(
+ int value = Settings.Global.getInt(
mContentResolver,
- Settings.Secure.SYS_STORAGE_FULL_THRESHOLD_BYTES,
+ Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
DEFAULT_FULL_THRESHOLD_BYTES);
if(localLOGV) Slog.v(TAG, "Full Threshold Bytes="+value);
return value;
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 0b12410..5008270 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -146,7 +146,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
context.registerReceiver(mReceiver, filter);
mContentResolver.registerContentObserver(
- Settings.Secure.CONTENT_URI, true,
+ Settings.Global.CONTENT_URI, true,
new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
@@ -265,8 +265,8 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
}
public boolean isTagEnabled(String tag) {
- return !"disabled".equals(Settings.Secure.getString(
- mContentResolver, Settings.Secure.DROPBOX_TAG_PREFIX + tag));
+ return !"disabled".equals(Settings.Global.getString(
+ mContentResolver, Settings.Global.DROPBOX_TAG_PREFIX + tag));
}
public synchronized DropBoxManager.Entry getNextEntry(String tag, long millis) {
@@ -688,10 +688,10 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
private synchronized long trimToFit() {
// Expunge aged items (including tombstones marking deleted data).
- int ageSeconds = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_AGE_SECONDS, DEFAULT_AGE_SECONDS);
- int maxFiles = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_MAX_FILES, DEFAULT_MAX_FILES);
+ int ageSeconds = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_AGE_SECONDS, DEFAULT_AGE_SECONDS);
+ int maxFiles = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_MAX_FILES, DEFAULT_MAX_FILES);
long cutoffMillis = System.currentTimeMillis() - ageSeconds * 1000;
while (!mAllFiles.contents.isEmpty()) {
EntryFile entry = mAllFiles.contents.first();
@@ -710,12 +710,12 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
long uptimeMillis = SystemClock.uptimeMillis();
if (uptimeMillis > mCachedQuotaUptimeMillis + QUOTA_RESCAN_MILLIS) {
- int quotaPercent = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_QUOTA_PERCENT, DEFAULT_QUOTA_PERCENT);
- int reservePercent = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_RESERVE_PERCENT, DEFAULT_RESERVE_PERCENT);
- int quotaKb = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_QUOTA_KB, DEFAULT_QUOTA_KB);
+ int quotaPercent = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_QUOTA_PERCENT, DEFAULT_QUOTA_PERCENT);
+ int reservePercent = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_RESERVE_PERCENT, DEFAULT_RESERVE_PERCENT);
+ int quotaKb = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_QUOTA_KB, DEFAULT_QUOTA_KB);
mStatFs.restat(mDropBoxDir.getPath());
int available = mStatFs.getAvailableBlocks();
diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java
index 2a7a2eb..1b9742c 100644
--- a/services/java/com/android/server/NsdService.java
+++ b/services/java/com/android/server/NsdService.java
@@ -131,7 +131,7 @@ public class NsdService extends INsdManager.Stub {
};
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.NSD_ON),
+ Settings.Global.getUriFor(Settings.Global.NSD_ON),
false, contentObserver);
}
@@ -433,7 +433,7 @@ public class NsdService extends INsdManager.Stub {
public void setEnabled(boolean enable) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL,
"NsdService");
- Settings.Secure.putInt(mContentResolver, Settings.Secure.NSD_ON, enable ? 1 : 0);
+ Settings.Global.putInt(mContentResolver, Settings.Global.NSD_ON, enable ? 1 : 0);
if (enable) {
mNsdStateMachine.sendMessage(NsdManager.ENABLE);
} else {
@@ -453,7 +453,7 @@ public class NsdService extends INsdManager.Stub {
}
private boolean isNsdEnabled() {
- boolean ret = Settings.Secure.getInt(mContentResolver, Settings.Secure.NSD_ON, 1) == 1;
+ boolean ret = Settings.Global.getInt(mContentResolver, Settings.Global.NSD_ON, 1) == 1;
if (DBG) Slog.d(TAG, "Network service discovery enabled " + ret);
return ret;
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 0221245..bfefe67 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -8464,8 +8464,8 @@ public final class ActivityManagerService extends ActivityManagerNative
sb.append(crashInfo.stackTrace);
}
- String setting = Settings.Secure.ERROR_LOGCAT_PREFIX + dropboxTag;
- int lines = Settings.Secure.getInt(mContext.getContentResolver(), setting, 0);
+ String setting = Settings.Global.ERROR_LOGCAT_PREFIX + dropboxTag;
+ int lines = Settings.Global.getInt(mContext.getContentResolver(), setting, 0);
if (lines > 0) {
sb.append("\n");
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index f2748a3..0efdead 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -104,7 +104,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
-import android.provider.Settings.Secure;
+import android.provider.Settings.Global;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.EventLog;
@@ -696,7 +696,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
/**
* Update {@link NetworkStatsRecorder} and {@link #mGlobalAlertBytes} to
* reflect current {@link #mPersistThreshold} value. Always defers to
- * {@link Secure} values when defined.
+ * {@link Global} values when defined.
*/
private void updatePersistThresholds() {
mDevRecorder.setPersistThreshold(mSettings.getDevPersistBytes(mPersistThreshold));
@@ -1263,7 +1263,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
/**
* Default external settings that read from
- * {@link android.provider.Settings.Secure}.
+ * {@link android.provider.Settings.Global}.
*/
private static class DefaultNetworkStatsSettings implements NetworkStatsSettings {
private final ContentResolver mResolver;
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index c4cdd07..6accb39 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -10015,16 +10015,16 @@ public class PackageManagerService extends IPackageManager.Stub {
}
if (loc == PackageHelper.APP_INSTALL_AUTO || loc == PackageHelper.APP_INSTALL_INTERNAL
|| loc == PackageHelper.APP_INSTALL_EXTERNAL) {
- android.provider.Settings.System.putInt(mContext.getContentResolver(),
- android.provider.Settings.Secure.DEFAULT_INSTALL_LOCATION, loc);
+ android.provider.Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.DEFAULT_INSTALL_LOCATION, loc);
return true;
}
return false;
}
public int getInstallLocation() {
- return android.provider.Settings.System.getInt(mContext.getContentResolver(),
- android.provider.Settings.Secure.DEFAULT_INSTALL_LOCATION,
+ return android.provider.Settings.Global.getInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.DEFAULT_INSTALL_LOCATION,
PackageHelper.APP_INSTALL_AUTO);
}
@@ -10116,8 +10116,9 @@ public class PackageManagerService extends IPackageManager.Stub {
*/
private boolean isPermissionEnforcedDefault(String permission) {
if (READ_EXTERNAL_STORAGE.equals(permission)) {
- return Secure.getInt(mContext.getContentResolver(),
- Secure.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT, 0) != 0;
+ return android.provider.Settings.Global.getInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT, 0)
+ != 0;
} else {
return true;
}