summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorBenjamin Franz <bfranz@google.com>2015-03-11 15:43:06 +0000
committerBenjamin Franz <bfranz@google.com>2015-03-13 09:44:44 +0000
commit68cc42009e656b785420c531e39c131bbe6729cf (patch)
tree95c34ba1e73d2d43f3dce7da9eda2f6621f7af01 /services/devicepolicy
parentc6ee744a90a4a84df93b6631ca7df8736ef320e1 (diff)
downloadframeworks_base-68cc42009e656b785420c531e39c131bbe6729cf.zip
frameworks_base-68cc42009e656b785420c531e39c131bbe6729cf.tar.gz
frameworks_base-68cc42009e656b785420c531e39c131bbe6729cf.tar.bz2
Allow DO to set Settings.Global.STAY_ON_WHILE_PLUGGED_IN
Bug: 19704419 Change-Id: I3fc970eae8ef947775b6b565916bb245dea1b43b
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 00d7971..365a67a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -211,6 +211,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
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);
}
final Context mContext;
@@ -5437,6 +5438,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
}
+ if (Settings.Global.STAY_ON_WHILE_PLUGGED_IN.equals(setting)) {
+ // ignore if it contradicts an existing policy
+ long timeMs = getMaximumTimeToLock(who, UserHandle.getCallingUserId());
+ if (timeMs > 0 && timeMs < Integer.MAX_VALUE) {
+ return;
+ }
+ }
+
long id = Binder.clearCallingIdentity();
try {
Settings.Global.putString(contentResolver, setting, value);