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

Commit b2796625 authored by Beverly's avatar Beverly
Browse files

Update pauseAuth value onPanelExpansionChange

So the UDFPS icon state won't be stale.

Test: atest UdfpsKeyguardViewControllerTest
Fixes: 235787666
Change-Id: I622ae8620cfe11b6c8ac6300e9f2d418da16febc
parent 8a1e0cf1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -510,6 +510,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
                    mKeyguardViewManager.isBouncerInTransit() ? BouncerPanelExpansionCalculator
                            .aboutToShowBouncerProgress(fraction) : fraction;
            updateAlpha();
            updatePauseAuth();
        }
    };

+35 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
@@ -468,6 +469,40 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
        verify(mView).setUnpausedAlpha(255);
    }

    @Test
    public void testUpdatePanelExpansion_pauseAuth() {
        // GIVEN view is attached + on the keyguard
        mController.onViewAttached();
        captureStatusBarStateListeners();
        captureStatusBarExpansionListeners();
        sendStatusBarStateChanged(StatusBarState.KEYGUARD);
        reset(mView);

        // WHEN panelViewExpansion changes to hide
        when(mView.getUnpausedAlpha()).thenReturn(0);
        updateStatusBarExpansion(0f, false);

        // THEN pause auth is updated to PAUSE
        verify(mView, atLeastOnce()).setPauseAuth(true);
    }

    @Test
    public void testUpdatePanelExpansion_unpauseAuth() {
        // GIVEN view is attached + on the keyguard + panel expansion is 0f
        mController.onViewAttached();
        captureStatusBarStateListeners();
        captureStatusBarExpansionListeners();
        sendStatusBarStateChanged(StatusBarState.KEYGUARD);
        reset(mView);

        // WHEN panelViewExpansion changes to expanded
        when(mView.getUnpausedAlpha()).thenReturn(255);
        updateStatusBarExpansion(1f, true);

        // THEN pause auth is updated to NOT pause
        verify(mView, atLeastOnce()).setPauseAuth(false);
    }

    private void sendStatusBarStateChanged(int statusBarState) {
        mStatusBarStateListener.onStateChanged(statusBarState);
    }