diff options
| author | 2020-06-22 11:26:09 -0700 | |
|---|---|---|
| committer | 2020-06-22 18:17:58 -0700 | |
| commit | f630a829554b6288e36a6e99eb85c0d89c3e49df (patch) | |
| tree | 33e9314fa771573377e40a922d65e7de7b1992a6 | |
| parent | 663e1c762ea8f71c9cb03e2f270ba5a7f03a7636 (diff) | |
Fixed some cases where we were animating Qs even though we shouldn't
When collapsing QS, the player should remain in the qs panel,
since notifications are invisible, which would look odd.
Similarly, when unlocking using fingerprint, we should
keep the media experience where it is.
Fixes: 157553726
Fixes: 156105562
Test: expand qs on lock, directly collapse
Change-Id: I1abd1561e878ad57b8cdc435bfacd40897616ff1
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt | 39 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java | 9 |
2 files changed, 48 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt index 3266074eba7d..c41e6104833e 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt @@ -140,6 +140,18 @@ class MediaHierarchyManager @Inject constructor( } /** + * Is the shade currently collapsing from the expanded qs? If we're on the lockscreen and in qs, + * we wouldn't want to transition in that case. + */ + var collapsingShadeFromQS: Boolean = false + set(value) { + if (field != value) { + field = value + updateDesiredLocation(forceNoAnimation = true) + } + } + + /** * Are location changes currently blocked? */ private val blockLocationChanges: Boolean @@ -161,6 +173,19 @@ class MediaHierarchyManager @Inject constructor( } /** + * Are we currently fullyAwake + */ + private var fullyAwake: Boolean = false + set(value) { + if (field != value) { + field = value + if (value) { + updateDesiredLocation(forceNoAnimation = true) + } + } + } + + /** * Is the doze animation currently Running */ private var dozeAnimationRunning: Boolean = false @@ -206,10 +231,12 @@ class MediaHierarchyManager @Inject constructor( override fun onStartedGoingToSleep() { goingToSleep = true + fullyAwake = false } override fun onFinishedWakingUp() { goingToSleep = false + fullyAwake = true } override fun onStartedWakingUp() { @@ -531,6 +558,18 @@ class MediaHierarchyManager @Inject constructor( !statusBarStateController.isDozing) { return LOCATION_QS } + if (location == LOCATION_LOCKSCREEN && desiredLocation == LOCATION_QS && + collapsingShadeFromQS) { + // When collapsing on the lockscreen, we want to remain in QS + return LOCATION_QS + } + if (location != LOCATION_LOCKSCREEN && desiredLocation == LOCATION_LOCKSCREEN + && !fullyAwake) { + // When unlocking from dozing / while waking up, the media shouldn't be transitioning + // in an animated way. Let's keep it in the lockscreen until we're fully awake and + // reattach it without an animation + return LOCATION_LOCKSCREEN + } return location } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index e720d820fd76..9e000f4190e9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -443,6 +443,7 @@ public class NotificationPanelViewController extends PanelViewController { */ private boolean mDelayShowingKeyguardStatusBar; + private boolean mAnimatingQS; private int mOldLayoutDirection; private View.AccessibilityDelegate mAccessibilityDelegate = new View.AccessibilityDelegate() { @@ -1860,6 +1861,7 @@ public class NotificationPanelViewController extends PanelViewController { @Override public void onAnimationEnd(Animator animation) { + mAnimatingQS = false; notifyExpandingFinished(); mNotificationStackScroller.resetCheckSnoozeLeavebehind(); mQsExpansionAnimator = null; @@ -1868,6 +1870,9 @@ public class NotificationPanelViewController extends PanelViewController { } } }); + // Let's note that we're animating QS. Moving the animator here will cancel it immediately, + // so we need a separate flag. + mAnimatingQS = true; animator.start(); mQsExpansionAnimator = animator; mQsAnimatorExpand = expanding; @@ -2220,6 +2225,9 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScroller.onExpansionStarted(); mIsExpanding = true; mQsExpandedWhenExpandingStarted = mQsFullyExpanded; + mMediaHierarchyManager.setCollapsingShadeFromQS(mQsExpandedWhenExpandingStarted && + /* We also start expanding when flinging closed Qs. Let's exclude that */ + !mAnimatingQS); if (mQsExpanded) { onQsExpansionStarted(); } @@ -2236,6 +2244,7 @@ public class NotificationPanelViewController extends PanelViewController { mHeadsUpManager.onExpandingFinished(); mConversationNotificationManager.onNotificationPanelExpandStateChanged(isFullyCollapsed()); mIsExpanding = false; + mMediaHierarchyManager.setCollapsingShadeFromQS(false); if (isFullyCollapsed()) { DejankUtils.postAfterTraversal(new Runnable() { @Override |