From e9acb59a91f46c962151a58142448fd9f4101814 Mon Sep 17 00:00:00 2001 From: Kenny Guy Date: Wed, 4 Feb 2015 17:55:42 +0000 Subject: Only switch user if current user is being wiped Only try and switch to owner if the current user is being removed. Bug: 19252449 Change-Id: I0143d87360db0834876821cbf52fec4933ecbd35 --- .../com/android/server/devicepolicy/DevicePolicyManagerService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'services') diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index fd4c016..40e2056 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -3049,7 +3049,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { mHandler.post(new Runnable() { public void run() { try { - ActivityManagerNative.getDefault().switchUser(UserHandle.USER_OWNER); + IActivityManager am = ActivityManagerNative.getDefault(); + if (am.getCurrentUser().id == userHandle) { + am.switchUser(UserHandle.USER_OWNER); + } if (!mUserManager.removeUser(userHandle)) { Slog.w(LOG_TAG, "Couldn't remove user " + userHandle); } -- cgit v1.1