Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +7 −1 Original line number Original line Diff line number Diff line Loading @@ -1971,7 +1971,13 @@ public class BubbleController implements ConfigurationChangeListener, return; return; } } bubble.inflate( bubble.inflate( (b) -> mBubbleData.overflowBubble(Bubbles.DISMISS_RELOAD_FROM_DISK, bubble), (b) -> { if (Flags.enableOptionalBubbleOverflow()) { mBubbleData.addOverflowBubbleFromDisk(bubble); } else { mBubbleData.doOverflow(Bubbles.DISMISS_RELOAD_FROM_DISK, bubble); } }, mContext, mContext, mExpandedViewManager, mExpandedViewManager, mBubbleTaskViewFactory, mBubbleTaskViewFactory, Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -850,7 +850,7 @@ public class BubbleData { ProtoLog.d(WM_SHELL_BUBBLES, "doRemove=%s reason=%s", bubbleToRemove.getKey(), ProtoLog.d(WM_SHELL_BUBBLES, "doRemove=%s reason=%s", bubbleToRemove.getKey(), dismissReasonToString(reason)); dismissReasonToString(reason)); bubbleToRemove.stopInflation(); bubbleToRemove.stopInflation(); overflowBubble(reason, bubbleToRemove); doOverflow(reason, bubbleToRemove); if (mBubbles.size() == 1) { if (mBubbles.size() == 1) { setExpandedInternal(false); setExpandedInternal(false); Loading Loading @@ -947,7 +947,7 @@ public class BubbleData { } } } } void overflowBubble(@DismissReason int reason, Bubble bubble) { void doOverflow(@DismissReason int reason, Bubble bubble) { boolean isOverflowReason = reason == Bubbles.DISMISS_AGED boolean isOverflowReason = reason == Bubbles.DISMISS_AGED || reason == Bubbles.DISMISS_USER_GESTURE || reason == Bubbles.DISMISS_USER_GESTURE || reason == Bubbles.DISMISS_USER_GESTURE_FROM_LAUNCHER || reason == Bubbles.DISMISS_USER_GESTURE_FROM_LAUNCHER Loading Loading @@ -1040,6 +1040,14 @@ public class BubbleData { } } } } /** * Adds a bubble loaded from the saved bubbles xml file to the overflow. */ public void addOverflowBubbleFromDisk(Bubble bubble) { doOverflow(Bubbles.DISMISS_RELOAD_FROM_DISK, bubble); dispatchPendingChanges(); } /** /** * Removes all bubbles from the overflow, called when the user changes. * Removes all bubbles from the overflow, called when the user changes. */ */ Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +19 −3 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.wm.shell.bubbles; package com.android.wm.shell.bubbles; import static com.android.wm.shell.Flags.FLAG_ENABLE_OPTIONAL_BUBBLE_OVERFLOW; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertWithMessage; Loading @@ -37,6 +39,7 @@ import android.content.LocusId; import android.graphics.drawable.Icon; import android.graphics.drawable.Icon; import android.os.Bundle; import android.os.Bundle; import android.os.UserHandle; import android.os.UserHandle; import android.platform.test.annotations.EnableFlags; import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification; import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner; Loading Loading @@ -457,6 +460,19 @@ public class BubbleDataTest extends ShellTestCase { // Overflow // Overflow // // @EnableFlags(FLAG_ENABLE_OPTIONAL_BUBBLE_OVERFLOW) @Test public void testAddOverflowBubbleFromDisk_notifiesUpdate() { mBubbleData.setListener(mListener); mBubbleData.addOverflowBubbleFromDisk(mBubbleA1); verifyUpdateReceived(); BubbleData.Update update = mUpdateCaptor.getValue(); assertThat(update.showOverflowChanged).isTrue(); assertThat(update.overflowBubbles).hasSize(1); } /** /** * Verifies that when the bubble stack reaches its maximum, the oldest bubble is overflowed. * Verifies that when the bubble stack reaches its maximum, the oldest bubble is overflowed. */ */ Loading Loading @@ -1095,9 +1111,9 @@ public class BubbleDataTest extends ShellTestCase { @Test @Test public void test_addToOverflow_doesntAllowDupes() { public void test_addToOverflow_doesntAllowDupes() { assertEquals(0, mBubbleData.getOverflowBubbles().size()); assertEquals(0, mBubbleData.getOverflowBubbles().size()); mBubbleData.overflowBubble(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.doOverflow(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.overflowBubble(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.doOverflow(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.overflowBubble(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.doOverflow(Bubbles.DISMISS_AGED, mBubbleA1); assertEquals(1, mBubbleData.getOverflowBubbles().size()); assertEquals(1, mBubbleData.getOverflowBubbles().size()); } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +7 −1 Original line number Original line Diff line number Diff line Loading @@ -1971,7 +1971,13 @@ public class BubbleController implements ConfigurationChangeListener, return; return; } } bubble.inflate( bubble.inflate( (b) -> mBubbleData.overflowBubble(Bubbles.DISMISS_RELOAD_FROM_DISK, bubble), (b) -> { if (Flags.enableOptionalBubbleOverflow()) { mBubbleData.addOverflowBubbleFromDisk(bubble); } else { mBubbleData.doOverflow(Bubbles.DISMISS_RELOAD_FROM_DISK, bubble); } }, mContext, mContext, mExpandedViewManager, mExpandedViewManager, mBubbleTaskViewFactory, mBubbleTaskViewFactory, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -850,7 +850,7 @@ public class BubbleData { ProtoLog.d(WM_SHELL_BUBBLES, "doRemove=%s reason=%s", bubbleToRemove.getKey(), ProtoLog.d(WM_SHELL_BUBBLES, "doRemove=%s reason=%s", bubbleToRemove.getKey(), dismissReasonToString(reason)); dismissReasonToString(reason)); bubbleToRemove.stopInflation(); bubbleToRemove.stopInflation(); overflowBubble(reason, bubbleToRemove); doOverflow(reason, bubbleToRemove); if (mBubbles.size() == 1) { if (mBubbles.size() == 1) { setExpandedInternal(false); setExpandedInternal(false); Loading Loading @@ -947,7 +947,7 @@ public class BubbleData { } } } } void overflowBubble(@DismissReason int reason, Bubble bubble) { void doOverflow(@DismissReason int reason, Bubble bubble) { boolean isOverflowReason = reason == Bubbles.DISMISS_AGED boolean isOverflowReason = reason == Bubbles.DISMISS_AGED || reason == Bubbles.DISMISS_USER_GESTURE || reason == Bubbles.DISMISS_USER_GESTURE || reason == Bubbles.DISMISS_USER_GESTURE_FROM_LAUNCHER || reason == Bubbles.DISMISS_USER_GESTURE_FROM_LAUNCHER Loading Loading @@ -1040,6 +1040,14 @@ public class BubbleData { } } } } /** * Adds a bubble loaded from the saved bubbles xml file to the overflow. */ public void addOverflowBubbleFromDisk(Bubble bubble) { doOverflow(Bubbles.DISMISS_RELOAD_FROM_DISK, bubble); dispatchPendingChanges(); } /** /** * Removes all bubbles from the overflow, called when the user changes. * Removes all bubbles from the overflow, called when the user changes. */ */ Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +19 −3 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.wm.shell.bubbles; package com.android.wm.shell.bubbles; import static com.android.wm.shell.Flags.FLAG_ENABLE_OPTIONAL_BUBBLE_OVERFLOW; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertWithMessage; Loading @@ -37,6 +39,7 @@ import android.content.LocusId; import android.graphics.drawable.Icon; import android.graphics.drawable.Icon; import android.os.Bundle; import android.os.Bundle; import android.os.UserHandle; import android.os.UserHandle; import android.platform.test.annotations.EnableFlags; import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification; import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner; Loading Loading @@ -457,6 +460,19 @@ public class BubbleDataTest extends ShellTestCase { // Overflow // Overflow // // @EnableFlags(FLAG_ENABLE_OPTIONAL_BUBBLE_OVERFLOW) @Test public void testAddOverflowBubbleFromDisk_notifiesUpdate() { mBubbleData.setListener(mListener); mBubbleData.addOverflowBubbleFromDisk(mBubbleA1); verifyUpdateReceived(); BubbleData.Update update = mUpdateCaptor.getValue(); assertThat(update.showOverflowChanged).isTrue(); assertThat(update.overflowBubbles).hasSize(1); } /** /** * Verifies that when the bubble stack reaches its maximum, the oldest bubble is overflowed. * Verifies that when the bubble stack reaches its maximum, the oldest bubble is overflowed. */ */ Loading Loading @@ -1095,9 +1111,9 @@ public class BubbleDataTest extends ShellTestCase { @Test @Test public void test_addToOverflow_doesntAllowDupes() { public void test_addToOverflow_doesntAllowDupes() { assertEquals(0, mBubbleData.getOverflowBubbles().size()); assertEquals(0, mBubbleData.getOverflowBubbles().size()); mBubbleData.overflowBubble(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.doOverflow(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.overflowBubble(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.doOverflow(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.overflowBubble(Bubbles.DISMISS_AGED, mBubbleA1); mBubbleData.doOverflow(Bubbles.DISMISS_AGED, mBubbleA1); assertEquals(1, mBubbleData.getOverflowBubbles().size()); assertEquals(1, mBubbleData.getOverflowBubbles().size()); } } Loading