OSDN Git Service

BubbleData [1/n]: remove unused parameter
authorMark Renouf <mrenouf@google.com>
Fri, 5 Apr 2019 17:46:24 +0000 (13:46 -0400)
committerMark Renouf <mrenouf@google.com>
Fri, 5 Apr 2019 20:40:27 +0000 (16:40 -0400)
Remove an unused parameter from updateBubble (always true).
Eventually BubbleData will determine and apply and changes in
position, affecting other bubbles potentially.

Bug: 123542488
Test: atest BubbleControllerTest
Change-Id: Id90d9c905f63f90273205de91f0cff3e221c1ba4

packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleControllerTest.java

index 56b231b..33fe04c 100644 (file)
@@ -325,12 +325,11 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
      * Adds or updates a bubble associated with the provided notification entry.
      *
      * @param notif          the notification associated with this bubble.
-     * @param updatePosition whether this update should promote the bubble to the top of the stack.
      */
-    public void updateBubble(NotificationEntry notif, boolean updatePosition) {
+    void updateBubble(NotificationEntry notif) {
         if (mStackView != null && mBubbleData.getBubble(notif.key) != null) {
             // It's an update
-            mStackView.updateBubble(notif, updatePosition);
+            mStackView.updateBubble(notif);
         } else {
             if (mStackView == null) {
                 mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
@@ -403,7 +402,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
                 return;
             }
             if (entry.isBubble() && mNotificationInterruptionStateProvider.shouldBubbleUp(entry)) {
-                updateBubble(entry, true /* updatePosition */);
+                updateBubble(entry);
             }
         }
 
@@ -416,7 +415,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
                     && alertAgain(entry, entry.notification.getNotification())) {
                 entry.setShowInShadeWhenBubble(true);
                 entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed
-                updateBubble(entry, true /* updatePosition */);
+                updateBubble(entry);
                 mStackView.updateDotVisibility(entry.key);
             }
         }
index 00b1c9e..3d8dc07 100644 (file)
@@ -595,15 +595,13 @@ public class BubbleStackView extends FrameLayout {
 
     /**
      * Updates a bubble in the stack.
-     *
-     * @param entry the entry to update in the stack.
-     * @param updatePosition whether this bubble should be moved to top of the stack.
+     *  @param entry the entry to update in the stack.
      */
-    public void updateBubble(NotificationEntry entry, boolean updatePosition) {
+    public void updateBubble(NotificationEntry entry) {
         Bubble b = mBubbleData.getBubble(entry.key);
         mBubbleData.updateBubble(entry.key, entry);
 
-        if (updatePosition && !mIsExpanded) {
+        if (!mIsExpanded) {
             // If alerting it gets promoted to top of the stack.
             if (mBubbleContainer.indexOfChild(b.iconView) != 0) {
                 mBubbleContainer.moveViewTo(b.iconView, 0);
index 5e16721..20f539b 100644 (file)
@@ -160,7 +160,7 @@ public class BubbleControllerTest extends SysuiTestCase {
 
     @Test
     public void testAddBubble() {
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
         assertTrue(mBubbleController.hasBubbles());
 
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
@@ -169,13 +169,13 @@ public class BubbleControllerTest extends SysuiTestCase {
     @Test
     public void testHasBubbles() {
         assertFalse(mBubbleController.hasBubbles());
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
         assertTrue(mBubbleController.hasBubbles());
     }
 
     @Test
     public void testRemoveBubble() {
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
         assertTrue(mBubbleController.hasBubbles());
 
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
@@ -189,8 +189,8 @@ public class BubbleControllerTest extends SysuiTestCase {
 
     @Test
     public void testDismissStack() {
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
-        mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
+        mBubbleController.updateBubble(mRow2.getEntry());
         assertTrue(mBubbleController.hasBubbles());
 
         mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
@@ -206,7 +206,7 @@ public class BubbleControllerTest extends SysuiTestCase {
 
         // Mark it as a bubble and add it explicitly
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
 
         // We should have bubbles & their notifs should show in the shade
         assertTrue(mBubbleController.hasBubbles());
@@ -235,8 +235,8 @@ public class BubbleControllerTest extends SysuiTestCase {
         // Mark it as a bubble and add it explicitly
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
         mEntryListener.onPendingEntryAdded(mRow2.getEntry());
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
-        mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
+        mBubbleController.updateBubble(mRow2.getEntry());
 
         // We should have bubbles & their notifs should show in the shade
         assertTrue(mBubbleController.hasBubbles());
@@ -272,7 +272,7 @@ public class BubbleControllerTest extends SysuiTestCase {
     public void testExpansionRemovesShowInShade() {
         // Mark it as a bubble and add it explicitly
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
 
         // We should have bubbles & their notifs should show in the shade
         assertTrue(mBubbleController.hasBubbles());
@@ -293,8 +293,8 @@ public class BubbleControllerTest extends SysuiTestCase {
         // Mark it as a bubble and add it explicitly
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
         mEntryListener.onPendingEntryAdded(mRow2.getEntry());
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
-        mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
+        mBubbleController.updateBubble(mRow2.getEntry());
         verify(mBubbleStateChangeListener).onHasBubblesChanged(true);
 
         // Expand
@@ -333,7 +333,7 @@ public class BubbleControllerTest extends SysuiTestCase {
 
         // Add the auto expand bubble
         mEntryListener.onPendingEntryAdded(mAutoExpandRow.getEntry());
-        mBubbleController.updateBubble(mAutoExpandRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mAutoExpandRow.getEntry());
 
         // Expansion shouldn't change
         verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
@@ -371,7 +371,7 @@ public class BubbleControllerTest extends SysuiTestCase {
 
         // Add the auto expand bubble
         mEntryListener.onPendingEntryAdded(mAutoExpandRow.getEntry());
-        mBubbleController.updateBubble(mAutoExpandRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mAutoExpandRow.getEntry());
 
         // Expansion should change
         verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
@@ -387,7 +387,7 @@ public class BubbleControllerTest extends SysuiTestCase {
     public void testSuppressNotif_FailsNotForeground() {
         // Add the suppress notif bubble
         mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry());
-        mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mSuppressNotifRow.getEntry());
 
         // Should show in shade because we weren't forground
         assertTrue(mSuppressNotifRow.getEntry().showInShadeWhenBubble());
@@ -423,7 +423,7 @@ public class BubbleControllerTest extends SysuiTestCase {
 
         // Add the suppress notif bubble
         mEntryListener.onPendingEntryAdded(mSuppressNotifRow.getEntry());
-        mBubbleController.updateBubble(mSuppressNotifRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mSuppressNotifRow.getEntry());
 
         // Should NOT show in shade because we were foreground
         assertFalse(mSuppressNotifRow.getEntry().showInShadeWhenBubble());
@@ -438,7 +438,7 @@ public class BubbleControllerTest extends SysuiTestCase {
         final String key = mRow.getEntry().key;
 
         mEntryListener.onPendingEntryAdded(mRow.getEntry());
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
 
         // Simulate notification cancellation.
         mEntryListener.onEntryRemoved(mRow.getEntry(), null /* notificationVisibility (unused) */,
@@ -464,22 +464,22 @@ public class BubbleControllerTest extends SysuiTestCase {
 
     @Test
     public void testDeleteIntent_removeBubble_aged() throws PendingIntent.CanceledException {
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
         mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_AGED);
         verify(mDeleteIntent, never()).send();
     }
 
     @Test
     public void testDeleteIntent_removeBubble_user() throws PendingIntent.CanceledException {
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
         mBubbleController.removeBubble(mRow.getEntry().key, BubbleController.DISMISS_USER_GESTURE);
         verify(mDeleteIntent, times(1)).send();
     }
 
     @Test
     public void testDeleteIntent_dismissStack() throws PendingIntent.CanceledException {
-        mBubbleController.updateBubble(mRow.getEntry(), true /* updatePosition */);
-        mBubbleController.updateBubble(mRow2.getEntry(), true /* updatePosition */);
+        mBubbleController.updateBubble(mRow.getEntry());
+        mBubbleController.updateBubble(mRow2.getEntry());
         mBubbleController.dismissStack(BubbleController.DISMISS_USER_GESTURE);
         verify(mDeleteIntent, times(2)).send();
     }