Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +30 −16 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.asynclayoutinflater.view.AsyncLayoutInflater; Loading @@ -44,6 +45,8 @@ import com.airbnb.lottie.LottieProperty; import com.airbnb.lottie.model.KeyPath; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * View corresponding with udfps_keyguard_view.xml Loading @@ -52,7 +55,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { private UdfpsDrawable mFingerprintDrawable; // placeholder private LottieAnimationView mAodFp; private LottieAnimationView mLockScreenFp; private int mStatusBarState; // used when highlighting fp icon: private int mTextColorPrimary; Loading @@ -70,7 +72,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { private float mBurnInOffsetY; private float mBurnInProgress; private float mInterpolatedDarkAmount; private boolean mAnimatingBetweenAodAndLockscreen; // As opposed to Unlocked => AOD private int mAnimationType = ANIMATION_NONE; private boolean mFullyInflated; public UdfpsKeyguardView(Context context, @Nullable AttributeSet attrs) { Loading Loading @@ -117,8 +119,10 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return; } final float darkAmountForAnimation = mAnimatingBetweenAodAndLockscreen ? mInterpolatedDarkAmount : 1f /* animating from unlocked to AOD */; // if we're animating from screen off, we can immediately place the icon in the // AoD-burn in location, else we need to translate the icon from LS => AoD. final float darkAmountForAnimation = mAnimationType == ANIMATION_UNLOCKED_SCREEN_OFF ? 1f : mInterpolatedDarkAmount; mBurnInOffsetX = MathUtils.lerp(0f, getBurnInOffset(mMaxBurnInOffsetX * 2, true /* xAxis */) - mMaxBurnInOffsetX, darkAmountForAnimation); Loading @@ -127,12 +131,12 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { - mMaxBurnInOffsetY, darkAmountForAnimation); mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), darkAmountForAnimation); if (mAnimatingBetweenAodAndLockscreen && !mPauseAuth) { if (mAnimationType == ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN && !mPauseAuth) { mLockScreenFp.setTranslationX(mBurnInOffsetX); mLockScreenFp.setTranslationY(mBurnInOffsetY); mBgProtection.setAlpha(1f - mInterpolatedDarkAmount); mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount); } else if (mInterpolatedDarkAmount == 0f) { } else if (darkAmountForAnimation == 0f) { mLockScreenFp.setTranslationX(0); mLockScreenFp.setTranslationY(0); mBgProtection.setAlpha(mAlpha / 255f); Loading @@ -148,9 +152,15 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mAodFp.setProgress(mBurnInProgress); mAodFp.setAlpha(mInterpolatedDarkAmount); // done animating between AoD & LS if (mInterpolatedDarkAmount == 1f || mInterpolatedDarkAmount == 0f) { mAnimatingBetweenAodAndLockscreen = false; // done animating final boolean doneAnimatingBetweenAodAndLS = mAnimationType == ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN && (mInterpolatedDarkAmount == 0f || mInterpolatedDarkAmount == 1f); final boolean doneAnimatingUnlockedScreenOff = mAnimationType == ANIMATION_UNLOCKED_SCREEN_OFF && (mInterpolatedDarkAmount == 1f); if (doneAnimatingBetweenAodAndLS || doneAnimatingUnlockedScreenOff) { mAnimationType = ANIMATION_NONE; } } Loading @@ -158,10 +168,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mUdfpsRequested = request; } void setStatusBarState(int statusBarState) { mStatusBarState = statusBarState; } void updateColor() { if (!mFullyInflated) { return; Loading Loading @@ -219,8 +225,16 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return mAlpha; } void onDozeAmountChanged(float linear, float eased, boolean animatingBetweenAodAndLockscreen) { mAnimatingBetweenAodAndLockscreen = animatingBetweenAodAndLockscreen; static final int ANIMATION_NONE = 0; static final int ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN = 1; static final int ANIMATION_UNLOCKED_SCREEN_OFF = 2; @Retention(RetentionPolicy.SOURCE) @IntDef({ANIMATION_NONE, ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN, ANIMATION_UNLOCKED_SCREEN_OFF}) private @interface AnimationType {} void onDozeAmountChanged(float linear, float eased, @AnimationType int animationType) { mAnimationType = animationType; mInterpolatedDarkAmount = eased; updateAlpha(); } Loading Loading @@ -262,7 +276,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { pw.println(" mUnpausedAlpha=" + getUnpausedAlpha()); pw.println(" mUdfpsRequested=" + mUdfpsRequested); pw.println(" mInterpolatedDarkAmount=" + mInterpolatedDarkAmount); pw.println(" mAnimatingBetweenAodAndLockscreen=" + mAnimatingBetweenAodAndLockscreen); pw.println(" mAnimationType=" + mAnimationType); } private final AsyncLayoutInflater.OnInflateFinishedListener mLayoutInflaterFinishListener = Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +2 −3 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud mView.onDozeAmountChanged( animation.getAnimatedFraction(), (float) animation.getAnimatedValue(), /* animatingBetweenAodAndLockScreen */ false); UdfpsKeyguardView.ANIMATION_UNLOCKED_SCREEN_OFF); } }); } Loading Loading @@ -394,7 +394,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud mUnlockedScreenOffDozeAnimator.start(); } else { mView.onDozeAmountChanged(linear, eased, /* animatingBetweenAodAndLockScreen */ true); UdfpsKeyguardView.ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN); } mLastDozeAmount = linear; Loading @@ -404,7 +404,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud @Override public void onStateChanged(int statusBarState) { mStatusBarState = statusBarState; mView.setStatusBarState(statusBarState); updateAlpha(); updatePauseAuth(); } Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { mController.onViewAttached(); verify(mView, atLeast(1)).setPauseAuth(true); verify(mView).onDozeAmountChanged(dozeAmount, dozeAmount, true); verify(mView).onDozeAmountChanged(dozeAmount, dozeAmount, UdfpsKeyguardView.ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN); } @Test Loading @@ -195,7 +196,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { final float eased = .65f; mStatusBarStateListener.onDozeAmountChanged(linear, eased); verify(mView).onDozeAmountChanged(linear, eased, true); verify(mView).onDozeAmountChanged(linear, eased, UdfpsKeyguardView.ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN); } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +30 −16 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import androidx.asynclayoutinflater.view.AsyncLayoutInflater; Loading @@ -44,6 +45,8 @@ import com.airbnb.lottie.LottieProperty; import com.airbnb.lottie.model.KeyPath; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * View corresponding with udfps_keyguard_view.xml Loading @@ -52,7 +55,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { private UdfpsDrawable mFingerprintDrawable; // placeholder private LottieAnimationView mAodFp; private LottieAnimationView mLockScreenFp; private int mStatusBarState; // used when highlighting fp icon: private int mTextColorPrimary; Loading @@ -70,7 +72,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { private float mBurnInOffsetY; private float mBurnInProgress; private float mInterpolatedDarkAmount; private boolean mAnimatingBetweenAodAndLockscreen; // As opposed to Unlocked => AOD private int mAnimationType = ANIMATION_NONE; private boolean mFullyInflated; public UdfpsKeyguardView(Context context, @Nullable AttributeSet attrs) { Loading Loading @@ -117,8 +119,10 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return; } final float darkAmountForAnimation = mAnimatingBetweenAodAndLockscreen ? mInterpolatedDarkAmount : 1f /* animating from unlocked to AOD */; // if we're animating from screen off, we can immediately place the icon in the // AoD-burn in location, else we need to translate the icon from LS => AoD. final float darkAmountForAnimation = mAnimationType == ANIMATION_UNLOCKED_SCREEN_OFF ? 1f : mInterpolatedDarkAmount; mBurnInOffsetX = MathUtils.lerp(0f, getBurnInOffset(mMaxBurnInOffsetX * 2, true /* xAxis */) - mMaxBurnInOffsetX, darkAmountForAnimation); Loading @@ -127,12 +131,12 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { - mMaxBurnInOffsetY, darkAmountForAnimation); mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), darkAmountForAnimation); if (mAnimatingBetweenAodAndLockscreen && !mPauseAuth) { if (mAnimationType == ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN && !mPauseAuth) { mLockScreenFp.setTranslationX(mBurnInOffsetX); mLockScreenFp.setTranslationY(mBurnInOffsetY); mBgProtection.setAlpha(1f - mInterpolatedDarkAmount); mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount); } else if (mInterpolatedDarkAmount == 0f) { } else if (darkAmountForAnimation == 0f) { mLockScreenFp.setTranslationX(0); mLockScreenFp.setTranslationY(0); mBgProtection.setAlpha(mAlpha / 255f); Loading @@ -148,9 +152,15 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mAodFp.setProgress(mBurnInProgress); mAodFp.setAlpha(mInterpolatedDarkAmount); // done animating between AoD & LS if (mInterpolatedDarkAmount == 1f || mInterpolatedDarkAmount == 0f) { mAnimatingBetweenAodAndLockscreen = false; // done animating final boolean doneAnimatingBetweenAodAndLS = mAnimationType == ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN && (mInterpolatedDarkAmount == 0f || mInterpolatedDarkAmount == 1f); final boolean doneAnimatingUnlockedScreenOff = mAnimationType == ANIMATION_UNLOCKED_SCREEN_OFF && (mInterpolatedDarkAmount == 1f); if (doneAnimatingBetweenAodAndLS || doneAnimatingUnlockedScreenOff) { mAnimationType = ANIMATION_NONE; } } Loading @@ -158,10 +168,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mUdfpsRequested = request; } void setStatusBarState(int statusBarState) { mStatusBarState = statusBarState; } void updateColor() { if (!mFullyInflated) { return; Loading Loading @@ -219,8 +225,16 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return mAlpha; } void onDozeAmountChanged(float linear, float eased, boolean animatingBetweenAodAndLockscreen) { mAnimatingBetweenAodAndLockscreen = animatingBetweenAodAndLockscreen; static final int ANIMATION_NONE = 0; static final int ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN = 1; static final int ANIMATION_UNLOCKED_SCREEN_OFF = 2; @Retention(RetentionPolicy.SOURCE) @IntDef({ANIMATION_NONE, ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN, ANIMATION_UNLOCKED_SCREEN_OFF}) private @interface AnimationType {} void onDozeAmountChanged(float linear, float eased, @AnimationType int animationType) { mAnimationType = animationType; mInterpolatedDarkAmount = eased; updateAlpha(); } Loading Loading @@ -262,7 +276,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { pw.println(" mUnpausedAlpha=" + getUnpausedAlpha()); pw.println(" mUdfpsRequested=" + mUdfpsRequested); pw.println(" mInterpolatedDarkAmount=" + mInterpolatedDarkAmount); pw.println(" mAnimatingBetweenAodAndLockscreen=" + mAnimatingBetweenAodAndLockscreen); pw.println(" mAnimationType=" + mAnimationType); } private final AsyncLayoutInflater.OnInflateFinishedListener mLayoutInflaterFinishListener = Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +2 −3 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud mView.onDozeAmountChanged( animation.getAnimatedFraction(), (float) animation.getAnimatedValue(), /* animatingBetweenAodAndLockScreen */ false); UdfpsKeyguardView.ANIMATION_UNLOCKED_SCREEN_OFF); } }); } Loading Loading @@ -394,7 +394,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud mUnlockedScreenOffDozeAnimator.start(); } else { mView.onDozeAmountChanged(linear, eased, /* animatingBetweenAodAndLockScreen */ true); UdfpsKeyguardView.ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN); } mLastDozeAmount = linear; Loading @@ -404,7 +404,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud @Override public void onStateChanged(int statusBarState) { mStatusBarState = statusBarState; mView.setStatusBarState(statusBarState); updateAlpha(); updatePauseAuth(); } Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { mController.onViewAttached(); verify(mView, atLeast(1)).setPauseAuth(true); verify(mView).onDozeAmountChanged(dozeAmount, dozeAmount, true); verify(mView).onDozeAmountChanged(dozeAmount, dozeAmount, UdfpsKeyguardView.ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN); } @Test Loading @@ -195,7 +196,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { final float eased = .65f; mStatusBarStateListener.onDozeAmountChanged(linear, eased); verify(mView).onDozeAmountChanged(linear, eased, true); verify(mView).onDozeAmountChanged(linear, eased, UdfpsKeyguardView.ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN); } @Test Loading