From 837d4900a954d8e8defc4274c1880e6c50c473c7 Mon Sep 17 00:00:00 2001 From: Santhosh Thangaraj Date: Tue, 2 Jun 2020 15:32:44 -0700 Subject: Fix status bar animates when open bubble updates Bug: 155499241 Test: Manual test on device and unit test Change-Id: If1c4cd9b40bb7a1f6ea041b9abbc3110c8c6a2b2 --- .../SystemUI/src/com/android/systemui/SystemUIFactory.java | 4 +++- .../src/com/android/systemui/bubbles/BubbleController.java | 12 ++++++++++++ .../statusbar/phone/NotificationIconAreaController.java | 9 ++++++++- .../statusbar/phone/NotificationIconAreaControllerTest.java | 5 ++++- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index be82a2d5325b..5674fdd3bb36 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -28,6 +28,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; +import com.android.systemui.bubbles.BubbleController; import com.android.systemui.dagger.DaggerSystemUIRootComponent; import com.android.systemui.dagger.DependencyProvider; import com.android.systemui.dagger.SystemUIRootComponent; @@ -164,7 +165,8 @@ public class SystemUIFactory { wakeUpCoordinator, keyguardBypassController, Dependency.get(NotificationMediaManager.class), Dependency.get(NotificationListener.class), - Dependency.get(DozeParameters.class)); + Dependency.get(DozeParameters.class), + Dependency.get(BubbleController.class)); } @Module diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index f05d547edd0c..936e2344d807 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -853,6 +853,18 @@ public class BubbleController implements ConfigurationController.ConfigurationLi return (isSummary && isSuppressedSummary) || isSuppressedBubble; } + /** + * True if: + * (1) The current notification entry same as selected bubble notification entry and the + * stack is currently expanded. + * + * False otherwise. + */ + public boolean isBubbleExpanded(NotificationEntry entry) { + return isStackExpanded() && mBubbleData != null && mBubbleData.getSelectedBubble() != null + && mBubbleData.getSelectedBubble().getKey().equals(entry.getKey()) ? true : false; + } + void promoteBubbleFromOverflow(Bubble bubble) { bubble.setInflateSynchronously(mInflateSynchronously); setIsBubble(bubble, /* isBubble */ true); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index f58cce58af74..1b64a2f0d757 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -19,6 +19,7 @@ import com.android.internal.util.ContrastColorUtil; import com.android.settingslib.Utils; import com.android.systemui.Interpolators; import com.android.systemui.R; +import com.android.systemui.bubbles.BubbleController; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -55,6 +56,7 @@ public class NotificationIconAreaController implements DarkReceiver, private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final KeyguardBypassController mBypassController; private final DozeParameters mDozeParameters; + private final BubbleController mBubbleController; private int mIconSize; private int mIconHPadding; @@ -101,7 +103,8 @@ public class NotificationIconAreaController implements DarkReceiver, KeyguardBypassController keyguardBypassController, NotificationMediaManager notificationMediaManager, NotificationListener notificationListener, - DozeParameters dozeParameters) { + DozeParameters dozeParameters, + BubbleController bubbleController) { mStatusBar = statusBar; mContrastColorUtil = ContrastColorUtil.getInstance(context); mContext = context; @@ -112,6 +115,7 @@ public class NotificationIconAreaController implements DarkReceiver, mWakeUpCoordinator = wakeUpCoordinator; wakeUpCoordinator.addListener(this); mBypassController = keyguardBypassController; + mBubbleController = bubbleController; notificationListener.addNotificationSettingsListener(mSettingsListener); initializeNotificationAreaViews(context); @@ -291,6 +295,9 @@ public class NotificationIconAreaController implements DarkReceiver, || !entry.isPulseSuppressed())) { return false; } + if (mBubbleController.isBubbleExpanded(entry)) { + return false; + } return true; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java index be43e19cfc70..ef6f8dda7107 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java @@ -27,6 +27,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.bubbles.BubbleController; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationMediaManager; @@ -60,6 +61,8 @@ public class NotificationIconAreaControllerTest extends SysuiTestCase { @Mock NotificationShadeWindowView mNotificationShadeWindowView; private NotificationIconAreaController mController; + @Mock + private BubbleController mBubbleController; @Before public void setup() { @@ -71,7 +74,7 @@ public class NotificationIconAreaControllerTest extends SysuiTestCase { mController = new NotificationIconAreaController(mContext, mStatusBar, mStatusBarStateController, mWakeUpCoordinator, mKeyguardBypassController, - mNotificationMediaManager, mListener, mDozeParameters); + mNotificationMediaManager, mListener, mDozeParameters, mBubbleController); } @Test -- cgit v1.2.3-59-g8ed1b