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

Commit 89bada69 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Retain udfps auth bouncer after orientation change" into sc-qpr1-dev...

Merge "Retain udfps auth bouncer after orientation change" into sc-qpr1-dev am: 28727376 am: 2d9d1920 am: 344730e5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15660017

Change-Id: I850964a99b91428df7dea20a14781220db4763d9
parents 40322f13 344730e5
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -706,15 +706,21 @@ public class UdfpsController implements DozeReceiver {
        return mCoreLayoutParams;
        return mCoreLayoutParams;
    }
    }



    private void onOrientationChanged() {
    private void onOrientationChanged() {
        // When the configuration changes it's almost always necessary to destroy and re-create
        // When the configuration changes it's almost always necessary to destroy and re-create
        // the overlay's window to pass it the new LayoutParams.
        // the overlay's window to pass it the new LayoutParams.
        // Hiding the overlay will destroy its window. It's safe to hide the overlay regardless
        // Hiding the overlay will destroy its window. It's safe to hide the overlay regardless
        // of whether it is already hidden.
        // of whether it is already hidden.
        final boolean wasShowingAltAuth = mKeyguardViewManager.isShowingAlternateAuth();
        hideUdfpsOverlay();
        hideUdfpsOverlay();

        // If the overlay needs to be shown, this will re-create and show the overlay with the
        // 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.
        // updated LayoutParams. Otherwise, the overlay will remain hidden.
        updateOverlay();
        updateOverlay();
        if (wasShowingAltAuth) {
            mKeyguardViewManager.showGenericBouncer(true);
        }
    }
    }


    private void showUdfpsOverlay(@NonNull ServerRequest request) {
    private void showUdfpsOverlay(@NonNull ServerRequest request) {
@@ -821,10 +827,14 @@ public class UdfpsController implements DozeReceiver {
            Log.v(TAG, "hideUdfpsOverlay | removing window");
            Log.v(TAG, "hideUdfpsOverlay | removing window");
            // Reset the controller back to its starting state.
            // Reset the controller back to its starting state.
            onFingerUp();
            onFingerUp();
            boolean wasShowingAltAuth = mKeyguardViewManager.isShowingAlternateAuth();
            mWindowManager.removeView(mView);
            mWindowManager.removeView(mView);
            mView.setOnTouchListener(null);
            mView.setOnTouchListener(null);
            mView.setOnHoverListener(null);
            mView.setOnHoverListener(null);
            mView.setAnimationViewController(null);
            mView.setAnimationViewController(null);
            if (wasShowingAltAuth) {
                mKeyguardViewManager.resetAlternateAuth(true);
            }
            mAccessibilityManager.removeTouchExplorationStateChangeListener(
            mAccessibilityManager.removeTouchExplorationStateChangeListener(
                    mTouchExplorationStateChangeListener);
                    mTouchExplorationStateChangeListener);
            mView = null;
            mView = null;
+6 −0
Original line number Original line Diff line number Diff line
@@ -107,6 +107,12 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        return "UdfpsKeyguardViewController";
        return "UdfpsKeyguardViewController";
    }
    }


    @Override
    public void onInit() {
        super.onInit();
        mKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor);
    }

    @Override
    @Override
    protected void onViewAttached() {
    protected void onViewAttached() {
        super.onViewAttached();
        super.onViewAttached();
+4 −2
Original line number Original line Diff line number Diff line
@@ -308,9 +308,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
     * Sets a new alt auth interceptor.
     * Sets a new alt auth interceptor.
     */
     */
    public void setAlternateAuthInterceptor(@NonNull AlternateAuthInterceptor authInterceptor) {
    public void setAlternateAuthInterceptor(@NonNull AlternateAuthInterceptor authInterceptor) {
        if (!Objects.equals(mAlternateAuthInterceptor, authInterceptor)) {
            mAlternateAuthInterceptor = authInterceptor;
            mAlternateAuthInterceptor = authInterceptor;
            resetAlternateAuth(false);
            resetAlternateAuth(false);
        }
        }
    }


    private void registerListeners() {
    private void registerListeners() {
        mKeyguardUpdateManager.registerCallback(mUpdateMonitorCallback);
        mKeyguardUpdateManager.registerCallback(mUpdateMonitorCallback);
+15 −0
Original line number Original line Diff line number Diff line
@@ -416,6 +416,21 @@ public class UdfpsControllerTest extends SysuiTestCase {
        verify(mWindowManager).removeView(eq(mUdfpsView));
        verify(mWindowManager).removeView(eq(mUdfpsView));
    }
    }


    @Test
    public void hideUdfpsOverlay_resetsAltAuthBouncerWhenShowing() throws RemoteException {
        // GIVEN overlay was showing and the udfps bouncer is showing
        mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID,
                IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD, mUdfpsOverlayControllerCallback);
        when(mStatusBarKeyguardViewManager.isShowingAlternateAuth()).thenReturn(true);

        // WHEN the overlay is hidden
        mOverlayController.hideUdfpsOverlay(TEST_UDFPS_SENSOR_ID);
        mFgExecutor.runAllReady();

        // THEN the udfps bouncer is reset
        verify(mStatusBarKeyguardViewManager).resetAlternateAuth(eq(true));
    }

    @Test
    @Test
    public void testSubscribesToOrientationChangesWhenShowingOverlay() throws Exception {
    public void testSubscribesToOrientationChangesWhenShowingOverlay() throws Exception {
        mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID,
        mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID,