diff options
author | Kenny Guy <kennyguy@google.com> | 2014-05-16 11:47:48 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-16 11:47:49 +0000 |
commit | 6f16aec6de6e9c49304e3589abc75eeff6d6f6af (patch) | |
tree | fb55a983352a79eb241f2b9c1becdce40f5648be /services | |
parent | 51dbce80ea1659b647a77a24b0b89281daab68ce (diff) | |
parent | f8d3a232e8df65aa75545963ee0ccf753b2d8fb9 (diff) | |
download | frameworks_base-6f16aec6de6e9c49304e3589abc75eeff6d6f6af.zip frameworks_base-6f16aec6de6e9c49304e3589abc75eeff6d6f6af.tar.gz frameworks_base-6f16aec6de6e9c49304e3589abc75eeff6d6f6af.tar.bz2 |
Merge "Send profile removed intent earlier so launchers updates."
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/UserManagerService.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 60212bf..a6cac5e 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -1125,6 +1125,14 @@ public class UserManagerService extends IUserManager.Stub { user.flags |= UserInfo.FLAG_DISABLED; writeUserLocked(user); } + + if (user.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID + && user.isManagedProfile()) { + // Send broadcast to notify system that the user removed was a + // managed user. + sendProfileRemovedBroadcast(user.profileGroupId, user.id); + } + if (DBG) Slog.i(LOG_TAG, "Stopping user " + userHandle); int res; try { @@ -1151,7 +1159,6 @@ public class UserManagerService extends IUserManager.Stub { // wiping the user's system directory and removing from the user list long ident = Binder.clearCallingIdentity(); try { - final boolean isManaged = getUserInfo(userHandle).isManagedProfile(); Intent addedIntent = new Intent(Intent.ACTION_USER_REMOVED); addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userHandle); mContext.sendOrderedBroadcastAsUser(addedIntent, UserHandle.ALL, @@ -1172,11 +1179,6 @@ public class UserManagerService extends IUserManager.Stub { removeUserStateLocked(userHandle); } } - // Send broadcast to notify system that the user removed was a - // managed user. - if (isManaged) { - sendProfileRemovedBroadcast(userHandle); - } } }.start(); } @@ -1228,11 +1230,11 @@ public class UserManagerService extends IUserManager.Stub { parent.delete(); } - private void sendProfileRemovedBroadcast(int userHandle) { + private void sendProfileRemovedBroadcast(int parentUserId, int removedUserId) { Intent managedProfileIntent = new Intent(Intent.ACTION_MANAGED_PROFILE_REMOVED); - managedProfileIntent.putExtra(Intent.EXTRA_USER, new UserHandle(userHandle)); - // Note: This makes an assumption that the parent owner is user 0. - mContext.sendBroadcastAsUser(managedProfileIntent, UserHandle.OWNER, null); + managedProfileIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); + managedProfileIntent.putExtra(Intent.EXTRA_USER, new UserHandle(removedUserId)); + mContext.sendBroadcastAsUser(managedProfileIntent, new UserHandle(parentUserId), null); } @Override |