summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-05-02 20:58:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-02 20:58:55 +0000
commitd23eb5ceb672f137235a94a036bf70eab19340dc (patch)
tree85eecb015433f046985f2088016132f46f0a0707 /services
parentc25f243a507f03bf7b0721b4406390b4fdf3d023 (diff)
parent7b66ed588525d2d79ef0df8b3024bae138d8681d (diff)
downloadframeworks_base-d23eb5ceb672f137235a94a036bf70eab19340dc.zip
frameworks_base-d23eb5ceb672f137235a94a036bf70eab19340dc.tar.gz
frameworks_base-d23eb5ceb672f137235a94a036bf70eab19340dc.tar.bz2
Merge "Send ACTION_MANAGED_PROFILE_REMOVED broadcast."
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 14df347..3239b46 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -1092,6 +1092,9 @@ public class UserManagerService extends IUserManager.Stub {
// on next startup, in case the runtime stops now before stopping and
// removing the user completely.
user.partial = true;
+ // Mark it as disabled, so that it isn't returned any more when
+ // profiles are queried.
+ user.flags |= UserInfo.FLAG_DISABLED;
writeUserLocked(user);
}
if (DBG) Slog.i(LOG_TAG, "Stopping user " + userHandle);
@@ -1120,6 +1123,7 @@ 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,
@@ -1140,6 +1144,11 @@ 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();
}
@@ -1191,6 +1200,13 @@ public class UserManagerService extends IUserManager.Stub {
parent.delete();
}
+ private void sendProfileRemovedBroadcast(int userHandle) {
+ 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);
+ }
+
@Override
public Bundle getApplicationRestrictions(String packageName) {
return getApplicationRestrictionsForUser(packageName, UserHandle.getCallingUserId());