summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy/java
diff options
context:
space:
mode:
authorZoltan Szatmary-Ban <szatmz@google.com>2015-01-16 12:36:29 +0000
committerZoltan Szatmary-Ban <szatmz@google.com>2015-01-23 14:08:30 +0000
commit871fa7343a2ff8de837a721eacfc576b19438e54 (patch)
tree1d94da3502fb555fcc112c7f5c06e3ec06c724c6 /services/devicepolicy/java
parent3379c1cb62488393c2c49b5f38483656c7175fa1 (diff)
downloadframeworks_base-871fa7343a2ff8de837a721eacfc576b19438e54.zip
frameworks_base-871fa7343a2ff8de837a721eacfc576b19438e54.tar.gz
frameworks_base-871fa7343a2ff8de837a721eacfc576b19438e54.tar.bz2
Ensure notifications are sent when locking/unlocking location share
When the restriction 'DISALLOW_SHARE_LOCATION' is applied or removed on a user it is important to send out notifications to content observers of LOCATION_PROVIDERS_ALLOWED. Bug: 18995405 Change-Id: I8b3910a423a012ea9d15470eec101723c9f0eaf7
Diffstat (limited to 'services/devicepolicy/java')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java13
1 files changed, 13 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 aae496c..d536906 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4872,6 +4872,19 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
}
mUserManager.setUserRestriction(key, enabled, user);
+ if (enabled != alreadyRestricted) {
+ if (UserManager.DISALLOW_SHARE_LOCATION.equals(key)) {
+ // Send out notifications however as some clients may want to reread the
+ // value which actually changed due to a restriction having been applied.
+ final String property = Settings.Secure.SYS_PROP_SETTING_VERSION;
+ long version = SystemProperties.getLong(property, 0) + 1;
+ SystemProperties.set(property, Long.toString(version));
+
+ final String name = Settings.Secure.LOCATION_PROVIDERS_ALLOWED;
+ Uri url = Uri.withAppendedPath(Settings.Secure.CONTENT_URI, name);
+ mContext.getContentResolver().notifyChange(url, null, true, userHandle);
+ }
+ }
} finally {
restoreCallingIdentity(id);
}