From 99d2e63d4efc80a3566ac43dee57373141d814ce Mon Sep 17 00:00:00 2001 From: Beverly Date: Tue, 22 Feb 2022 21:45:33 +0000 Subject: [PATCH] Fade in the UDFPS icon from HOME => AOD Animate the fade in on the first signal from onDozeAmountChanged when the unlockedScreenOffAnimation is running. Remove the callbacks from the UnlockedScreenOffAnimationController progress which starts the animation much sooner than when the AOD UI starts to come in. It was also causing a pulsing bug where the UDFPS bouncer would be reset and be out of sync with the scrims. Test: atest SystemUITest Test: manually transition between the home screen and the AOD screen with udfps enrolled Test: manually transition between the lock screen and AOD with udfps enrolled Test: Tap on a pulsing notification in AOD when udfps is enrolled Fixes: 220219675 Change-Id: Idfe6144d1d46443db52583b165a836c69f17b259 --- .../biometrics/UdfpsKeyguardView.java | 46 +++++++++++-------- .../UdfpsKeyguardViewController.java | 44 +++++++++++++++--- .../UnlockedScreenOffAnimationController.kt | 23 ---------- .../UdfpsKeyguardViewControllerTest.java | 4 +- 4 files changed, 65 insertions(+), 52 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java index 7204a15233b00..7efdd1a8b949d 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java @@ -38,7 +38,6 @@ import androidx.asynclayoutinflater.view.AsyncLayoutInflater; import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; -import com.android.systemui.statusbar.StatusBarState; import com.airbnb.lottie.LottieAnimationView; import com.airbnb.lottie.LottieProperty; @@ -68,6 +67,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { private float mBurnInOffsetY; private float mBurnInProgress; private float mInterpolatedDarkAmount; + private boolean mAnimatingBetweenAodAndLockscreen; // As opposed to Unlocked => AOD private boolean mFullyInflated; public UdfpsKeyguardView(Context context, @Nullable AttributeSet attrs) { @@ -114,23 +114,32 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return; } + final float darkAmountForAnimation = mAnimatingBetweenAodAndLockscreen + ? mInterpolatedDarkAmount : 1f /* animating from unlocked to AOD */; mBurnInOffsetX = MathUtils.lerp(0f, getBurnInOffset(mMaxBurnInOffsetX * 2, true /* xAxis */) - - mMaxBurnInOffsetX, mInterpolatedDarkAmount); + - mMaxBurnInOffsetX, darkAmountForAnimation); mBurnInOffsetY = MathUtils.lerp(0f, getBurnInOffset(mMaxBurnInOffsetY * 2, false /* xAxis */) - - mMaxBurnInOffsetY, mInterpolatedDarkAmount); - mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), mInterpolatedDarkAmount); + - mMaxBurnInOffsetY, darkAmountForAnimation); + mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), darkAmountForAnimation); + + if (mAnimatingBetweenAodAndLockscreen) { + mBgProtection.setAlpha(1f - mInterpolatedDarkAmount); + + mLockScreenFp.setTranslationX(mBurnInOffsetX); + mLockScreenFp.setTranslationY(mBurnInOffsetY); + mLockScreenFp.setProgress(1f - mInterpolatedDarkAmount); + mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount); + } else { + mBgProtection.setAlpha(0f); + mLockScreenFp.setAlpha(0f); + } mAodFp.setTranslationX(mBurnInOffsetX); mAodFp.setTranslationY(mBurnInOffsetY); mAodFp.setProgress(mBurnInProgress); - mAodFp.setAlpha(255 * mInterpolatedDarkAmount); - - mLockScreenFp.setTranslationX(mBurnInOffsetX); - mLockScreenFp.setTranslationY(mBurnInOffsetY); - mLockScreenFp.setProgress(1f - mInterpolatedDarkAmount); - mLockScreenFp.setAlpha((1f - mInterpolatedDarkAmount) * 255); + mAodFp.setAlpha(mInterpolatedDarkAmount); } void requestUdfps(boolean request, int color) { @@ -171,15 +180,14 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { protected int updateAlpha() { int alpha = super.updateAlpha(); if (mFullyInflated) { - mLockScreenFp.setAlpha(alpha / 255f); - if (mInterpolatedDarkAmount != 0f) { - mBgProtection.setAlpha(1f - mInterpolatedDarkAmount); - } else { + if (mInterpolatedDarkAmount == 0f) { + mLockScreenFp.setAlpha(alpha / 255f); mBgProtection.setAlpha(alpha / 255f); + } else { + updateBurnInOffsets(); } } - return alpha; } @@ -191,8 +199,10 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return mAlpha; } - void onDozeAmountChanged(float linear, float eased) { + void onDozeAmountChanged(float linear, float eased, boolean animatingBetweenAodAndLockscreen) { + mAnimatingBetweenAodAndLockscreen = animatingBetweenAodAndLockscreen; mInterpolatedDarkAmount = eased; + updateAlpha(); updateBurnInOffsets(); } @@ -225,10 +235,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mBackgroundInAnimator.start(); } - private boolean isShadeLocked() { - return mStatusBarState == StatusBarState.SHADE_LOCKED; - } - private final AsyncLayoutInflater.OnInflateFinishedListener mLayoutInflaterFinishListener = new AsyncLayoutInflater.OnInflateFinishedListener() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 3ece3ccf38faa..791f6962ab33b 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -18,6 +18,7 @@ package com.android.systemui.biometrics; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; +import android.animation.ValueAnimator; import android.annotation.NonNull; import android.content.res.Configuration; import android.util.MathUtils; @@ -30,6 +31,7 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.LockscreenShadeTransitionController; import com.android.systemui.statusbar.StatusBarState; +import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.KeyguardBouncer; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.SystemUIDialogManager; @@ -57,6 +59,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController