Fading away the lockscreen wallpaper properly
Previously the duration and delay was wrong. This
now properly overrided the fading away duration to
apply everywhere.
Fixes: 138305791
Test: add lockscreen wallpaper observe normal fading
Change-Id: Ib93e6647968047a8690201e01bcb13a3377b110d
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index f001561..00a12a9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -17,6 +17,10 @@
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 @@
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 @@
});
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();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 37855ae..da01c57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1560,9 +1560,15 @@
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
@@ -1605,7 +1611,7 @@
mKeyguardBottomArea.animate()
.alpha(0f)
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
- .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2)
+ .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.setInterpolator(Interpolators.ALPHA_OUT)
.withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable)
.start();
@@ -1634,7 +1640,7 @@
if (keyguardFadingAway) {
mKeyguardStatusView.animate()
.setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
- .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration() / 2)
+ .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
.start();
}
} else if (mBarState == StatusBarState.SHADE_LOCKED
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index d93dc95..f729e96 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -3200,12 +3200,13 @@
/**
* 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);
@@ -3213,7 +3214,7 @@
mCommandQueue.appTransitionStarting(mDisplayId,
startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true);
- mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration);
+ mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 1321784..09e5a1d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -560,18 +560,22 @@
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 @@
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();
});
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
index f61b556..070136e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
@@ -29,6 +29,19 @@
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 @@
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() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
index 68d0070..8829be4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
@@ -54,6 +54,7 @@
private long mKeyguardFadingAwayDuration;
private boolean mKeyguardGoingAway;
private boolean mLaunchTransitionFadingAway;
+ private boolean mBypassFadingAnimation;
/**
*/
@@ -140,10 +141,11 @@
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) {
@@ -172,6 +174,11 @@
}
@Override
+ public boolean isBypassFadingAnimation() {
+ return mBypassFadingAnimation;
+ }
+
+ @Override
public long getKeyguardFadingAwayDelay() {
return mKeyguardFadingAwayDelay;
}