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

Commit 48fbc807 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update pauseAuth value onPanelExpansionChange" into tm-qpr-dev am: c2b87df8 am: 0e38fead

parents e6acde5f 0e38fead
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -510,6 +510,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
                    mKeyguardViewManager.isBouncerInTransit() ? BouncerPanelExpansionCalculator
                    mKeyguardViewManager.isBouncerInTransit() ? BouncerPanelExpansionCalculator
                            .aboutToShowBouncerProgress(fraction) : fraction;
                            .aboutToShowBouncerProgress(fraction) : fraction;
            updateAlpha();
            updateAlpha();
            updatePauseAuth();
        }
        }
    };
    };


+35 −0
Original line number Original line 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.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.reset;
@@ -468,6 +469,40 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
        verify(mView).setUnpausedAlpha(255);
        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) {
    private void sendStatusBarStateChanged(int statusBarState) {
        mStatusBarStateListener.onStateChanged(statusBarState);
        mStatusBarStateListener.onStateChanged(statusBarState);
    }
    }