Make sure udfps bouncer always shows when requested

Even if the shade is expanding. This ensures that when the user
expands a notification that is hiding sensitive content,
that we still show the udfps bouncer even though the
transition to shade is also occuring (which normally hides the
udfps affordance).

Test: manual, atest UdfpsKeyguardViewControllerTest
Fixes: 197119617
Change-Id: Iac398a60ecf5137d0c3a8c77d700146e12fad0b7
This commit is contained in:
Beverly
2021-09-08 09:41:00 -04:00
parent 9ca7052183
commit 5a5cd54366
2 changed files with 38 additions and 2 deletions

View File

@@ -287,7 +287,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
: (int) MathUtils.constrain( : (int) MathUtils.constrain(
MathUtils.map(.5f, .9f, 0f, 255f, expansion), MathUtils.map(.5f, .9f, 0f, 255f, expansion),
0f, 255f); 0f, 255f);
alpha *= (1.0f - mTransitionToFullShadeProgress); if (!mShowingUdfpsBouncer) {
alpha *= (1.0f - mTransitionToFullShadeProgress);
}
mView.setUnpausedAlpha(alpha); mView.setUnpausedAlpha(alpha);
} }

View File

@@ -384,7 +384,41 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
// WHEN status bar expansion is 0 but udfps bouncer is requested // WHEN status bar expansion is 0 but udfps bouncer is requested
mAltAuthInterceptor.showAlternateAuthBouncer(); mAltAuthInterceptor.showAlternateAuthBouncer();
// THEN alpha is 0 // THEN alpha is 255
verify(mView).setUnpausedAlpha(255);
}
@Test
public void testTransitionToFullShadeProgress() {
// GIVEN view is attached and status bar expansion is 1f
mController.onViewAttached();
captureExpansionListeners();
updateStatusBarExpansion(1f, true);
reset(mView);
// WHEN we're transitioning to the full shade
float transitionProgress = .6f;
mController.setTransitionToFullShadeProgress(transitionProgress);
// THEN alpha is between 0 and 255
verify(mView).setUnpausedAlpha((int) ((1f - transitionProgress) * 255));
}
@Test
public void testShowUdfpsBouncer_transitionToFullShadeProgress() {
// GIVEN view is attached and status bar expansion is 1f
mController.onViewAttached();
captureExpansionListeners();
captureKeyguardStateControllerCallback();
captureAltAuthInterceptor();
updateStatusBarExpansion(1f, true);
mAltAuthInterceptor.showAlternateAuthBouncer();
reset(mView);
// WHEN we're transitioning to the full shade
mController.setTransitionToFullShadeProgress(1.0f);
// THEN alpha is 255 (b/c udfps bouncer is requested)
verify(mView).setUnpausedAlpha(255); verify(mView).setUnpausedAlpha(255);
} }