diff options
author | Kenny Guy <kennyguy@google.com> | 2014-05-15 16:09:52 +0100 |
---|---|---|
committer | Kenny Guy <kennyguy@google.com> | 2014-05-15 17:12:02 +0100 |
commit | f8d3a232e8df65aa75545963ee0ccf753b2d8fb9 (patch) | |
tree | 270dd241d44aeef9a44ba2708d3d003c221e6ef0 /services | |
parent | 54b6fd0cbe48fc0980da0617352785c973c60c86 (diff) | |
download | frameworks_base-f8d3a232e8df65aa75545963ee0ccf753b2d8fb9.zip frameworks_base-f8d3a232e8df65aa75545963ee0ccf753b2d8fb9.tar.gz frameworks_base-f8d3a232e8df65aa75545963ee0ccf753b2d8fb9.tar.bz2 |
Send profile removed intent earlier so launchers updates.
This sends the profile removed intent when the user has
been disabled.
Bug: 14981942
Change-Id: I32ab9c68ca53ec3aac0c930c0bbf93da7ff5b479
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 |