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.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.ENABLE_LOCKSCREEN_WALLPAPER;
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
&& shadeController.isDozing()
&& !ScrimState.AOD.getAnimateChange();
if (mBiometricUnlockController != null && mBiometricUnlockController.getMode()
boolean needsBypassFading = mKeyguardMonitor.isBypassFadingAnimation();
if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
|| hideBecauseOccluded || cannotAnimateDoze) {
|| cannotAnimateDoze) && !needsBypassFading)
|| hideBecauseOccluded) {
// We are unlocking directly - no animation!
mBackdrop.setVisibility(View.GONE);
@@ -622,9 +628,7 @@ public class NotificationMediaManager implements Dumpable {
});
if (mKeyguardMonitor.isKeyguardFadingAway()) {
mBackdrop.animate()
// Make it disappear faster, as the focus should be on the activity
// behind.
.setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2)
.setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
.setInterpolator(Interpolators.LINEAR)
.start();

View File

@@ -1565,9 +1565,15 @@ public class NotificationPanelView extends PanelView implements
anim.setStartDelay(mKeyguardMonitor.isKeyguardFadingAway()
? mKeyguardMonitor.getKeyguardFadingAwayDelay()
: 0);
anim.setDuration(mKeyguardMonitor.isKeyguardFadingAway()
? mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2
: StackStateAnimator.ANIMATION_DURATION_STANDARD);
long duration;
if (mKeyguardMonitor.isKeyguardFadingAway()) {
duration = mKeyguardMonitor.getShortenedFadingAwayDuration();
} else {
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
}
anim.setDuration(duration);
anim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
anim.addListener(new AnimatorListenerAdapter() {
@Override
@@ -1610,7 +1616,7 @@ public class NotificationPanelView extends PanelView implements
mKeyguardBottomArea.animate()
.alpha(0f)
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
.setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2)
.setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.setInterpolator(Interpolators.ALPHA_OUT)
.withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable)
.start();
@@ -1639,7 +1645,7 @@ public class NotificationPanelView extends PanelView implements
if (keyguardFadingAway) {
mKeyguardStatusView.animate()
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
.setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2)
.setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.start();
}
} 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.
*
* @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 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
- LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true);
@@ -3220,7 +3221,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mCommandQueue.appTransitionStarting(mDisplayId,
startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
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();
boolean wakeUnlockPulsing =
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;
fadeoutDuration = 240;
}
mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading);
mBiometricUnlockController.startKeyguardFadingAway();
hideBouncer(true /* destroyView */);
if (wakeUnlockPulsing) {
if (needsBypassFading()) {
if (needsFading) {
ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView,
mNotificationContainer,
KeyguardBypassController.BYPASS_PANEL_FADE_DURATION,
fadeoutDuration,
() -> {
mStatusBar.hideKeyguard();
onKeyguardFadedAway();
@@ -584,10 +588,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
if (!staying) {
mStatusBarWindowController.setKeyguardFadingAway(true);
if (needsBypassFading()) {
if (needsFading) {
ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView,
mNotificationContainer,
KeyguardBypassController.BYPASS_PANEL_FADE_DURATION,
fadeoutDuration,
() -> {
mStatusBar.hideKeyguard();
});

View File

@@ -29,6 +29,19 @@ public interface KeyguardMonitor extends CallbackController<Callback> {
long getKeyguardFadingAwayDelay();
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() {
return false;
}
@@ -39,7 +52,21 @@ public interface KeyguardMonitor extends CallbackController<Callback> {
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() {

View File

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