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

Commit 663ed464 authored by Beverly's avatar Beverly
Browse files

Update bouncer visibility on altAuthBouncer changes

Previously when the UDFPS bouncer disappeared,
the UdfpsKeyguardViewController wouldn't appropriately
update its state, so it wouldn't reappear. This fixes
that issue.

Test: atest SystemUITests
Test: manual
Fixes: 223693990
Change-Id: I303328cd82677cf964d143b447676dba9a255dc4
parent 4a93e580
Loading
Loading
Loading
Loading
+28 −19
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.content.res.Configuration;
import android.util.Log;
import android.util.MathUtils;
import android.view.MotionEvent;

@@ -83,7 +82,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
     * {@link KeyguardBouncer#EXPANSION_HIDDEN} (1f)
     */
    private float mInputBouncerHiddenAmount;
    private boolean mIsBouncerVisible;
    private boolean mIsGenericBouncerShowing; // whether UDFPS bouncer or input bouncer is visible

    protected UdfpsKeyguardViewController(
            @NonNull UdfpsKeyguardView view,
@@ -151,8 +150,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
        mStatusBarState = getStatusBarStateController().getState();
        mQsExpanded = mKeyguardViewManager.isQsExpanded();
        mInputBouncerHiddenAmount = KeyguardBouncer.EXPANSION_HIDDEN;
        mIsBouncerVisible = mKeyguardViewManager.bouncerIsOrWillBeShowing();
        updateGenericBouncerVisibility();
        mConfigurationController.addCallback(mConfigurationListener);
        getPanelExpansionStateManager().addExpansionListener(mPanelExpansionListener);
        updateAlpha();
@@ -187,7 +185,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        pw.println("mFaceDetectRunning=" + mFaceDetectRunning);
        pw.println("mStatusBarState=" + StatusBarState.toString(mStatusBarState));
        pw.println("mQsExpanded=" + mQsExpanded);
        pw.println("mIsBouncerVisible=" + mIsBouncerVisible);
        pw.println("mIsGenericBouncerShowing=" + mIsGenericBouncerShowing);
        pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount);
        pw.println("mPanelExpansionFraction=" + mPanelExpansionFraction);
        pw.println("unpausedAlpha=" + mView.getUnpausedAlpha());
@@ -225,6 +223,8 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        } else {
            mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false);
        }

        updateGenericBouncerVisibility();
        updateAlpha();
        updatePauseAuth();
        return true;
@@ -241,7 +241,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        }

        if (mUdfpsRequested && !getNotificationShadeVisible()
                && (!mIsBouncerVisible
                && (!mIsGenericBouncerShowing
                || mInputBouncerHiddenAmount != KeyguardBouncer.EXPANSION_VISIBLE)
                && mKeyguardStateController.isShowing()) {
            return false;
@@ -267,13 +267,8 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
            return true;
        }

        if (mInputBouncerHiddenAmount < .5f || mIsBouncerVisible) {
            if (!getStatusBarStateController().isDozing()) {
        if (mInputBouncerHiddenAmount < .5f) {
            return true;
            } else {
                Log.e(TAG, "Bouncer state claims visible on doze hiddenAmount="
                        + mInputBouncerHiddenAmount + " bouncerVisible=" + mIsBouncerVisible);
            }
        }

        return false;
@@ -351,6 +346,21 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        mView.setUnpausedAlpha(alpha);
    }

    /**
     * Updates mIsGenericBouncerShowing (whether any bouncer is showing) and updates the
     * mInputBouncerHiddenAmount to reflect whether the input bouncer is fully showing or not.
     */
    private void updateGenericBouncerVisibility() {
        mIsGenericBouncerShowing = mKeyguardViewManager.isBouncerShowing(); // includes altBouncer
        final boolean altBouncerShowing = mKeyguardViewManager.isShowingAlternateAuth();
        if (altBouncerShowing || !mKeyguardViewManager.bouncerIsOrWillBeShowing()) {
            mInputBouncerHiddenAmount = 1f;
        } else if (mIsGenericBouncerShowing) {
            // input bouncer is fully showing
            mInputBouncerHiddenAmount = 0f;
        }
    }

    private final StatusBarStateController.StateListener mStateListener =
            new StatusBarStateController.StateListener() {
        @Override
@@ -434,14 +444,13 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
                    updatePauseAuth();
                }

                /**
                 * Only called on primary auth bouncer changes, not on whether the UDFPS bouncer
                 * visibility changes.
                 */
                @Override
                public void onBouncerVisibilityChanged() {
                    mIsBouncerVisible = mKeyguardViewManager.isBouncerShowing();
                    if (!mIsBouncerVisible) {
                        mInputBouncerHiddenAmount = 1f;
                    } else if (mKeyguardViewManager.isBouncerShowing()) {
                        mInputBouncerHiddenAmount = 0f;
                    }
                    updateGenericBouncerVisibility();
                    updateAlpha();
                    updatePauseAuth();
                }
+2 −0
Original line number Diff line number Diff line
@@ -1268,6 +1268,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        pw.println("  mAfterKeyguardGoneAction: " + mAfterKeyguardGoneAction);
        pw.println("  mAfterKeyguardGoneRunnables: " + mAfterKeyguardGoneRunnables);
        pw.println("  mPendingWakeupAction: " + mPendingWakeupAction);
        pw.println("  isBouncerShowing(): " + isBouncerShowing());
        pw.println("  bouncerIsOrWillBeShowing(): " + bouncerIsOrWillBeShowing());

        if (mBouncer != null) {
            mBouncer.dump(pw);
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {

        captureAltAuthInterceptor();
        when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
        when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true);
        mAltAuthInterceptor.onBouncerVisibilityChanged();

        assertTrue(mController.shouldPauseAuth());