From 3bf7ee6b8d8af5989adb8851bfd3bf0f4d9481de Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 15 Apr 2022 16:20:43 +0000 Subject: [PATCH] Fade out LS UDFPS affordance on QS expansion Use the QS expansion amount to fade out the UDFPS affordance instead of blinking out when qs starts being expanded. Also, don't immediately hide the lock icon affordance when qs is expanded. Instead, we rely on the alpha set by NotificationPanelViewController. It's the same alpha used to fade out the keyguard bottom area. Tidy up the UdfpsKeyguardView alpha updating. Fixes: 228897571 Test: atest LockIconViewControllerTest UdfpsKeyguardViewControllerTest Change-Id: I23e716261d2d8881fab3b4b420e2080ff5a4cb28 --- .../keyguard/LockIconViewController.java | 11 ----- .../biometrics/UdfpsKeyguardView.java | 45 ++++++++++++------- .../UdfpsKeyguardViewController.java | 34 +++++++++----- .../NotificationPanelViewController.java | 3 +- .../phone/StatusBarKeyguardViewManager.java | 19 ++++---- .../UdfpsKeyguardViewControllerTest.java | 6 +-- 6 files changed, 64 insertions(+), 54 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index db30371875200..239730d189346 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -114,7 +114,6 @@ public class LockIconViewController extends ViewController impleme private boolean mIsBouncerShowing; private boolean mRunningFPS; private boolean mCanDismissLockScreen; - private boolean mQsExpanded; private int mStatusBarState; private boolean mIsKeyguardShowing; private boolean mUserUnlockedWithBiometric; @@ -245,14 +244,6 @@ public class LockIconViewController extends ViewController impleme return mView.getLocationTop(); } - /** - * Set whether qs is expanded. When QS is expanded, don't show a DisabledUdfps affordance. - */ - public void setQsExpanded(boolean expanded) { - mQsExpanded = expanded; - updateVisibility(); - } - private void updateVisibility() { if (mCancelDelayedUpdateVisibilityRunnable != null) { mCancelDelayedUpdateVisibilityRunnable.run(); @@ -331,7 +322,6 @@ public class LockIconViewController extends ViewController impleme private boolean isLockScreen() { return !mIsDozing && !mIsBouncerShowing - && !mQsExpanded && mStatusBarState == StatusBarState.KEYGUARD; } @@ -394,7 +384,6 @@ public class LockIconViewController extends ViewController impleme pw.println(" mRunningFPS: " + mRunningFPS); pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen); pw.println(" mStatusBarState: " + StatusBarState.toString(mStatusBarState)); - pw.println(" mQsExpanded: " + mQsExpanded); pw.println(" mInterpolatedDarkAmount: " + mInterpolatedDarkAmount); if (mView != null) { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java index 7efdd1a8b949d..67d0db22b3cff 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java @@ -43,6 +43,8 @@ import com.airbnb.lottie.LottieAnimationView; import com.airbnb.lottie.LottieProperty; import com.airbnb.lottie.model.KeyPath; +import java.io.PrintWriter; + /** * View corresponding with udfps_keyguard_view.xml */ @@ -124,13 +126,16 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { - mMaxBurnInOffsetY, darkAmountForAnimation); mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), darkAmountForAnimation); - if (mAnimatingBetweenAodAndLockscreen) { + if (mAnimatingBetweenAodAndLockscreen && !mPauseAuth) { mBgProtection.setAlpha(1f - mInterpolatedDarkAmount); mLockScreenFp.setTranslationX(mBurnInOffsetX); mLockScreenFp.setTranslationY(mBurnInOffsetY); mLockScreenFp.setProgress(1f - mInterpolatedDarkAmount); mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount); + } else if (mInterpolatedDarkAmount == 0f) { + mBgProtection.setAlpha(mAlpha / 255f); + mLockScreenFp.setAlpha(mAlpha / 255f); } else { mBgProtection.setAlpha(0f); mLockScreenFp.setAlpha(0f); @@ -140,6 +145,11 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mAodFp.setTranslationY(mBurnInOffsetY); mAodFp.setProgress(mBurnInProgress); mAodFp.setAlpha(mInterpolatedDarkAmount); + + // done animating between AoD & LS + if (mInterpolatedDarkAmount == 1f || mInterpolatedDarkAmount == 0f) { + mAnimatingBetweenAodAndLockscreen = false; + } } void requestUdfps(boolean request, int color) { @@ -179,15 +189,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { @Override protected int updateAlpha() { int alpha = super.updateAlpha(); - if (mFullyInflated) { - if (mInterpolatedDarkAmount == 0f) { - mLockScreenFp.setAlpha(alpha / 255f); - mBgProtection.setAlpha(alpha / 255f); - } else { - updateBurnInOffsets(); - } - } - + updateBurnInOffsets(); return alpha; } @@ -202,9 +204,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { void onDozeAmountChanged(float linear, float eased, boolean animatingBetweenAodAndLockscreen) { mAnimatingBetweenAodAndLockscreen = animatingBetweenAodAndLockscreen; mInterpolatedDarkAmount = eased; - updateAlpha(); - updateBurnInOffsets(); } /** @@ -235,19 +235,30 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mBackgroundInAnimator.start(); } + /** + * Print debugging information for this class. + */ + public void dump(PrintWriter pw) { + pw.println("UdfpsKeyguardView (" + this + ")"); + pw.println(" mPauseAuth=" + mPauseAuth); + pw.println(" mUnpausedAlpha=" + getUnpausedAlpha()); + pw.println(" mUdfpsRequested=" + mUdfpsRequested); + pw.println(" mInterpolatedDarkAmount=" + mInterpolatedDarkAmount); + pw.println(" mAnimatingBetweenAodAndLockscreen=" + mAnimatingBetweenAodAndLockscreen); + } + private final AsyncLayoutInflater.OnInflateFinishedListener mLayoutInflaterFinishListener = new AsyncLayoutInflater.OnInflateFinishedListener() { @Override public void onInflateFinished(View view, int resid, ViewGroup parent) { mFullyInflated = true; - parent.addView(view); - mAodFp = findViewById(R.id.udfps_aod_fp); - mLockScreenFp = findViewById(R.id.udfps_lockscreen_fp); - mBgProtection = findViewById(R.id.udfps_keyguard_fp_bg); + mAodFp = view.findViewById(R.id.udfps_aod_fp); + mLockScreenFp = view.findViewById(R.id.udfps_lockscreen_fp); + mBgProtection = view.findViewById(R.id.udfps_keyguard_fp_bg); - updateBurnInOffsets(); updateColor(); updateAlpha(); + parent.addView(view); // requires call to invalidate to update the color mLockScreenFp.addValueCallback( diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 4ec479a3230b4..e8cfd422cc8ad 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -65,7 +65,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController