summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
diff options
context:
space:
mode:
authorEsteban Talavera <etalavera@google.com>2015-06-30 08:55:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-30 08:55:38 +0000
commitfef8cbd6a643a621a97f8e5616977e1fb65d9a5f (patch)
treeb80774b23233733b70bebe21aa79722dad608cd7 /services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
parent01b079f7d2dff0c9230e0f58842a473dc8c2cd06 (diff)
parent656fa7f5d1ce9299cb63043de80f2b4db9bff497 (diff)
downloadframeworks_base-fef8cbd6a643a621a97f8e5616977e1fb65d9a5f.zip
frameworks_base-fef8cbd6a643a621a97f8e5616977e1fb65d9a5f.tar.gz
frameworks_base-fef8cbd6a643a621a97f8e5616977e1fb65d9a5f.tar.bz2
Merge "Marking some globals from setGlobalSetting as not supported" into mnc-dev
Diffstat (limited to 'services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 5cfbb40..0670cd2 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -225,6 +225,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
private static final Set<String> SECURE_SETTINGS_WHITELIST;
private static final Set<String> SECURE_SETTINGS_DEVICEOWNER_WHITELIST;
private static final Set<String> GLOBAL_SETTINGS_WHITELIST;
+ private static final Set<String> GLOBAL_SETTINGS_DEPRECATED;
static {
SECURE_SETTINGS_WHITELIST = new HashSet();
SECURE_SETTINGS_WHITELIST.add(Settings.Secure.DEFAULT_INPUT_METHOD);
@@ -240,13 +241,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.AUTO_TIME);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.AUTO_TIME_ZONE);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.DATA_ROAMING);
- GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
- GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.MODE_RINGER);
- GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.NETWORK_PREFERENCE);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_SLEEP_POLICY);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN);
+
+ GLOBAL_SETTINGS_DEPRECATED = new HashSet();
+ GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.BLUETOOTH_ON);
+ GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
+ GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.MODE_RINGER);
+ GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.NETWORK_PREFERENCE);
+ GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.WIFI_ON);
}
// Keyguard features that when set of a profile will affect the profiles
@@ -5954,14 +5959,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
synchronized (this) {
getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
+ // Some settings are no supported any more. However we do not want to throw a
+ // SecurityException to avoid breaking apps.
+ if (GLOBAL_SETTINGS_DEPRECATED.contains(setting)) {
+ Log.i(LOG_TAG, "Global setting no longer supported: " + setting);
+ return;
+ }
+
if (!GLOBAL_SETTINGS_WHITELIST.contains(setting)) {
- // BLUETOOTH_ON and WIFI_ON used to be supported but not any more. We do not want to
- // throw a SecurityException not to break apps.
- if (!Settings.Global.BLUETOOTH_ON.equals(setting)
- && !Settings.Global.WIFI_ON.equals(setting)) {
- throw new SecurityException(String.format(
- "Permission denial: device owners cannot update %1$s", setting));
- }
+ throw new SecurityException(String.format(
+ "Permission denial: device owners cannot update %1$s", setting));
}
if (Settings.Global.STAY_ON_WHILE_PLUGGED_IN.equals(setting)) {