diff options
| author | 2020-05-27 16:35:40 -0700 | |
|---|---|---|
| committer | 2020-05-28 12:29:52 -0700 | |
| commit | 9ff1bda37fa8de9efb3d97aebc760b3d54758b4a (patch) | |
| tree | 3925f05116481fa19bc25e6cb7e0f286dc781ad8 | |
| parent | 5134fd50fa74f822a61ce7eb07131e8202a9a590 (diff) | |
Fixed an issue where the player would flicker on when expanding
Our expansion hack doesn't work if at the end of the expansion,
the shade is still appearing. We only will do it now, if the
target location isn't an appearing position.
Fixes: 153321587
Test: add media notification but no others, expand, observe smooth transition
Change-Id: Ib278882500087d133826064007fa8ab3071445a0
2 files changed, 29 insertions, 5 deletions
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 999e636b4bae..a85000730106 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -2325,6 +2325,18 @@ public class NotificationPanelViewController extends PanelViewController { } @Override + protected boolean shouldExpandToTopOfClearAll(float targetHeight) { + boolean perform = super.shouldExpandToTopOfClearAll(targetHeight); + if (!perform) { + return false; + } + // Let's make sure we're not appearing but the animation will end below the appear. + // Otherwise quick settings would jump at the end of the animation. + float fraction = mNotificationStackScroller.calculateAppearFraction(targetHeight); + return fraction >= 1.0f; + } + + @Override protected boolean shouldUseDismissingAnimation() { return mBarState != StatusBarState.SHADE && (mKeyguardStateController.canDismissLockScreen() || !isTracking()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index 81dc9e1cf0e2..57d36fcafa15 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -532,11 +532,8 @@ public abstract class PanelViewController { // Hack to make the expand transition look nice when clear all button is visible - we make // the animation only to the last notification, and then jump to the maximum panel height so // clear all just fades in and the decelerating motion is towards the last notification. - final boolean - clearAllExpandHack = - expand && fullyExpandedClearAllVisible() - && mExpandedHeight < getMaxPanelHeight() - getClearAllHeight() - && !isClearAllVisible(); + final boolean clearAllExpandHack = expand && + shouldExpandToTopOfClearAll(getMaxPanelHeight() - getClearAllHeight()); if (clearAllExpandHack) { target = getMaxPanelHeight() - getClearAllHeight(); } @@ -601,6 +598,21 @@ public abstract class PanelViewController { animator.start(); } + /** + * When expanding, should we expand to the top of clear all and expand immediately? + * This will make sure that the animation will stop smoothly at the end of the last notification + * before the clear all affordance. + * + * @param targetHeight the height that we would animate to, right above clear all + * + * @return true if we can expand to the top of clear all + */ + protected boolean shouldExpandToTopOfClearAll(float targetHeight) { + return fullyExpandedClearAllVisible() + && mExpandedHeight < targetHeight + && !isClearAllVisible(); + } + protected abstract boolean shouldUseDismissingAnimation(); public String getName() { |