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 24a655c2856d5..5ac21ff42f4fa 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.Log; @@ -31,6 +32,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; @@ -59,6 +61,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController