Merge "Fade out LS UDFPS affordance on QS expansion" into tm-dev

This commit is contained in:
Beverly Tai
2022-04-18 17:52:51 +00:00
committed by Android (Google) Code Review
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 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<LockIconView> 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<LockIconView> impleme
private boolean isLockScreen() {
return !mIsDozing
&& !mIsBouncerShowing
&& !mQsExpanded
&& mStatusBarState == StatusBarState.KEYGUARD;
}
@@ -394,7 +384,6 @@ public class LockIconViewController extends ViewController<LockIconView> 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) {

View File

@@ -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(

View File

@@ -65,7 +65,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
private boolean mShowingUdfpsBouncer;
private boolean mUdfpsRequested;
private boolean mQsExpanded;
private float mQsExpansion;
private boolean mFaceDetectRunning;
private int mStatusBarState;
private float mTransitionToFullShadeProgress;
@@ -149,7 +149,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
mLaunchTransitionFadingAway = mKeyguardStateController.isLaunchTransitionFadingAway();
mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
mStatusBarState = getStatusBarStateController().getState();
mQsExpanded = mKeyguardViewManager.isQsExpanded();
mQsExpansion = mKeyguardViewManager.getQsExpansion();
updateGenericBouncerVisibility();
mConfigurationController.addCallback(mConfigurationListener);
getPanelExpansionStateManager().addExpansionListener(mPanelExpansionListener);
@@ -184,15 +184,17 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
pw.println("mShowingUdfpsBouncer=" + mShowingUdfpsBouncer);
pw.println("mFaceDetectRunning=" + mFaceDetectRunning);
pw.println("mStatusBarState=" + StatusBarState.toString(mStatusBarState));
pw.println("mQsExpanded=" + mQsExpanded);
pw.println("mTransitionToFullShadeProgress=" + mTransitionToFullShadeProgress);
pw.println("mQsExpansion=" + mQsExpansion);
pw.println("mIsGenericBouncerShowing=" + mIsGenericBouncerShowing);
pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount);
pw.println("mPanelExpansionFraction=" + mPanelExpansionFraction);
pw.println("unpausedAlpha=" + mView.getUnpausedAlpha());
pw.println("mUdfpsRequested=" + mUdfpsRequested);
pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested);
pw.println("mLaunchTransitionFadingAway=" + mLaunchTransitionFadingAway);
pw.println("mLastDozeAmount=" + mLastDozeAmount);
mView.dump(pw);
}
/**
@@ -247,10 +249,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return false;
}
if (mView.getDialogSuggestedAlpha() == 0f) {
return true;
}
if (mLaunchTransitionFadingAway) {
return true;
}
@@ -263,11 +261,11 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return true;
}
if (mQsExpanded) {
if (mInputBouncerHiddenAmount < .5f) {
return true;
}
if (mInputBouncerHiddenAmount < .5f) {
if (mView.getUnpausedAlpha() < (255 * .1)) {
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
* 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) {
mTransitionToFullShadeProgress = progress;
@@ -331,6 +332,10 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
0f, 255f);
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);
// 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;
}
/**
* Set the amount qs is expanded. Forxample, swipe down from the top of the
* lock screen to start the full QS expansion.
*/
@Override
public void setQsExpanded(boolean expanded) {
mQsExpanded = expanded;
public void setQsExpansion(float qsExpansion) {
mQsExpansion = qsExpansion;
updateAlpha();
updatePauseAuth();
}

View File

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

View File

@@ -218,7 +218,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private boolean mLastPulsing;
private int mLastBiometricMode;
private boolean mLastScreenOffAnimationPlaying;
private boolean mQsExpanded;
private float mQsExpansion;
private OnDismissAction mAfterKeyguardGoneAction;
private Runnable mKeyguardGoneCancelAction;
@@ -1298,16 +1298,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
/**
* Whether qs is currently expanded.
*/
public boolean isQsExpanded() {
return mQsExpanded;
public float getQsExpansion() {
return mQsExpansion;
}
/**
* Set whether qs is currently expanded
* Update qs expansion.
*/
public void setQsExpanded(boolean expanded) {
mQsExpanded = expanded;
public void setQsExpansion(float qsExpansion) {
mQsExpansion = qsExpansion;
if (mAlternateAuthInterceptor != null) {
mAlternateAuthInterceptor.setQsExpanded(expanded);
mAlternateAuthInterceptor.setQsExpansion(qsExpansion);
}
}
@@ -1419,9 +1420,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
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

View File

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