Use UserManager.removeUserOrSetEphemeral() to remove current user.

Test: manual verification
Bug: 173245580
Bug: 155913815

Change-Id: I74ac8d276f3a78f6c9483a980e4a05486b0c1a8c
This commit is contained in:
Felipe Leme
2020-11-13 15:13:21 -08:00
parent 3f74b1f520
commit 8031c0bbac

View File

@@ -747,8 +747,9 @@ public class UserSettings extends SettingsPreferenceFragment
return; return;
} }
try { try {
getContext().getSystemService(UserManager.class)
.removeUserOrSetEphemeral(UserHandle.myUserId());
ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM); ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM);
getContext().getSystemService(UserManager.class).removeUser(UserHandle.myUserId());
} catch (RemoteException re) { } catch (RemoteException re) {
Log.e(TAG, "Unable to remove self user"); Log.e(TAG, "Unable to remove self user");
} }