Merge "Remove MODE_UNLOCK_FADING since it's no longer needed" into tm-d1-dev

This commit is contained in:
Beverly Tai
2022-05-17 13:39:50 +00:00
committed by Android (Google) Code Review
9 changed files with 21 additions and 130 deletions

View File

@@ -736,12 +736,10 @@ public class NotificationMediaManager implements Dumpable {
} }
boolean cannotAnimateDoze = mStatusBarStateController.isDozing() boolean cannotAnimateDoze = mStatusBarStateController.isDozing()
&& !ScrimState.AOD.getAnimateChange(); && !ScrimState.AOD.getAnimateChange();
boolean needsBypassFading = mKeyguardStateController.isBypassFadingAnimation();
if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode() if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
|| cannotAnimateDoze) && !needsBypassFading) || cannotAnimateDoze))
|| hideBecauseOccluded) { || hideBecauseOccluded) {
// We are unlocking directly - no animation! // We are unlocking directly - no animation!
mBackdrop.setVisibility(View.GONE); mBackdrop.setVisibility(View.GONE);
mBackdropBack.setImageDrawable(null); mBackdropBack.setImageDrawable(null);

View File

@@ -91,7 +91,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
MODE_SHOW_BOUNCER, MODE_SHOW_BOUNCER,
MODE_ONLY_WAKE, MODE_ONLY_WAKE,
MODE_UNLOCK_COLLAPSING, MODE_UNLOCK_COLLAPSING,
MODE_UNLOCK_FADING,
MODE_DISMISS_BOUNCER, MODE_DISMISS_BOUNCER,
MODE_WAKE_AND_UNLOCK_FROM_DREAM MODE_WAKE_AND_UNLOCK_FROM_DREAM
}) })
@@ -137,16 +136,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
*/ */
public static final int MODE_WAKE_AND_UNLOCK_FROM_DREAM = 6; public static final int MODE_WAKE_AND_UNLOCK_FROM_DREAM = 6;
/**
* Faster mode of dismissing the lock screen when we cross fade to an app
* (used for keyguard bypass.)
*/
public static final int MODE_UNLOCK_FADING = 7;
/** /**
* When bouncer is visible and will be dismissed. * When bouncer is visible and will be dismissed.
*/ */
public static final int MODE_DISMISS_BOUNCER = 8; public static final int MODE_DISMISS_BOUNCER = 7;
/** /**
* How much faster we collapse the lockscreen when authenticating with biometric. * How much faster we collapse the lockscreen when authenticating with biometric.
@@ -451,8 +444,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
} }
switch (mMode) { switch (mMode) {
case MODE_DISMISS_BOUNCER: case MODE_DISMISS_BOUNCER:
case MODE_UNLOCK_FADING: Trace.beginSection("MODE_DISMISS_BOUNCER");
Trace.beginSection("MODE_DISMISS_BOUNCER or MODE_UNLOCK_FADING");
mKeyguardViewController.notifyKeyguardAuthenticated( mKeyguardViewController.notifyKeyguardAuthenticated(
false /* strongAuth */); false /* strongAuth */);
Trace.endSection(); Trace.endSection();
@@ -616,14 +608,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (mKeyguardViewController.isShowing()) { if (mKeyguardViewController.isShowing()) {
if ((mKeyguardViewController.bouncerIsOrWillBeShowing() if ((mKeyguardViewController.bouncerIsOrWillBeShowing()
|| mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) { || mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) {
if (bypass && mKeyguardBypassController.canPlaySubtleWindowAnimations()) { return MODE_DISMISS_BOUNCER;
return MODE_UNLOCK_FADING; } else if (unlockingAllowed && (bypass || mAuthController.isUdfpsFingerDown())) {
} else { return MODE_UNLOCK_COLLAPSING;
return MODE_DISMISS_BOUNCER;
}
} else if (unlockingAllowed) {
return bypass || mAuthController.isUdfpsFingerDown()
? MODE_UNLOCK_FADING : MODE_NONE;
} else { } else {
return bypass ? MODE_SHOW_BOUNCER : MODE_NONE; return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
} }
@@ -799,7 +786,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
* on or off. * on or off.
*/ */
public boolean isBiometricUnlock() { public boolean isBiometricUnlock() {
return isWakeAndUnlock() || mMode == MODE_UNLOCK_COLLAPSING || mMode == MODE_UNLOCK_FADING; return isWakeAndUnlock() || mMode == MODE_UNLOCK_COLLAPSING;
} }
/** /**

View File

@@ -396,8 +396,7 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
void keyguardGoingAway(); void keyguardGoingAway();
void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration, void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration);
boolean isBypassFading);
void finishKeyguardFadingAway(); void finishKeyguardFadingAway();

View File

@@ -107,7 +107,6 @@ import android.view.WindowManager;
import android.view.WindowManagerGlobal; import android.view.WindowManagerGlobal;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import android.widget.DateTimeView; import android.widget.DateTimeView;
import android.window.SplashScreen;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
@@ -3185,14 +3184,12 @@ public class CentralSurfacesImpl extends CoreStartable implements
/** /**
* Notifies the status bar the Keyguard is fading away with the specified timings. * Notifies the status bar the Keyguard is fading away with the specified timings.
* @param startTime the start time of the animations in uptime millis * @param startTime the start time of the animations in uptime millis
* @param delay the precalculated animation delay in milliseconds * @param delay the precalculated animation delay in milliseconds
* @param fadeoutDuration the duration of the exit animation, in milliseconds * @param fadeoutDuration the duration of the exit animation, in milliseconds
* @param isBypassFading is this a fading away animation while bypassing
*/ */
@Override @Override
public void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration, public void setKeyguardFadingAway(long startTime, long delay, long fadeoutDuration) {
boolean isBypassFading) {
mCommandQueue.appTransitionStarting(mDisplayId, startTime + fadeoutDuration mCommandQueue.appTransitionStarting(mDisplayId, startTime + fadeoutDuration
- LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true); LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true);
@@ -3200,7 +3197,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
mCommandQueue.appTransitionStarting(mDisplayId, mCommandQueue.appTransitionStarting(mDisplayId,
startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true); LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true);
mKeyguardStateController.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading); mKeyguardStateController.notifyKeyguardFadingAway(delay, fadeoutDuration);
} }
/** /**

View File

@@ -197,20 +197,6 @@ open class KeyguardBypassController : Dumpable, StackScrollAlgorithm.BypassContr
return false return false
} }
/**
* If shorter animations should be played when unlocking.
*/
fun canPlaySubtleWindowAnimations(): Boolean {
if (bypassEnabled) {
return when {
statusBarStateController.state != StatusBarState.KEYGUARD -> false
qSExpanded -> false
else -> true
}
}
return false
}
fun onStartedGoingToSleep() { fun onStartedGoingToSleep() {
pendingUnlock = null pendingUnlock = null
} }

View File

@@ -20,7 +20,6 @@ import static android.view.WindowInsets.Type.navigationBars;
import static com.android.systemui.plugins.ActivityStarter.OnDismissAction; import static com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_COLLAPSING; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_COLLAPSING;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_FADING;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
@@ -832,46 +831,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
executeAfterKeyguardGoneAction(); executeAfterKeyguardGoneAction();
boolean wakeUnlockPulsing = boolean wakeUnlockPulsing =
mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING; mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
boolean needsFading = needsBypassFading(); mCentralSurfaces.setKeyguardFadingAway(startTime, delay, 0);
if (needsFading) {
delay = 0;
fadeoutDuration = KeyguardBypassController.BYPASS_FADE_DURATION;
} else if (wakeUnlockPulsing) {
delay = 0;
fadeoutDuration = 240;
}
mCentralSurfaces.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading);
mBiometricUnlockController.startKeyguardFadingAway(); mBiometricUnlockController.startKeyguardFadingAway();
hideBouncer(true /* destroyView */); hideBouncer(true /* destroyView */);
if (wakeUnlockPulsing) { if (wakeUnlockPulsing) {
if (needsFading) { mCentralSurfaces.fadeKeyguardWhilePulsing();
ViewGroupFadeHelper.fadeOutAllChildrenExcept(
mNotificationPanelViewController.getView(),
mNotificationContainer,
fadeoutDuration,
() -> {
mCentralSurfaces.hideKeyguard();
onKeyguardFadedAway();
});
} else {
mCentralSurfaces.fadeKeyguardWhilePulsing();
}
wakeAndUnlockDejank(); wakeAndUnlockDejank();
} else { } else {
boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
if (!staying) { if (!staying) {
mNotificationShadeWindowController.setKeyguardFadingAway(true); mNotificationShadeWindowController.setKeyguardFadingAway(true);
if (needsFading) { mCentralSurfaces.hideKeyguard();
ViewGroupFadeHelper.fadeOutAllChildrenExcept(
mNotificationPanelViewController.getView(),
mNotificationContainer,
fadeoutDuration,
() -> {
mCentralSurfaces.hideKeyguard();
});
} else {
mCentralSurfaces.hideKeyguard();
}
// hide() will happen asynchronously and might arrive after the scrims // hide() will happen asynchronously and might arrive after the scrims
// were already hidden, this means that the transition callback won't // were already hidden, this means that the transition callback won't
// be triggered anymore and StatusBarWindowController will be forever in // be triggered anymore and StatusBarWindowController will be forever in
@@ -884,6 +854,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBiometricUnlockController.finishKeyguardFadingAway(); mBiometricUnlockController.finishKeyguardFadingAway();
} }
} }
updateStates(); updateStates();
mNotificationShadeWindowController.setKeyguardShowing(false); mNotificationShadeWindowController.setKeyguardShowing(false);
mViewMediatorCallback.keyguardGone(); mViewMediatorCallback.keyguardGone();
@@ -893,13 +864,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
Trace.endSection(); Trace.endSection();
} }
private boolean needsBypassFading() {
return (mBiometricUnlockController.getMode() == MODE_UNLOCK_FADING
|| mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING
|| mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK)
&& mBypassController.getBypassEnabled();
}
@Override @Override
public void onNavigationModeChanged(int mode) { public void onNavigationModeChanged(int mode) {
boolean gesturalNav = QuickStepContract.isGesturalMode(mode); boolean gesturalNav = QuickStepContract.isGesturalMode(mode);
@@ -1186,7 +1150,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override @Override
public boolean shouldSubtleWindowAnimationsForUnlock() { public boolean shouldSubtleWindowAnimationsForUnlock() {
return needsBypassFading(); return false;
} }
@Override @Override

View File

@@ -109,28 +109,15 @@ public interface KeyguardStateController extends CallbackController<Callback> {
* we're bypassing * we're bypassing
*/ */
default long getShortenedFadingAwayDuration() { default long getShortenedFadingAwayDuration() {
if (isBypassFadingAnimation()) { return getKeyguardFadingAwayDuration() / 2;
return getKeyguardFadingAwayDuration();
} else {
return getKeyguardFadingAwayDuration() / 2;
}
}
/**
* @return {@code true} if the current fading away animation is the fast bypass fading.
*/
default boolean isBypassFadingAnimation() {
return false;
} }
/** /**
* Notifies that the Keyguard is fading away with the specified timings. * Notifies that the Keyguard is fading away with the specified timings.
* @param delay the precalculated animation delay in milliseconds * @param delay the precalculated animation delay in milliseconds
* @param fadeoutDuration the duration of the exit animation, in milliseconds * @param fadeoutDuration the duration of the exit animation, in milliseconds
* @param isBypassFading is this a fading away animation while bypassing
*/ */
default void notifyKeyguardFadingAway(long delay, long fadeoutDuration, default void notifyKeyguardFadingAway(long delay, long fadeoutDuratio) {
boolean isBypassFading) {
} }
/** /**

View File

@@ -72,7 +72,6 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
private long mKeyguardFadingAwayDuration; private long mKeyguardFadingAwayDuration;
private boolean mKeyguardGoingAway; private boolean mKeyguardGoingAway;
private boolean mLaunchTransitionFadingAway; private boolean mLaunchTransitionFadingAway;
private boolean mBypassFadingAnimation;
private boolean mTrustManaged; private boolean mTrustManaged;
private boolean mTrusted; private boolean mTrusted;
private boolean mDebugUnlocked = false; private boolean mDebugUnlocked = false;
@@ -203,10 +202,9 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
} }
@Override @Override
public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) { public void notifyKeyguardFadingAway(long delay, long fadeoutDuration) {
mKeyguardFadingAwayDelay = delay; mKeyguardFadingAwayDelay = delay;
mKeyguardFadingAwayDuration = fadeoutDuration; mKeyguardFadingAwayDuration = fadeoutDuration;
mBypassFadingAnimation = isBypassFading;
setKeyguardFadingAway(true); setKeyguardFadingAway(true);
} }
@@ -283,11 +281,6 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
return mUnlockAnimationControllerLazy.get().isAnimatingBetweenKeyguardAndSurfaceBehind(); return mUnlockAnimationControllerLazy.get().isAnimatingBetweenKeyguardAndSurfaceBehind();
} }
@Override
public boolean isBypassFadingAnimation() {
return mBypassFadingAnimation;
}
@Override @Override
public long getKeyguardFadingAwayDelay() { public long getKeyguardFadingAwayDelay() {
return mKeyguardFadingAwayDelay; return mKeyguardFadingAwayDelay;

View File

@@ -127,7 +127,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean())) when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean()))
.thenReturn(true); .thenReturn(true);
when(mAuthController.isUdfpsFingerDown()).thenReturn(false); when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
mKeyguardViewMediator, mScrimController, mShadeController, mKeyguardViewMediator, mScrimController, mShadeController,
@@ -239,11 +238,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */); BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(),
anyBoolean(), anyFloat());
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING); .isEqualTo(BiometricUnlockController.MODE_UNLOCK_COLLAPSING);
} }
@Test @Test
@@ -258,11 +255,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */); BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(),
anyBoolean(), anyFloat());
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
assertThat(mBiometricUnlockController.getMode()) assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING); .isEqualTo(BiometricUnlockController.MODE_UNLOCK_COLLAPSING);
} }
@Test @Test
@@ -358,21 +353,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
.isEqualTo(BiometricUnlockController.MODE_DISMISS_BOUNCER); .isEqualTo(BiometricUnlockController.MODE_DISMISS_BOUNCER);
} }
@Test
public void onBiometricAuthenticated_whenBypassOnBouncer_respectsCanPlaySubtleAnim() {
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true);
// the value of isStrongBiometric doesn't matter here since we only care about the returned
// value of isUnlockingWithBiometricAllowed()
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING);
}
@Test @Test
public void onBiometricAuthenticated_whenFaceAndPulsing_dontDismissKeyguard() { public void onBiometricAuthenticated_whenFaceAndPulsing_dontDismissKeyguard() {
reset(mUpdateMonitor); reset(mUpdateMonitor);