Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4a1f889 authored by Mark Renouf's avatar Mark Renouf Committed by Android (Google) Code Review
Browse files

Merge "BubbleData [1/n]: remove unused parameter" into qt-dev

parents 0a94974b f97ed464
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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);
            }
        }
+3 −5
Original line number Diff line number Diff line
@@ -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.
     */
    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);
+20 −20
Original line number Diff line number Diff line
@@ -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();
    }