diff options
author | Nicolas Prevot <nprevot@google.com> | 2015-07-02 14:03:06 +0100 |
---|---|---|
committer | Nicolas Prevot <nprevot@google.com> | 2015-07-03 13:13:46 +0100 |
commit | 310e1eeb352e6e65e83a108c66bbea9f441ba58d (patch) | |
tree | d831aa74dda01be81cc07d72ec754d7ddb6b42ea /packages | |
parent | e40d7a632668a3813a443195ba8e2146407a0517 (diff) | |
download | frameworks_base-310e1eeb352e6e65e83a108c66bbea9f441ba58d.zip frameworks_base-310e1eeb352e6e65e83a108c66bbea9f441ba58d.tar.gz frameworks_base-310e1eeb352e6e65e83a108c66bbea9f441ba58d.tar.bz2 |
Notify the profile when cloned settings are changed.
In SettingsProvider, for settings that are cloned from the parent
to the profile:
When the parent value is changed, notify ContentObservers in the
profile as well.
BUG:21414456
Change-Id: Ie0560d1332174499d067db9978553843b640a161
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 41043eb..8d9f3fd 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -1774,6 +1774,26 @@ public class SettingsProvider extends ContentProvider { Uri uri = getNotificationUriFor(key, name); sendNotify(uri, userId); + if (isSecureSettingsKey(key)) { + maybeNotifyProfiles(userId, uri, name, sSecureCloneToManagedSettings); + } else if (isSystemSettingsKey(key)) { + maybeNotifyProfiles(userId, uri, name, sSystemCloneToManagedSettings); + } + } + + private void maybeNotifyProfiles(int userId, Uri uri, String name, + Set<String> keysCloned) { + if (keysCloned.contains(name)) { + List<UserInfo> profiles = mUserManager.getProfiles(userId); + int size = profiles.size(); + for (int i = 0; i < size; i++) { + UserInfo profile = profiles.get(i); + // the notification for userId has already been sent. + if (profile.id != userId) { + sendNotify(uri, profile.id); + } + } + } } private int makeKey(int type, int userId) { |