From 9cc7ad65a13b5d40566ea18be41a3c5a3610d4ab Mon Sep 17 00:00:00 2001 From: Ricky Wai Date: Wed, 11 May 2016 18:00:20 +0100 Subject: [PATCH] Use userHandle not credentialOwnerUserId to check if it needs to show lock It is possible that unified keys stored in keystore is not migrated, while work mode is off and upgrade happens. At this moment, user not able to turn on work mode as work is not unlocked, and user cannot unlock work as parent's has a challenge. mLockPatternUtils.isSecure(userHandle) should be the same as mLockPatternUtils.isSecure(credentialOwnerUserId), except it is a unified lock and work profile does not setup a lock/key in keystore yet(migration). Bug: 28689675 Change-Id: Ia0755caa10ff94a25cf26c3e5907ecd33abd866e --- .../core/java/com/android/server/pm/UserManagerService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 6b0e5827d4e00..e72d233f4f807 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -694,9 +694,8 @@ public class UserManagerService extends IUserManager.Stub { @Override public boolean trySetQuietModeDisabled(int userHandle, IntentSender target) { - final int credentialOwnerUserId = getCredentialOwnerProfile(userHandle); if (StorageManager.isUserKeyUnlocked(userHandle) - || !mLockPatternUtils.isSecure(credentialOwnerUserId)) { + || !mLockPatternUtils.isSecure(userHandle)) { // if the user is already unlocked, no need to show a profile challenge setQuietModeEnabled(userHandle, false); return true;