diff options
| author | 2019-07-25 16:36:43 -0700 | |
|---|---|---|
| committer | 2019-07-25 16:36:43 -0700 | |
| commit | 0b39587d4093546597cc988dd4ffe0daf3af4c1c (patch) | |
| tree | 93d740c07be4cfcbb61133f753733887488b9294 | |
| parent | 3a43b8b8ae0147ef11235dc0da0c79286ed05fcd (diff) | |
| parent | 5d75551cc48c5a62da34e2091365bebc03fc5510 (diff) | |
Merge "Fading away the lockscreen wallpaper properly" into qt-r1-dev am: ff8eaca70c am: b72bebad88
am: 5d75551cc4
Change-Id: I41785fdc6363420b4ae15a9ef593eef11f295f52
6 files changed, 71 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index f001561754aa..00a12a9e4409 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 @@ 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(); 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 670deef19cf5..792b83a2827c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -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 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 881fb9d85c9b..096ca99cf6e7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3206,12 +3206,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); @@ -3219,7 +3220,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); } /** 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 197c09d8b56e..3508c90bc8a2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -561,18 +561,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(); @@ -585,10 +589,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(); }); 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 f61b556e22ab..070136ec94c1 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 @@ 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() { 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 68d00708b0d3..8829be4ee0f8 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 @@ 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) { @@ -172,6 +174,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback } @Override + public boolean isBypassFadingAnimation() { + return mBypassFadingAnimation; + } + + @Override public long getKeyguardFadingAwayDelay() { return mKeyguardFadingAwayDelay; } |