diff options
author | David van Tonder <david.vantonder@gmail.com> | 2013-05-28 05:18:14 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-05-28 05:18:14 -0700 |
commit | 37f907515702c3c95cae2a6050205d23ed373815 (patch) | |
tree | afb6f7021a363b8e9ed4de71bfc131abaf056028 /services | |
parent | 4c90669f2946c16900b723ce1f16485516267f2b (diff) | |
parent | 8d7d189971de9b48984da460af9f1f64c5a3a6ef (diff) | |
download | frameworks_base-37f907515702c3c95cae2a6050205d23ed373815.zip frameworks_base-37f907515702c3c95cae2a6050205d23ed373815.tar.gz frameworks_base-37f907515702c3c95cae2a6050205d23ed373815.tar.bz2 |
Merge "profiles: Broadcast profile updates" into cm-10.1
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/ProfileManagerService.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/java/com/android/server/ProfileManagerService.java b/services/java/com/android/server/ProfileManagerService.java index c7f12ee..743f051 100644 --- a/services/java/com/android/server/ProfileManagerService.java +++ b/services/java/com/android/server/ProfileManagerService.java @@ -54,6 +54,15 @@ public class ProfileManagerService extends IProfileManager.Stub { */ public static final String INTENT_ACTION_PROFILE_SELECTED = "android.intent.action.PROFILE_SELECTED"; + /** + * <p>Broadcast Action: Current profile has been updated. This is triggered every time the + * currently active profile is updated, instead of selected.</p> + * <p> For instance, this includes profile updates caused by a locale change, which doesn't + * trigger a profile selection, but causes its name to change.</p> + * @hide + */ + public static final String INTENT_ACTION_PROFILE_UPDATED = "android.intent.action.PROFILE_UPDATED"; + public static final String PERMISSION_CHANGE_SETTINGS = "android.permission.WRITE_SETTINGS"; private static final String PROFILE_FILENAME = "/data/system/profiles.xml"; @@ -218,6 +227,14 @@ public class ProfileManagerService extends IProfileManager.Stub { restoreCallingIdentity(token); persistIfDirty(); + } else if (lastProfile != mActiveProfile) { + // Something definitely changed: notify. + long token = clearCallingIdentity(); + Intent broadcast = new Intent(INTENT_ACTION_PROFILE_UPDATED); + broadcast.putExtra("name", mActiveProfile.getName()); + broadcast.putExtra("uuid", mActiveProfile.getUuid().toString()); + mContext.sendBroadcastAsUser(broadcast, UserHandle.ALL); + restoreCallingIdentity(token); } return true; } catch (Exception ex) { |