Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e484aaa authored by Lucas Dupin's avatar Lucas Dupin
Browse files

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
parent 16f1032a
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -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<SubscriptionInfo> 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;
    }
+1 −0
Original line number Diff line number Diff line
@@ -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));