From e0c34bb85e1c3822c9533ce31140bf52cccfb5f1 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Mon, 22 Jun 2020 17:45:56 -0400 Subject: [PATCH] Force top UI if we're expanded, per Jorim's suggestion. This dramatically reduces jank during the expansion/collapse/switch animations particularly when opening a bubble whose activity is launching for the first time. Bug: 159125958 Test: manual Change-Id: Ie8c9959ea556c4f35ba95e49960282d2fb0270e5 --- .../com/android/systemui/bubbles/BubbleController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index aa417191b2042..4e83e867d3dbd 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -207,6 +207,12 @@ public class BubbleController implements ConfigurationController.ConfigurationLi /** Whether or not the BubbleStackView has been added to the WindowManager. */ private boolean mAddedToWindowManager = false; + /** + * Value from {@link NotificationShadeWindowController#getForceHasTopUi()} when we forced top UI + * due to expansion. We'll restore this value when the stack collapses. + */ + private boolean mHadTopUi = false; + // Listens to user switch so bubbles can be saved and restored. private final NotificationLockscreenUserManager mNotifUserManager; @@ -1290,6 +1296,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // Collapsing? Do this first before remaining steps. if (update.expandedChanged && !update.expanded) { mStackView.setExpanded(false); + mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi); } // Do removals, if any. @@ -1376,6 +1383,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (update.expandedChanged && update.expanded) { if (mStackView != null) { mStackView.setExpanded(true); + mHadTopUi = mNotificationShadeWindowController.getForceHasTopUi(); + mNotificationShadeWindowController.setForceHasTopUi(true); } }