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

Commit 350ccaae authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update naming for the AlternateBouncer" into tm-qpr-dev

parents 978d953c 2757a5cb
Loading
Loading
Loading
Loading
+41 −36
Original line number Diff line number Diff line
@@ -314,8 +314,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private boolean mCredentialAttempted;
    private boolean mKeyguardGoingAway;
    private boolean mGoingToSleep;
    private boolean mBouncerFullyShown;
    private boolean mBouncerIsOrWillBeShowing;
    private boolean mPrimaryBouncerFullyShown;
    private boolean mPrimaryBouncerIsOrWillBeShowing;
    private boolean mUdfpsBouncerShowing;
    private boolean mAuthInterruptActive;
    private boolean mNeedsSlowUnlockTransition;
@@ -1664,8 +1664,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                public void onAuthenticationFailed() {
                        String reason =
                                mKeyguardBypassController.canBypass() ? "bypass"
                                        : mUdfpsBouncerShowing ? "udfpsBouncer" :
                                                mBouncerFullyShown ? "bouncer" : "udfpsFpDown";
                                        : mUdfpsBouncerShowing ? "udfpsBouncer"
                                                : mPrimaryBouncerFullyShown ? "bouncer"
                                                        : "udfpsFpDown";
                        requestActiveUnlock(
                                ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL,
                                "faceFailure-" + reason);
@@ -2057,7 +2058,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        handleKeyguardReset();
                        break;
                    case MSG_KEYGUARD_BOUNCER_CHANGED:
                        handleKeyguardBouncerChanged(msg.arg1, msg.arg2);
                        handlePrimaryBouncerChanged(msg.arg1, msg.arg2);
                        break;
                    case MSG_REPORT_EMERGENCY_CALL_ACTION:
                        handleReportEmergencyCallAction();
@@ -2526,7 +2527,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                requestOrigin,
                extraReason, canFaceBypass
                        || mUdfpsBouncerShowing
                        || mBouncerFullyShown
                        || mPrimaryBouncerFullyShown
                        || mAuthController.isUdfpsFingerDown());
    }

@@ -2547,7 +2548,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private boolean shouldTriggerActiveUnlock() {
        // Triggers:
        final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant();
        final boolean awakeKeyguard = mBouncerFullyShown || mUdfpsBouncerShowing
        final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mUdfpsBouncerShowing
                || (isKeyguardVisible() && !mGoingToSleep
                && mStatusBarState != StatusBarState.SHADE_LOCKED);

@@ -2626,7 +2627,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        final boolean shouldListenKeyguardState =
                isKeyguardVisible()
                        || !mDeviceInteractive
                        || (mBouncerIsOrWillBeShowing && !mKeyguardGoingAway)
                        || (mPrimaryBouncerIsOrWillBeShowing && !mKeyguardGoingAway)
                        || mGoingToSleep
                        || shouldListenForFingerprintAssistant
                        || (mKeyguardOccluded && mIsDreaming)
@@ -2645,8 +2646,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        && mIsPrimaryUser
                        && biometricEnabledForUser;

        final boolean shouldListenBouncerState =
                !(mFingerprintLockedOut && mBouncerIsOrWillBeShowing && mCredentialAttempted);
        final boolean shouldListenBouncerState = !(mFingerprintLockedOut
                && mPrimaryBouncerIsOrWillBeShowing && mCredentialAttempted);

        final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user);

@@ -2671,7 +2672,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    user,
                    shouldListen,
                    biometricEnabledForUser,
                    mBouncerIsOrWillBeShowing,
                        mPrimaryBouncerIsOrWillBeShowing,
                    userCanSkipBouncer,
                    mCredentialAttempted,
                    mDeviceInteractive,
@@ -2728,7 +2729,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        // Scan even when encrypted or timeout to show a preemptive bouncer when bypassing.
        // Lock-down mode shouldn't scan, since it is more explicit.
        boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass
                && !mBouncerFullyShown);
                && !mPrimaryBouncerFullyShown);

        // If the device supports face detection (without authentication) and bypass is enabled,
        // allow face scanning to happen if the device is in lockdown mode.
@@ -2749,7 +2750,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        final boolean shouldListen =
                (mBouncerFullyShown
                (mPrimaryBouncerFullyShown
                        || mAuthInterruptActive
                        || mOccludingAppRequestingFace
                        || awakeKeyguard
@@ -2776,7 +2777,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                    mAuthInterruptActive,
                    becauseCannotSkipBouncer,
                    biometricEnabledForUser,
                    mBouncerFullyShown,
                        mPrimaryBouncerFullyShown,
                    faceAuthenticated,
                    faceDisabledForUser,
                    isFaceLockedOut(),
@@ -3306,17 +3307,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    /**
     * Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED}
     *
     * @see #sendKeyguardBouncerChanged(boolean, boolean)
     * @see #sendPrimaryBouncerChanged(boolean, boolean)
     */
    private void handleKeyguardBouncerChanged(int bouncerIsOrWillBeShowing, int bouncerFullyShown) {
    private void handlePrimaryBouncerChanged(int primaryBouncerIsOrWillBeShowing,
            int primaryBouncerFullyShown) {
        Assert.isMainThread();
        final boolean wasBouncerIsOrWillBeShowing = mBouncerIsOrWillBeShowing;
        final boolean wasBouncerFullyShown = mBouncerFullyShown;
        mBouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing == 1;
        mBouncerFullyShown = bouncerFullyShown == 1;
        mLogger.logKeyguardBouncerChanged(mBouncerIsOrWillBeShowing, mBouncerFullyShown);

        if (mBouncerFullyShown) {
        final boolean wasPrimaryBouncerIsOrWillBeShowing = mPrimaryBouncerIsOrWillBeShowing;
        final boolean wasPrimaryBouncerFullyShown = mPrimaryBouncerFullyShown;
        mPrimaryBouncerIsOrWillBeShowing = primaryBouncerIsOrWillBeShowing == 1;
        mPrimaryBouncerFullyShown = primaryBouncerFullyShown == 1;
        mLogger.logPrimaryKeyguardBouncerChanged(mPrimaryBouncerIsOrWillBeShowing,
                mPrimaryBouncerFullyShown);

        if (mPrimaryBouncerFullyShown) {
            // If the bouncer is shown, always clear this flag. This can happen in the following
            // situations: 1) Default camera with SHOW_WHEN_LOCKED is not chosen yet. 2) Secure
            // camera requests dismiss keyguard (tapping on photos for example). When these happen,
@@ -3326,18 +3329,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            mCredentialAttempted = false;
        }

        if (wasBouncerIsOrWillBeShowing != mBouncerIsOrWillBeShowing) {
        if (wasPrimaryBouncerIsOrWillBeShowing != mPrimaryBouncerIsOrWillBeShowing) {
            for (int i = 0; i < mCallbacks.size(); i++) {
                KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
                if (cb != null) {
                    cb.onKeyguardBouncerStateChanged(mBouncerIsOrWillBeShowing);
                    cb.onKeyguardBouncerStateChanged(mPrimaryBouncerIsOrWillBeShowing);
                }
            }
            updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
        }

        if (wasBouncerFullyShown != mBouncerFullyShown) {
            if (mBouncerFullyShown) {
        if (wasPrimaryBouncerFullyShown != mPrimaryBouncerFullyShown) {
            if (mPrimaryBouncerFullyShown) {
                requestActiveUnlock(
                        ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.UNLOCK_INTENT,
                        "bouncerFullyShown");
@@ -3345,7 +3348,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            for (int i = 0; i < mCallbacks.size(); i++) {
                KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
                if (cb != null) {
                    cb.onKeyguardBouncerFullyShowingChanged(mBouncerFullyShown);
                    cb.onKeyguardBouncerFullyShowingChanged(mPrimaryBouncerFullyShown);
                }
            }
            updateFaceListeningState(BIOMETRIC_ACTION_UPDATE,
@@ -3496,14 +3499,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    }

    /**
     * @see #handleKeyguardBouncerChanged(int, int)
     * @see #handlePrimaryBouncerChanged(int, int)
     */
    public void sendKeyguardBouncerChanged(boolean bouncerIsOrWillBeShowing,
            boolean bouncerFullyShown) {
        mLogger.logSendKeyguardBouncerChanged(bouncerIsOrWillBeShowing, bouncerFullyShown);
    public void sendPrimaryBouncerChanged(boolean primaryBouncerIsOrWillBeShowing,
            boolean primaryBouncerFullyShown) {
        mLogger.logSendPrimaryBouncerChanged(primaryBouncerIsOrWillBeShowing,
                primaryBouncerFullyShown);
        Message message = mHandler.obtainMessage(MSG_KEYGUARD_BOUNCER_CHANGED);
        message.arg1 = bouncerIsOrWillBeShowing ? 1 : 0;
        message.arg2 = bouncerFullyShown ? 1 : 0;
        message.arg1 = primaryBouncerIsOrWillBeShowing ? 1 : 0;
        message.arg2 = primaryBouncerFullyShown ? 1 : 0;
        message.sendToTarget();
    }

@@ -3863,7 +3867,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            if (isUdfpsSupported()) {
                pw.println("        udfpsEnrolled=" + isUdfpsEnrolled());
                pw.println("        shouldListenForUdfps=" + shouldListenForFingerprint(true));
                pw.println("        mBouncerIsOrWillBeShowing=" + mBouncerIsOrWillBeShowing);
                pw.println("        mPrimaryBouncerIsOrWillBeShowing="
                        + mPrimaryBouncerIsOrWillBeShowing);
                pw.println("        mStatusBarState=" + StatusBarState.toString(mStatusBarState));
                pw.println("        mUdfpsBouncerShowing=" + mUdfpsBouncerShowing);
            } else if (isSfpsSupported()) {
@@ -3893,7 +3898,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            pw.println("    mFaceLockedOutPermanent=" + mFaceLockedOutPermanent);
            pw.println("    enabledByUser=" + mBiometricEnabledForUser.get(userId));
            pw.println("    mSecureCameraLaunched=" + mSecureCameraLaunched);
            pw.println("    mBouncerFullyShown=" + mBouncerFullyShown);
            pw.println("    mPrimaryBouncerFullyShown=" + mPrimaryBouncerFullyShown);
            pw.println("    mNeedsSlowUnlockTransition=" + mNeedsSlowUnlockTransition);
        }
        mListenModels.print(pw);
+11 −12
Original line number Diff line number Diff line
@@ -50,15 +50,10 @@ public interface KeyguardViewController {

    /**
     * Resets the state of Keyguard View.
     * @param hideBouncerWhenShowing
     * @param hideBouncerWhenShowing when true, hides the primary and alternate bouncers if showing.
     */
    void reset(boolean hideBouncerWhenShowing);

    /**
     * Stop showing any alternate auth methods.
     */
    void resetAlternateAuth(boolean forceUpdateScrim);

    /**
     * Called when the device started going to sleep.
     */
@@ -156,20 +151,24 @@ public interface KeyguardViewController {
    void notifyKeyguardAuthenticated(boolean strongAuth);

    /**
     * Shows the Bouncer.
     *
     * Shows the primary bouncer.
     */
    void showPrimaryBouncer(boolean scrimmed);

    /**
     * When the primary bouncer is fully visible or is showing but animation didn't finish yet.
     */
    void showBouncer(boolean scrimmed);
    boolean primaryBouncerIsOrWillBeShowing();

    /**
     * Returns {@code true} when the bouncer is currently showing
     * Returns {@code true} when the primary bouncer or alternate bouncer is currently showing
     */
    boolean isBouncerShowing();

    /**
     * When bouncer is fully visible or it is showing but animation didn't finish yet.
     * Stop showing the alternate bouncer, if showing.
     */
    boolean bouncerIsOrWillBeShowing();
    void hideAlternateBouncer(boolean forceUpdateScrim);

    // TODO: Deprecate registerStatusBar in KeyguardViewController interface. It is currently
    //  only used for testing purposes in StatusBarKeyguardViewManager, and it prevents us from
+1 −1
Original line number Diff line number Diff line
@@ -699,7 +699,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
                "lock-screen-lock-icon-longpress",
                TOUCH_VIBRATION_ATTRIBUTES);

        mKeyguardViewController.showBouncer(/* scrim */ true);
        mKeyguardViewController.showPrimaryBouncer(/* scrim */ true);
    }


+15 −12
Original line number Diff line number Diff line
@@ -166,13 +166,16 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
                { "Previously active sub id $int1 is now invalid, will remove" })
    }

    fun logKeyguardBouncerChanged(bouncerIsOrWillBeShowing: Boolean, bouncerFullyShown: Boolean) {
    fun logPrimaryKeyguardBouncerChanged(
            primaryBouncerIsOrWillBeShowing: Boolean,
            primaryBouncerFullyShown: Boolean
    ) {
        logBuffer.log(TAG, DEBUG, {
            bool1 = bouncerIsOrWillBeShowing
            bool2 = bouncerFullyShown
            bool1 = primaryBouncerIsOrWillBeShowing
            bool2 = primaryBouncerFullyShown
        }, {
            "handleKeyguardBouncerChanged " +
                    "bouncerIsOrWillBeShowing=$bool1 bouncerFullyShowing=$bool2"
            "handlePrimaryBouncerChanged " +
                    "primaryBouncerIsOrWillBeShowing=$bool1 primaryBouncerFullyShown=$bool2"
        })
    }

@@ -229,16 +232,16 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
                { "Retrying fingerprint attempt: $int1" })
    }

    fun logSendKeyguardBouncerChanged(
        bouncerIsOrWillBeShowing: Boolean,
        bouncerFullyShown: Boolean,
    fun logSendPrimaryBouncerChanged(
        primaryBouncerIsOrWillBeShowing: Boolean,
        primaryBouncerFullyShown: Boolean,
    ) {
        logBuffer.log(TAG, DEBUG, {
            bool1 = bouncerIsOrWillBeShowing
            bool2 = bouncerFullyShown
            bool1 = primaryBouncerIsOrWillBeShowing
            bool2 = primaryBouncerFullyShown
        }, {
            "sendKeyguardBouncerChanged bouncerIsOrWillBeShowing=$bool1 " +
                    "bouncerFullyShown=$bool2"
            "sendPrimaryBouncerChanged primaryBouncerIsOrWillBeShowing=$bool1 " +
                    "primaryBouncerFullyShown=$bool2"
        })
    }

+11 −11
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ import com.android.systemui.doze.DozeReceiver;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.domain.interactor.BouncerInteractor;
import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shade.ShadeExpansionStateManager;
@@ -140,7 +140,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
    @NonNull private final LatencyTracker mLatencyTracker;
    @VisibleForTesting @NonNull final BiometricDisplayListener mOrientationListener;
    @NonNull private final ActivityLaunchAnimator mActivityLaunchAnimator;
    @NonNull private final BouncerInteractor mBouncerInteractor;
    @NonNull private final PrimaryBouncerInteractor mPrimaryBouncerInteractor;

    // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
    // sensors, this, in addition to a lot of the code here, will be updated.
@@ -229,7 +229,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                            mUdfpsDisplayMode, requestId, reason, callback,
                            (view, event, fromUdfpsView) -> onTouch(requestId, event,
                                    fromUdfpsView), mActivityLaunchAnimator, mFeatureFlags,
                            mBouncerInteractor)));
                            mPrimaryBouncerInteractor)));
        }

        @Override
@@ -320,14 +320,14 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        if (!mOverlayParams.equals(overlayParams)) {
            mOverlayParams = overlayParams;

            final boolean wasShowingAltAuth = mKeyguardViewManager.isShowingAlternateAuth();
            final boolean wasShowingAltAuth = mKeyguardViewManager.isShowingAlternateBouncer();

            // When the bounds change it's always necessary to re-create the overlay's window with
            // new LayoutParams. If the overlay needs to be shown, this will re-create and show the
            // overlay with the updated LayoutParams. Otherwise, the overlay will remain hidden.
            redrawOverlay();
            if (wasShowingAltAuth) {
                mKeyguardViewManager.showGenericBouncer(true);
                mKeyguardViewManager.showBouncer(true);
            }
        }
    }
@@ -626,7 +626,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
            @NonNull ActivityLaunchAnimator activityLaunchAnimator,
            @NonNull Optional<AlternateUdfpsTouchProvider> alternateTouchProvider,
            @NonNull @BiometricsBackground Executor biometricsExecutor,
            @NonNull BouncerInteractor bouncerInteractor) {
            @NonNull PrimaryBouncerInteractor primaryBouncerInteractor) {
        mContext = context;
        mExecution = execution;
        mVibrator = vibrator;
@@ -643,6 +643,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
        mDumpManager = dumpManager;
        mDialogManager = dialogManager;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mFeatureFlags = featureFlags;
        mFalsingManager = falsingManager;
        mPowerManager = powerManager;
        mAccessibilityManager = accessibilityManager;
@@ -664,8 +665,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                false /* resetLockoutRequiresHardwareAuthToken */);

        mBiometricExecutor = biometricsExecutor;
        mFeatureFlags = featureFlags;
        mBouncerInteractor = bouncerInteractor;
        mPrimaryBouncerInteractor = primaryBouncerInteractor;

        mDumpManager.registerDumpable(TAG, this);

@@ -757,8 +757,8 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                onFingerUp(mOverlay.getRequestId(), oldView);
            }
            final boolean removed = mOverlay.hide();
            if (mKeyguardViewManager.isShowingAlternateAuth()) {
                mKeyguardViewManager.resetAlternateAuth(true);
            if (mKeyguardViewManager.isShowingAlternateBouncer()) {
                mKeyguardViewManager.hideAlternateBouncer(true);
            }
            Log.v(TAG, "hideUdfpsOverlay | removing window: " + removed);
        } else {
@@ -798,7 +798,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                Log.v(TAG, "aod lock icon long-press rejected by the falsing manager.");
                return;
            }
            mKeyguardViewManager.showBouncer(true);
            mKeyguardViewManager.showPrimaryBouncer(true);

            // play the same haptic as the LockIconViewController longpress
            mVibrator.vibrate(
Loading