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

Commit fcd76436 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Update bouncer visibility on altAuthBouncer changes" into tm-dev am: 5778a88d

parents d391158b 5778a88d
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
@@ -1270,6 +1270,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());