Refactored Settings calls to removeUserOrSetEphemeral().
Test: atest com.android.car.user.CarUserServiceTest \
android.car.apitest.CarDevicePolicyManagerTest#testRemoveUser_whenDisallowed
Bug: 170887769
Change-Id: If797ace64c0fa0262116f649212bbcb1d61e2046
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 8ba5432..af53a8c 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -751,7 +751,8 @@
}
try {
getContext().getSystemService(UserManager.class)
- .removeUserOrSetEphemeral(UserHandle.myUserId());
+ .removeUserOrSetEphemeral(UserHandle.myUserId(),
+ /* evenWhenDisallowed= */ false);
ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM);
} catch (RemoteException re) {
Log.e(TAG, "Unable to remove self user");