Merge "Clearing obsolete cloneUserId from CloneBackend." into udc-dev am: 4740720948
am: af793d86f2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23262239 Change-Id: I6a6b1f0824fefb1ec12cc61dda3c2b550d8fb072 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -165,4 +165,13 @@ public class CloneBackend {
|
||||
public int getCloneUserId() {
|
||||
return mCloneUserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets {@link #mCloneUserId} to -1.
|
||||
* Typically called after the cloneUser is removed, so that the obsolete clonedUserId present
|
||||
* with the CloneBackend instance can be cleared.
|
||||
*/
|
||||
public void resetCloneUserId() {
|
||||
mCloneUserId = -1;
|
||||
}
|
||||
}
|
||||
|
@@ -923,10 +923,15 @@ public class ManageApplications extends InstrumentedFragment
|
||||
}
|
||||
IUserManager um = IUserManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.USER_SERVICE));
|
||||
CloneBackend cloneBackend = CloneBackend.getInstance(getContext());
|
||||
try {
|
||||
// Warning: This removes all the data, media & images present in cloned user.
|
||||
um.removeUser(clonedUserId);
|
||||
mApplications.rebuild();
|
||||
if (um.removeUser(clonedUserId)) {
|
||||
cloneBackend.resetCloneUserId();
|
||||
mApplications.rebuild();
|
||||
} else if (ManageApplications.DEBUG) {
|
||||
Log.e(TAG, "Failed to remove cloned user");
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to remove cloned apps", e);
|
||||
Toast.makeText(getContext(),
|
||||
|
Reference in New Issue
Block a user