Merge "Update pauseAuth value onPanelExpansionChange" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-06-27 17:42:44 +00:00
committed by Android (Google) Code Review
2 changed files with 36 additions and 0 deletions

View File

@@ -510,6 +510,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
mKeyguardViewManager.isBouncerInTransit() ? BouncerPanelExpansionCalculator
.aboutToShowBouncerProgress(fraction) : fraction;
updateAlpha();
updatePauseAuth();
}
};

View File

@@ -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);
}