diff options
author | Beverly <beverlyt@google.com> | 2021-08-27 09:19:11 -0400 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-09-01 02:14:03 +0000 |
commit | 987179a2f16839f7e850c7063ddb6b77cf9d77bf (patch) | |
tree | f8507d803b11cdda47c908c64f0ab79aa3fdbe0f | |
parent | 1a2e96c6f2c3a8a1ea3575a08a57450aae2f6132 (diff) | |
download | base-987179a2f16839f7e850c7063ddb6b77cf9d77bf.tar.gz |
Update unpaused udfps alpha when showing udfps bouncer
This will make sure the alpha is updated correctly before
showing the udfps affordance.
This CL also updates the dumpsys to be more accurate of the
actual alpha value being used.
Test: manual, atest UdfpsKeyguardViewControllerTest
Fixes: 197160246
Merged-In: I86a73dacfd2fc4f5b910e1e1e4f6535e91d00da3
Change-Id: I86a73dacfd2fc4f5b910e1e1e4f6535e91d00da3
(cherry picked from commit a73d30e2974c0ab481214bad43e7cc488615d7b7)
3 files changed, 32 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java index d46426a03621..9015396d26ab 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java @@ -155,6 +155,13 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { updateAlpha(); } + /** + * @return alpha between 0 and 255 + */ + int getUnpausedAlpha() { + return mAlpha; + } + @Override protected int updateAlpha() { int alpha = super.updateAlpha(); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 3ca7a9face95..22d7a3ff44f0 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -153,7 +153,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud pw.println("mIsBouncerVisible=" + mIsBouncerVisible); pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount); pw.println("mStatusBarExpansion=" + mStatusBarExpansion); - pw.println("mAlpha=" + mView.getAlpha()); + pw.println("unpausedAlpha=" + mView.getUnpausedAlpha()); pw.println("mUdfpsRequested=" + mUdfpsRequested); pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested); pw.println("mLaunchTransitionFadingAway=" + mLaunchTransitionFadingAway); @@ -168,10 +168,10 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud return false; } + boolean udfpsAffordanceWasNotShowing = shouldPauseAuth(); mShowingUdfpsBouncer = show; - updatePauseAuth(); if (mShowingUdfpsBouncer) { - if (mStatusBarState == StatusBarState.SHADE_LOCKED) { + if (udfpsAffordanceWasNotShowing) { mView.animateInUdfpsBouncer(null); } @@ -184,6 +184,8 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud } else { mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false); } + updateAlpha(); + updatePauseAuth(); return true; } @@ -308,6 +310,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud public void requestUdfps(boolean request, int color) { mUdfpsRequested = request; mView.requestUdfps(request, color); + updateAlpha(); updatePauseAuth(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java index 47e060ef8f97..5eb913856187 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java @@ -313,6 +313,25 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { verify(mView).setUnpausedAlpha(0); } + @Test + public void testShowUdfpsBouncer() { + // GIVEN view is attached and status bar expansion is 0 + mController.onViewAttached(); + captureExpansionListeners(); + captureKeyguardStateControllerCallback(); + captureAltAuthInterceptor(); + updateStatusBarExpansion(0, true); + reset(mView); + when(mView.getContext()).thenReturn(mResourceContext); + when(mResourceContext.getString(anyInt())).thenReturn("test string"); + + // WHEN status bar expansion is 0 but udfps bouncer is requested + mAltAuthInterceptor.showAlternateAuthBouncer(); + + // THEN alpha is 0 + verify(mView).setUnpausedAlpha(255); + } + private void sendStatusBarStateChanged(int statusBarState) { mStatusBarStateListener.onStateChanged(statusBarState); } |