Merge "Fade out LS UDFPS affordance on QS expansion" into tm-dev am: 05e028e179

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17775485

Change-Id: I2fd9d1b0bc04925f836583e4b7b68d310376460c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Beverly Tai
2022-04-18 18:43:59 +00:00
committed by Automerger Merge Worker
6 changed files with 64 additions and 54 deletions

View File

@@ -114,7 +114,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
private boolean mIsBouncerShowing; private boolean mIsBouncerShowing;
private boolean mRunningFPS; private boolean mRunningFPS;
private boolean mCanDismissLockScreen; private boolean mCanDismissLockScreen;
private boolean mQsExpanded;
private int mStatusBarState; private int mStatusBarState;
private boolean mIsKeyguardShowing; private boolean mIsKeyguardShowing;
private boolean mUserUnlockedWithBiometric; private boolean mUserUnlockedWithBiometric;
@@ -245,14 +244,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
return mView.getLocationTop(); 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() { private void updateVisibility() {
if (mCancelDelayedUpdateVisibilityRunnable != null) { if (mCancelDelayedUpdateVisibilityRunnable != null) {
mCancelDelayedUpdateVisibilityRunnable.run(); mCancelDelayedUpdateVisibilityRunnable.run();
@@ -331,7 +322,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
private boolean isLockScreen() { private boolean isLockScreen() {
return !mIsDozing return !mIsDozing
&& !mIsBouncerShowing && !mIsBouncerShowing
&& !mQsExpanded
&& mStatusBarState == StatusBarState.KEYGUARD; && mStatusBarState == StatusBarState.KEYGUARD;
} }
@@ -394,7 +384,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
pw.println(" mRunningFPS: " + mRunningFPS); pw.println(" mRunningFPS: " + mRunningFPS);
pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen); pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen);
pw.println(" mStatusBarState: " + StatusBarState.toString(mStatusBarState)); pw.println(" mStatusBarState: " + StatusBarState.toString(mStatusBarState));
pw.println(" mQsExpanded: " + mQsExpanded);
pw.println(" mInterpolatedDarkAmount: " + mInterpolatedDarkAmount); pw.println(" mInterpolatedDarkAmount: " + mInterpolatedDarkAmount);
if (mView != null) { if (mView != null) {

View File

@@ -43,6 +43,8 @@ import com.airbnb.lottie.LottieAnimationView;
import com.airbnb.lottie.LottieProperty; import com.airbnb.lottie.LottieProperty;
import com.airbnb.lottie.model.KeyPath; import com.airbnb.lottie.model.KeyPath;
import java.io.PrintWriter;
/** /**
* View corresponding with udfps_keyguard_view.xml * View corresponding with udfps_keyguard_view.xml
*/ */
@@ -124,13 +126,16 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
- mMaxBurnInOffsetY, darkAmountForAnimation); - mMaxBurnInOffsetY, darkAmountForAnimation);
mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), darkAmountForAnimation); mBurnInProgress = MathUtils.lerp(0f, getBurnInProgressOffset(), darkAmountForAnimation);
if (mAnimatingBetweenAodAndLockscreen) { if (mAnimatingBetweenAodAndLockscreen && !mPauseAuth) {
mBgProtection.setAlpha(1f - mInterpolatedDarkAmount); mBgProtection.setAlpha(1f - mInterpolatedDarkAmount);
mLockScreenFp.setTranslationX(mBurnInOffsetX); mLockScreenFp.setTranslationX(mBurnInOffsetX);
mLockScreenFp.setTranslationY(mBurnInOffsetY); mLockScreenFp.setTranslationY(mBurnInOffsetY);
mLockScreenFp.setProgress(1f - mInterpolatedDarkAmount); mLockScreenFp.setProgress(1f - mInterpolatedDarkAmount);
mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount); mLockScreenFp.setAlpha(1f - mInterpolatedDarkAmount);
} else if (mInterpolatedDarkAmount == 0f) {
mBgProtection.setAlpha(mAlpha / 255f);
mLockScreenFp.setAlpha(mAlpha / 255f);
} else { } else {
mBgProtection.setAlpha(0f); mBgProtection.setAlpha(0f);
mLockScreenFp.setAlpha(0f); mLockScreenFp.setAlpha(0f);
@@ -140,6 +145,11 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
mAodFp.setTranslationY(mBurnInOffsetY); mAodFp.setTranslationY(mBurnInOffsetY);
mAodFp.setProgress(mBurnInProgress); mAodFp.setProgress(mBurnInProgress);
mAodFp.setAlpha(mInterpolatedDarkAmount); mAodFp.setAlpha(mInterpolatedDarkAmount);
// done animating between AoD & LS
if (mInterpolatedDarkAmount == 1f || mInterpolatedDarkAmount == 0f) {
mAnimatingBetweenAodAndLockscreen = false;
}
} }
void requestUdfps(boolean request, int color) { void requestUdfps(boolean request, int color) {
@@ -179,15 +189,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
@Override @Override
protected int updateAlpha() { protected int updateAlpha() {
int alpha = super.updateAlpha(); int alpha = super.updateAlpha();
if (mFullyInflated) { updateBurnInOffsets();
if (mInterpolatedDarkAmount == 0f) {
mLockScreenFp.setAlpha(alpha / 255f);
mBgProtection.setAlpha(alpha / 255f);
} else {
updateBurnInOffsets();
}
}
return alpha; return alpha;
} }
@@ -202,9 +204,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
void onDozeAmountChanged(float linear, float eased, boolean animatingBetweenAodAndLockscreen) { void onDozeAmountChanged(float linear, float eased, boolean animatingBetweenAodAndLockscreen) {
mAnimatingBetweenAodAndLockscreen = animatingBetweenAodAndLockscreen; mAnimatingBetweenAodAndLockscreen = animatingBetweenAodAndLockscreen;
mInterpolatedDarkAmount = eased; mInterpolatedDarkAmount = eased;
updateAlpha(); updateAlpha();
updateBurnInOffsets();
} }
/** /**
@@ -235,19 +235,30 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
mBackgroundInAnimator.start(); 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 = private final AsyncLayoutInflater.OnInflateFinishedListener mLayoutInflaterFinishListener =
new AsyncLayoutInflater.OnInflateFinishedListener() { new AsyncLayoutInflater.OnInflateFinishedListener() {
@Override @Override
public void onInflateFinished(View view, int resid, ViewGroup parent) { public void onInflateFinished(View view, int resid, ViewGroup parent) {
mFullyInflated = true; mFullyInflated = true;
parent.addView(view); mAodFp = view.findViewById(R.id.udfps_aod_fp);
mAodFp = findViewById(R.id.udfps_aod_fp); mLockScreenFp = view.findViewById(R.id.udfps_lockscreen_fp);
mLockScreenFp = findViewById(R.id.udfps_lockscreen_fp); mBgProtection = view.findViewById(R.id.udfps_keyguard_fp_bg);
mBgProtection = findViewById(R.id.udfps_keyguard_fp_bg);
updateBurnInOffsets();
updateColor(); updateColor();
updateAlpha(); updateAlpha();
parent.addView(view);
// requires call to invalidate to update the color // requires call to invalidate to update the color
mLockScreenFp.addValueCallback( mLockScreenFp.addValueCallback(

View File

@@ -65,7 +65,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
private boolean mShowingUdfpsBouncer; private boolean mShowingUdfpsBouncer;
private boolean mUdfpsRequested; private boolean mUdfpsRequested;
private boolean mQsExpanded; private float mQsExpansion;
private boolean mFaceDetectRunning; private boolean mFaceDetectRunning;
private int mStatusBarState; private int mStatusBarState;
private float mTransitionToFullShadeProgress; private float mTransitionToFullShadeProgress;
@@ -149,7 +149,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
mLaunchTransitionFadingAway = mKeyguardStateController.isLaunchTransitionFadingAway(); mLaunchTransitionFadingAway = mKeyguardStateController.isLaunchTransitionFadingAway();
mKeyguardStateController.addCallback(mKeyguardStateControllerCallback); mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
mStatusBarState = getStatusBarStateController().getState(); mStatusBarState = getStatusBarStateController().getState();
mQsExpanded = mKeyguardViewManager.isQsExpanded(); mQsExpansion = mKeyguardViewManager.getQsExpansion();
updateGenericBouncerVisibility(); updateGenericBouncerVisibility();
mConfigurationController.addCallback(mConfigurationListener); mConfigurationController.addCallback(mConfigurationListener);
getPanelExpansionStateManager().addExpansionListener(mPanelExpansionListener); getPanelExpansionStateManager().addExpansionListener(mPanelExpansionListener);
@@ -184,15 +184,17 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
pw.println("mShowingUdfpsBouncer=" + mShowingUdfpsBouncer); pw.println("mShowingUdfpsBouncer=" + mShowingUdfpsBouncer);
pw.println("mFaceDetectRunning=" + mFaceDetectRunning); pw.println("mFaceDetectRunning=" + mFaceDetectRunning);
pw.println("mStatusBarState=" + StatusBarState.toString(mStatusBarState)); pw.println("mStatusBarState=" + StatusBarState.toString(mStatusBarState));
pw.println("mQsExpanded=" + mQsExpanded); pw.println("mTransitionToFullShadeProgress=" + mTransitionToFullShadeProgress);
pw.println("mQsExpansion=" + mQsExpansion);
pw.println("mIsGenericBouncerShowing=" + mIsGenericBouncerShowing); pw.println("mIsGenericBouncerShowing=" + mIsGenericBouncerShowing);
pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount); pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount);
pw.println("mPanelExpansionFraction=" + mPanelExpansionFraction); pw.println("mPanelExpansionFraction=" + mPanelExpansionFraction);
pw.println("unpausedAlpha=" + mView.getUnpausedAlpha()); pw.println("unpausedAlpha=" + mView.getUnpausedAlpha());
pw.println("mUdfpsRequested=" + mUdfpsRequested); pw.println("mUdfpsRequested=" + mUdfpsRequested);
pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested);
pw.println("mLaunchTransitionFadingAway=" + mLaunchTransitionFadingAway); pw.println("mLaunchTransitionFadingAway=" + mLaunchTransitionFadingAway);
pw.println("mLastDozeAmount=" + mLastDozeAmount); pw.println("mLastDozeAmount=" + mLastDozeAmount);
mView.dump(pw);
} }
/** /**
@@ -247,10 +249,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return false; return false;
} }
if (mView.getDialogSuggestedAlpha() == 0f) {
return true;
}
if (mLaunchTransitionFadingAway) { if (mLaunchTransitionFadingAway) {
return true; return true;
} }
@@ -263,11 +261,11 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return true; return true;
} }
if (mQsExpanded) { if (mInputBouncerHiddenAmount < .5f) {
return true; return true;
} }
if (mInputBouncerHiddenAmount < .5f) { if (mView.getUnpausedAlpha() < (255 * .1)) {
return true; return true;
} }
@@ -308,6 +306,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
/** /**
* Set the progress we're currently transitioning to the full shade. 0.0f means we're not * Set the progress we're currently transitioning to the full shade. 0.0f means we're not
* transitioning yet, while 1.0f means we've fully dragged down. * transitioning yet, while 1.0f means we've fully dragged down.
*
* For example, start swiping down to expand the notification shade from the empty space in
* the middle of the lock screen.
*/ */
public void setTransitionToFullShadeProgress(float progress) { public void setTransitionToFullShadeProgress(float progress) {
mTransitionToFullShadeProgress = progress; mTransitionToFullShadeProgress = progress;
@@ -331,6 +332,10 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
0f, 255f); 0f, 255f);
if (!mShowingUdfpsBouncer) { if (!mShowingUdfpsBouncer) {
// swipe from top of the lockscreen to expand full QS:
alpha *= (1.0f - Interpolators.EMPHASIZED_DECELERATE.getInterpolation(mQsExpansion));
// swipe from the middle (empty space) of lockscreen to expand the notification shade:
alpha *= (1.0f - mTransitionToFullShadeProgress); alpha *= (1.0f - mTransitionToFullShadeProgress);
// Fade out the icon if we are animating an activity launch over the lockscreen and the // Fade out the icon if we are animating an activity launch over the lockscreen and the
@@ -423,9 +428,14 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return false; return false;
} }
/**
* Set the amount qs is expanded. Forxample, swipe down from the top of the
* lock screen to start the full QS expansion.
*/
@Override @Override
public void setQsExpanded(boolean expanded) { public void setQsExpansion(float qsExpansion) {
mQsExpanded = expanded; mQsExpansion = qsExpansion;
updateAlpha();
updatePauseAuth(); updatePauseAuth();
} }

View File

@@ -2155,8 +2155,6 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationsQSContainerController.setQsExpanded(expanded); mNotificationsQSContainerController.setQsExpanded(expanded);
mPulseExpansionHandler.setQsExpanded(expanded); mPulseExpansionHandler.setQsExpanded(expanded);
mKeyguardBypassController.setQSExpanded(expanded); mKeyguardBypassController.setQSExpanded(expanded);
mStatusBarKeyguardViewManager.setQsExpanded(expanded);
mLockIconViewController.setQsExpanded(expanded);
mPrivacyDotViewController.setQsExpanded(expanded); mPrivacyDotViewController.setQsExpanded(expanded);
} }
} }
@@ -2269,6 +2267,7 @@ public class NotificationPanelViewController extends PanelViewController {
} }
mDepthController.setQsPanelExpansion(qsExpansionFraction); mDepthController.setQsPanelExpansion(qsExpansionFraction);
mStatusBarKeyguardViewManager.setQsExpansion(qsExpansionFraction);
// updateQsExpansion will get called whenever mTransitionToFullShadeProgress or // updateQsExpansion will get called whenever mTransitionToFullShadeProgress or
// mLockscreenShadeTransitionController.getDragProgress change. // mLockscreenShadeTransitionController.getDragProgress change.

View File

@@ -218,7 +218,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private boolean mLastPulsing; private boolean mLastPulsing;
private int mLastBiometricMode; private int mLastBiometricMode;
private boolean mLastScreenOffAnimationPlaying; private boolean mLastScreenOffAnimationPlaying;
private boolean mQsExpanded; private float mQsExpansion;
private OnDismissAction mAfterKeyguardGoneAction; private OnDismissAction mAfterKeyguardGoneAction;
private Runnable mKeyguardGoneCancelAction; private Runnable mKeyguardGoneCancelAction;
@@ -1298,16 +1298,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
/** /**
* Whether qs is currently expanded. * Whether qs is currently expanded.
*/ */
public boolean isQsExpanded() { public float getQsExpansion() {
return mQsExpanded; return mQsExpansion;
} }
/** /**
* Set whether qs is currently expanded * Update qs expansion.
*/ */
public void setQsExpanded(boolean expanded) { public void setQsExpansion(float qsExpansion) {
mQsExpanded = expanded; mQsExpansion = qsExpansion;
if (mAlternateAuthInterceptor != null) { if (mAlternateAuthInterceptor != null) {
mAlternateAuthInterceptor.setQsExpanded(expanded); mAlternateAuthInterceptor.setQsExpansion(qsExpansion);
} }
} }
@@ -1419,9 +1420,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
boolean isAnimating(); boolean isAnimating();
/** /**
* Set whether qs is currently expanded. * How much QS is fully expanded where 0f is not showing and 1f is fully expanded.
*/ */
void setQsExpanded(boolean expanded); void setQsExpansion(float qsExpansion);
/** /**
* Forward potential touches to authentication interceptor * Forward potential touches to authentication interceptor

View File

@@ -124,7 +124,7 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
when(mView.getContext()).thenReturn(mResourceContext); when(mView.getContext()).thenReturn(mResourceContext);
when(mResourceContext.getString(anyInt())).thenReturn("test string"); when(mResourceContext.getString(anyInt())).thenReturn("test string");
when(mKeyguardViewMediator.isAnimatingScreenOff()).thenReturn(false); when(mKeyguardViewMediator.isAnimatingScreenOff()).thenReturn(false);
when(mView.getDialogSuggestedAlpha()).thenReturn(1f); when(mView.getUnpausedAlpha()).thenReturn(255);
mController = new UdfpsKeyguardViewController( mController = new UdfpsKeyguardViewController(
mView, mView,
mStatusBarStateController, mStatusBarStateController,
@@ -212,11 +212,11 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
} }
@Test @Test
public void testShouldPauseAuthDialogSuggestedAlpha0() { public void testShouldPauseAuthUnpausedAlpha0() {
mController.onViewAttached(); mController.onViewAttached();
captureStatusBarStateListeners(); captureStatusBarStateListeners();
when(mView.getDialogSuggestedAlpha()).thenReturn(0f); when(mView.getUnpausedAlpha()).thenReturn(0);
sendStatusBarStateChanged(StatusBarState.KEYGUARD); sendStatusBarStateChanged(StatusBarState.KEYGUARD);
assertTrue(mController.shouldPauseAuth()); assertTrue(mController.shouldPauseAuth());