From f561d7f27598276e6547eea87addb2be9bf83323 Mon Sep 17 00:00:00 2001 From: Xiaohui Chen Date: Thu, 9 Jul 2015 16:35:00 -0700 Subject: [PATCH] sys user split: turn off unlocking for sys user. This is to unblock the team to test system user split as soon as possible. This is not how it is going to work eventually. BUG:19913735 Change-Id: I27aaf4491258fe08a3d64ec06358dae482192fbd --- .../keyguard/KeyguardViewMediator.java | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 009a0d629c947..6e6f73cd25ba1 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1013,33 +1013,38 @@ public class KeyguardViewMediator extends SystemUI { return; } - // if the setup wizard hasn't run yet, don't show - final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false); - final boolean absent = SubscriptionManager.isValidSubscriptionId( - mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.ABSENT)); - final boolean disabled = SubscriptionManager.isValidSubscriptionId( - mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.PERM_DISABLED)); - final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure() - || ((absent || disabled) && requireSim); + // In split system user mode, we never unlock system user. + if (!UserManager.isSplitSystemUser() + || KeyguardUpdateMonitor.getCurrentUser() != UserHandle.USER_SYSTEM) { - if (!lockedOrMissing && shouldWaitForProvisioning()) { - if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned" - + " and the sim is not locked or missing"); - return; - } + // if the setup wizard hasn't run yet, don't show + final boolean requireSim = !SystemProperties.getBoolean("keyguard.no_require_sim", false); + final boolean absent = SubscriptionManager.isValidSubscriptionId( + mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.ABSENT)); + final boolean disabled = SubscriptionManager.isValidSubscriptionId( + mUpdateMonitor.getNextSubIdForState(IccCardConstants.State.PERM_DISABLED)); + final boolean lockedOrMissing = mUpdateMonitor.isSimPinSecure() + || ((absent || disabled) && requireSim); - if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()) - && !lockedOrMissing) { - if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); - return; - } + if (!lockedOrMissing && shouldWaitForProvisioning()) { + if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned" + + " and the sim is not locked or missing"); + return; + } - if (mLockPatternUtils.checkVoldPassword(KeyguardUpdateMonitor.getCurrentUser())) { - if (DEBUG) Log.d(TAG, "Not showing lock screen since just decrypted"); - // Without this, settings is not enabled until the lock screen first appears - setShowingLocked(false); - hideLocked(); - return; + if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()) + && !lockedOrMissing) { + if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); + return; + } + + if (mLockPatternUtils.checkVoldPassword(KeyguardUpdateMonitor.getCurrentUser())) { + if (DEBUG) Log.d(TAG, "Not showing lock screen since just decrypted"); + // Without this, settings is not enabled until the lock screen first appears + setShowingLocked(false); + hideLocked(); + return; + } } if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen"); @@ -1391,6 +1396,15 @@ public class KeyguardViewMediator extends SystemUI { synchronized (KeyguardViewMediator.this) { if (DEBUG) Log.d(TAG, "handleHide"); + if (UserManager.isSplitSystemUser() + && KeyguardUpdateMonitor.getCurrentUser() == UserHandle.USER_SYSTEM) { + // In split system user mode, we never unlock system user. The end user has to + // switch to another user. + // TODO: We should stop it early by disabling the swipe up flow. Right now swipe up + // still completes and makes the screen blank. + if (DEBUG) Log.d(TAG, "Split system user, quit unlocking."); + return; + } mHiding = true; if (mShowing && !mOccluded) { if (!mHideAnimationRun) {