From 9e484aaad02885409a3168e13817ec3676e2d85f Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 24 Jun 2019 13:38:00 -0700 Subject: [PATCH] Dismiss lock screen when TrustAgent and bypass Before we were not triggering the face auth pipeline. Now we do it in order to have a signal that the user is actually present and we won't unlock in a pocket (possibly causing pocket dialing.) Test: manual Fixes: 135217150 Change-Id: I83c90bde5d386216bc8d7002e62802e69a939a00 --- .../android/keyguard/KeyguardUpdateMonitor.java | 16 +++++++++++++++- .../systemui/statusbar/phone/StatusBar.java | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 15ed0d259f5db..f465003a273d9 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -88,6 +88,7 @@ import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.WirelessUtils; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; +import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.google.android.collect.Lists; @@ -237,6 +238,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private List mSubscriptionInfo; private TrustManager mTrustManager; private UserManager mUserManager; + private KeyguardBypassController mKeyguardBypassController; private int mFingerprintRunningState = BIOMETRIC_STATE_STOPPED; private int mFaceRunningState = BIOMETRIC_STATE_STOPPED; private LockPatternUtils mLockPatternUtils; @@ -1662,10 +1664,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { final boolean isLockOutOrLockDown = strongAuth == StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT || strongAuth == StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; + + // There's no reason to ask the HAL for authentication when the user can dismiss the + // bouncer, unless we're bypassing and need to auto-dismiss the lock screen even when + // TrustAgents or biometrics are keeping the device unlocked. + boolean bypassEnabled = mKeyguardBypassController != null + && mKeyguardBypassController.getBypassEnabled(); + boolean becauseCannotSkipBouncer = !getUserCanSkipBouncer(user) || bypassEnabled; + // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant()) - && !mSwitchingUser && !getUserCanSkipBouncer(user) && !isFaceDisabled(user) + && !mSwitchingUser && !isFaceDisabled(user) && becauseCannotSkipBouncer && !mKeyguardGoingAway && mFaceSettingEnabledForUser && !mLockIconPressed && mUserManager.isUserUnlocked(user) && mIsPrimaryUser && !mSecureCameraLaunched && !isLockOutOrLockDown; @@ -2239,6 +2249,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { sendUpdates(callback); } + public void setKeyguardBypassController(KeyguardBypassController keyguardBypassController) { + mKeyguardBypassController = keyguardBypassController; + } + public boolean isSwitchingUser() { return mSwitchingUser; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 5e671bf71456a..213475fe3ca69 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -680,6 +680,7 @@ public class StatusBar extends SystemUI implements DemoMode, mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext); + mKeyguardUpdateMonitor.setKeyguardBypassController(mKeyguardBypassController); mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE));