Merge "Fading away the lockscreen wallpaper properly" into qt-r1-dev

This commit is contained in:
Selim Cinek
2019-07-25 22:59:14 +00:00
committed by Android (Google) Code Review
6 changed files with 71 additions and 22 deletions

View File

@@ -17,6 +17,10 @@ package com.android.systemui.statusbar;
import static com.android.systemui.Dependency.MAIN_HANDLER; import static com.android.systemui.Dependency.MAIN_HANDLER;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
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_PULSING;
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK; import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK;
import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER; import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER;
import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK; import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK;
@@ -595,9 +599,11 @@ public class NotificationMediaManager implements Dumpable {
boolean cannotAnimateDoze = shadeController != null boolean cannotAnimateDoze = shadeController != null
&& shadeController.isDozing() && shadeController.isDozing()
&& !ScrimState.AOD.getAnimateChange(); && !ScrimState.AOD.getAnimateChange();
if (mBiometricUnlockController != null && mBiometricUnlockController.getMode() boolean needsBypassFading = mKeyguardMonitor.isBypassFadingAnimation();
if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING == BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
|| hideBecauseOccluded || cannotAnimateDoze) { || cannotAnimateDoze) && !needsBypassFading)
|| hideBecauseOccluded) {
// We are unlocking directly - no animation! // We are unlocking directly - no animation!
mBackdrop.setVisibility(View.GONE); mBackdrop.setVisibility(View.GONE);
@@ -622,9 +628,7 @@ public class NotificationMediaManager implements Dumpable {
}); });
if (mKeyguardMonitor.isKeyguardFadingAway()) { if (mKeyguardMonitor.isKeyguardFadingAway()) {
mBackdrop.animate() mBackdrop.animate()
// Make it disappear faster, as the focus should be on the activity .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
// behind.
.setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2)
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay()) .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
.setInterpolator(Interpolators.LINEAR) .setInterpolator(Interpolators.LINEAR)
.start(); .start();

View File

@@ -1565,9 +1565,15 @@ public class NotificationPanelView extends PanelView implements
anim.setStartDelay(mKeyguardMonitor.isKeyguardFadingAway() anim.setStartDelay(mKeyguardMonitor.isKeyguardFadingAway()
? mKeyguardMonitor.getKeyguardFadingAwayDelay() ? mKeyguardMonitor.getKeyguardFadingAwayDelay()
: 0); : 0);
anim.setDuration(mKeyguardMonitor.isKeyguardFadingAway()
? mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2 long duration;
: StackStateAnimator.ANIMATION_DURATION_STANDARD); if (mKeyguardMonitor.isKeyguardFadingAway()) {
duration = mKeyguardMonitor.getShortenedFadingAwayDuration();
} else {
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
}
anim.setDuration(duration);
anim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN); anim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
anim.addListener(new AnimatorListenerAdapter() { anim.addListener(new AnimatorListenerAdapter() {
@Override @Override
@@ -1610,7 +1616,7 @@ public class NotificationPanelView extends PanelView implements
mKeyguardBottomArea.animate() mKeyguardBottomArea.animate()
.alpha(0f) .alpha(0f)
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay()) .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
.setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2) .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.setInterpolator(Interpolators.ALPHA_OUT) .setInterpolator(Interpolators.ALPHA_OUT)
.withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable) .withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable)
.start(); .start();
@@ -1639,7 +1645,7 @@ public class NotificationPanelView extends PanelView implements
if (keyguardFadingAway) { if (keyguardFadingAway) {
mKeyguardStatusView.animate() mKeyguardStatusView.animate()
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay()) .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
.setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2) .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.start(); .start();
} }
} else if (mBarState == StatusBarState.SHADE_LOCKED } else if (mBarState == StatusBarState.SHADE_LOCKED

View File

@@ -3207,12 +3207,13 @@ public class StatusBar extends SystemUI implements DemoMode,
/** /**
* 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
*/ */
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);
@@ -3220,7 +3221,7 @@ public class StatusBar extends SystemUI implements DemoMode,
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);
mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration); mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading);
} }
/** /**

View File

@@ -560,18 +560,22 @@ 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;
if (wakeUnlockPulsing) { boolean needsFading = needsBypassFading();
if (needsFading) {
delay = 0;
fadeoutDuration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION;
} else if (wakeUnlockPulsing) {
delay = 0; delay = 0;
fadeoutDuration = 240; fadeoutDuration = 240;
} }
mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration); mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading);
mBiometricUnlockController.startKeyguardFadingAway(); mBiometricUnlockController.startKeyguardFadingAway();
hideBouncer(true /* destroyView */); hideBouncer(true /* destroyView */);
if (wakeUnlockPulsing) { if (wakeUnlockPulsing) {
if (needsBypassFading()) { if (needsFading) {
ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView, ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView,
mNotificationContainer, mNotificationContainer,
KeyguardBypassController.BYPASS_PANEL_FADE_DURATION, fadeoutDuration,
() -> { () -> {
mStatusBar.hideKeyguard(); mStatusBar.hideKeyguard();
onKeyguardFadedAway(); onKeyguardFadedAway();
@@ -584,10 +588,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
if (!staying) { if (!staying) {
mStatusBarWindowController.setKeyguardFadingAway(true); mStatusBarWindowController.setKeyguardFadingAway(true);
if (needsBypassFading()) { if (needsFading) {
ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView, ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView,
mNotificationContainer, mNotificationContainer,
KeyguardBypassController.BYPASS_PANEL_FADE_DURATION, fadeoutDuration,
() -> { () -> {
mStatusBar.hideKeyguard(); mStatusBar.hideKeyguard();
}); });

View File

@@ -29,6 +29,19 @@ public interface KeyguardMonitor extends CallbackController<Callback> {
long getKeyguardFadingAwayDelay(); long getKeyguardFadingAwayDelay();
long calculateGoingToFullShadeDelay(); long calculateGoingToFullShadeDelay();
/**
* @return a shortened fading away duration similar to
* {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
* we're bypassing
*/
default long getShortenedFadingAwayDuration() {
if (isBypassFadingAnimation()) {
return getKeyguardFadingAwayDuration();
} else {
return getKeyguardFadingAwayDuration() / 2;
}
}
default boolean isDeviceInteractive() { default boolean isDeviceInteractive() {
return false; return false;
} }
@@ -39,7 +52,21 @@ public interface KeyguardMonitor extends CallbackController<Callback> {
default void notifyKeyguardGoingAway(boolean b) { default void notifyKeyguardGoingAway(boolean b) {
} }
default void notifyKeyguardFadingAway(long delay, long fadeoutDuration) { /**
* @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.
* @param delay the precalculated animation delay 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,
boolean isBypassFading) {
} }
default void notifyKeyguardDoneFading() { default void notifyKeyguardDoneFading() {

View File

@@ -54,6 +54,7 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
private long mKeyguardFadingAwayDuration; private long mKeyguardFadingAwayDuration;
private boolean mKeyguardGoingAway; private boolean mKeyguardGoingAway;
private boolean mLaunchTransitionFadingAway; private boolean mLaunchTransitionFadingAway;
private boolean mBypassFadingAnimation;
/** /**
*/ */
@@ -140,10 +141,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged); new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
} }
public void notifyKeyguardFadingAway(long delay, long fadeoutDuration) { public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) {
setKeyguardFadingAway(true); setKeyguardFadingAway(true);
mKeyguardFadingAwayDelay = delay; mKeyguardFadingAwayDelay = delay;
mKeyguardFadingAwayDuration = fadeoutDuration; mKeyguardFadingAwayDuration = fadeoutDuration;
mBypassFadingAnimation = isBypassFading;
} }
private void setKeyguardFadingAway(boolean keyguardFadingAway) { private void setKeyguardFadingAway(boolean keyguardFadingAway) {
@@ -171,6 +173,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
return mKeyguardGoingAway; return mKeyguardGoingAway;
} }
@Override
public boolean isBypassFadingAnimation() {
return mBypassFadingAnimation;
}
@Override @Override
public long getKeyguardFadingAwayDelay() { public long getKeyguardFadingAwayDelay() {
return mKeyguardFadingAwayDelay; return mKeyguardFadingAwayDelay;