Loading services/core/java/com/android/server/pm/UserManagerInternal.java +0 −9 Original line number Diff line number Diff line Loading @@ -211,15 +211,6 @@ public abstract class UserManagerInternal { */ public abstract void setForceEphemeralUsers(boolean forceEphemeralUsers); /** * Switches to the system user and deletes all other users. * * <p>Called by the {@link com.android.server.devicepolicy.DevicePolicyManagerService} when * the force-ephemeral-users policy is toggled on to make sure there are no pre-existing * non-ephemeral users left. */ public abstract void removeAllUsers(); /** * Called by the activity manager when the ephemeral user goes to background and its removal * starts as a result. Loading services/core/java/com/android/server/pm/UserManagerService.java +0 −48 Original line number Diff line number Diff line Loading @@ -7971,37 +7971,6 @@ public class UserManagerService extends IUserManager.Stub { } } @Override public void removeAllUsers() { if (UserHandle.USER_SYSTEM == getCurrentUserId()) { // Remove the non-system users straight away. removeAllUsersExceptSystemAndPermanentAdminMain(); } else { // Switch to the system user first and then remove the other users. BroadcastReceiver userSwitchedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); if (userId != UserHandle.USER_SYSTEM) { return; } mContext.unregisterReceiver(this); removeAllUsersExceptSystemAndPermanentAdminMain(); } }; IntentFilter userSwitchedFilter = new IntentFilter(); userSwitchedFilter.addAction(Intent.ACTION_USER_SWITCHED); mContext.registerReceiver( userSwitchedReceiver, userSwitchedFilter, null, mHandler); // Switch to the system user. ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); am.switchUser(UserHandle.USER_SYSTEM); } } @Override public void onEphemeralUserStop(@UserIdInt int userId) { synchronized (mUsersLock) { Loading Loading @@ -8486,23 +8455,6 @@ public class UserManagerService extends IUserManager.Stub { throw new UserManager.CheckedUserOperationException(message, userOperationResult); } /* Remove all the users except the system and permanent admin main.*/ private void removeAllUsersExceptSystemAndPermanentAdminMain() { ArrayList<UserInfo> usersToRemove = new ArrayList<>(); synchronized (mUsersLock) { final int userSize = mUsers.size(); for (int i = 0; i < userSize; i++) { UserInfo ui = mUsers.valueAt(i).info; if (ui.id != UserHandle.USER_SYSTEM && !isNonRemovableMainUser(ui)) { usersToRemove.add(ui); } } } for (UserInfo ui: usersToRemove) { removeUser(ui.id); } } private static void debug(String message) { Slog.d(LOG_TAG, message + (DBG_WITH_STACKTRACE ? " called at\n" + Debug.getCallers(10, " ") : "")); Loading Loading
services/core/java/com/android/server/pm/UserManagerInternal.java +0 −9 Original line number Diff line number Diff line Loading @@ -211,15 +211,6 @@ public abstract class UserManagerInternal { */ public abstract void setForceEphemeralUsers(boolean forceEphemeralUsers); /** * Switches to the system user and deletes all other users. * * <p>Called by the {@link com.android.server.devicepolicy.DevicePolicyManagerService} when * the force-ephemeral-users policy is toggled on to make sure there are no pre-existing * non-ephemeral users left. */ public abstract void removeAllUsers(); /** * Called by the activity manager when the ephemeral user goes to background and its removal * starts as a result. Loading
services/core/java/com/android/server/pm/UserManagerService.java +0 −48 Original line number Diff line number Diff line Loading @@ -7971,37 +7971,6 @@ public class UserManagerService extends IUserManager.Stub { } } @Override public void removeAllUsers() { if (UserHandle.USER_SYSTEM == getCurrentUserId()) { // Remove the non-system users straight away. removeAllUsersExceptSystemAndPermanentAdminMain(); } else { // Switch to the system user first and then remove the other users. BroadcastReceiver userSwitchedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); if (userId != UserHandle.USER_SYSTEM) { return; } mContext.unregisterReceiver(this); removeAllUsersExceptSystemAndPermanentAdminMain(); } }; IntentFilter userSwitchedFilter = new IntentFilter(); userSwitchedFilter.addAction(Intent.ACTION_USER_SWITCHED); mContext.registerReceiver( userSwitchedReceiver, userSwitchedFilter, null, mHandler); // Switch to the system user. ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); am.switchUser(UserHandle.USER_SYSTEM); } } @Override public void onEphemeralUserStop(@UserIdInt int userId) { synchronized (mUsersLock) { Loading Loading @@ -8486,23 +8455,6 @@ public class UserManagerService extends IUserManager.Stub { throw new UserManager.CheckedUserOperationException(message, userOperationResult); } /* Remove all the users except the system and permanent admin main.*/ private void removeAllUsersExceptSystemAndPermanentAdminMain() { ArrayList<UserInfo> usersToRemove = new ArrayList<>(); synchronized (mUsersLock) { final int userSize = mUsers.size(); for (int i = 0; i < userSize; i++) { UserInfo ui = mUsers.valueAt(i).info; if (ui.id != UserHandle.USER_SYSTEM && !isNonRemovableMainUser(ui)) { usersToRemove.add(ui); } } } for (UserInfo ui: usersToRemove) { removeUser(ui.id); } } private static void debug(String message) { Slog.d(LOG_TAG, message + (DBG_WITH_STACKTRACE ? " called at\n" + Debug.getCallers(10, " ") : "")); Loading