Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +12 −1 Original line number Diff line number Diff line Loading @@ -894,10 +894,21 @@ public class Bubble implements BubbleViewProvider { } @Nullable Intent getAppBubbleIntent() { @VisibleForTesting public Intent getAppBubbleIntent() { return mAppIntent; } /** * Sets the intent for a bubble that is an app bubble (one for which {@link #mIsAppBubble} is * true). * * @param appIntent The intent to set for the app bubble. */ void setAppBubbleIntent(Intent appIntent) { mAppIntent = appIntent; } /** * Returns whether this bubble is from an app versus a notification. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +2 −0 Original line number Diff line number Diff line Loading @@ -1450,6 +1450,8 @@ public class BubbleController implements ConfigurationChangeListener, if (b != null) { // It's in the overflow, so remove it & reinflate mBubbleData.dismissBubbleWithKey(appBubbleKey, Bubbles.DISMISS_NOTIF_CANCEL); // Update the bubble entry in the overflow with the latest intent. b.setAppBubbleIntent(intent); } else { // App bubble does not exist, lets add and expand it b = Bubble.createAppBubble(intent, user, icon, mMainExecutor); Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import static android.service.notification.NotificationListenerService.NOTIFICAT import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; import static android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED; import static androidx.test.ext.truth.content.IntentSubject.assertThat; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.notification.Flags.FLAG_SCREENSHARE_NOTIFICATION_HIDING; import static com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_BAR; Loading Loading @@ -2016,6 +2018,31 @@ public class BubblesTest extends SysuiTestCase { assertThat(mBubbleData.getOverflowBubbleWithKey(appBubbleKey)).isNull(); } @Test public void testShowOrHideAppBubble_updateExistedBubbleInOverflow_updateIntentInBubble() { String appBubbleKey = Bubble.getAppBubbleKeyForApp(mAppBubbleIntent.getPackage(), mUser0); mBubbleController.showOrHideAppBubble(mAppBubbleIntent, mUser0, mAppBubbleIcon); // Collapse the stack so we don't need to wait for the dismiss animation in the test mBubbleController.collapseStack(); // Dismiss the app bubble so it's in the overflow mBubbleController.dismissBubble(appBubbleKey, Bubbles.DISMISS_USER_GESTURE); assertThat(mBubbleData.getOverflowBubbleWithKey(appBubbleKey)).isNotNull(); // Modify the intent to include new extras. Intent newAppBubbleIntent = new Intent(mContext, BubblesTestActivity.class) .setPackage(mContext.getPackageName()) .putExtra("hello", "world"); // Calling this while collapsed will re-add and expand the app bubble mBubbleController.showOrHideAppBubble(newAppBubbleIntent, mUser0, mAppBubbleIcon); assertThat(mBubbleData.getSelectedBubble().getKey()).isEqualTo(appBubbleKey); assertThat(mBubbleController.isStackExpanded()).isTrue(); assertThat(mBubbleData.getBubbles().size()).isEqualTo(1); assertThat(mBubbleData.getBubbles().get(0).getAppBubbleIntent()).extras().string( "hello").isEqualTo("world"); assertThat(mBubbleData.getOverflowBubbleWithKey(appBubbleKey)).isNull(); } @Test public void testCreateBubbleFromOngoingNotification() { NotificationEntry notif = new NotificationEntryBuilder() Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +12 −1 Original line number Diff line number Diff line Loading @@ -894,10 +894,21 @@ public class Bubble implements BubbleViewProvider { } @Nullable Intent getAppBubbleIntent() { @VisibleForTesting public Intent getAppBubbleIntent() { return mAppIntent; } /** * Sets the intent for a bubble that is an app bubble (one for which {@link #mIsAppBubble} is * true). * * @param appIntent The intent to set for the app bubble. */ void setAppBubbleIntent(Intent appIntent) { mAppIntent = appIntent; } /** * Returns whether this bubble is from an app versus a notification. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +2 −0 Original line number Diff line number Diff line Loading @@ -1450,6 +1450,8 @@ public class BubbleController implements ConfigurationChangeListener, if (b != null) { // It's in the overflow, so remove it & reinflate mBubbleData.dismissBubbleWithKey(appBubbleKey, Bubbles.DISMISS_NOTIF_CANCEL); // Update the bubble entry in the overflow with the latest intent. b.setAppBubbleIntent(intent); } else { // App bubble does not exist, lets add and expand it b = Bubble.createAppBubble(intent, user, icon, mMainExecutor); Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import static android.service.notification.NotificationListenerService.NOTIFICAT import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; import static android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED; import static androidx.test.ext.truth.content.IntentSubject.assertThat; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.notification.Flags.FLAG_SCREENSHARE_NOTIFICATION_HIDING; import static com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_BAR; Loading Loading @@ -2016,6 +2018,31 @@ public class BubblesTest extends SysuiTestCase { assertThat(mBubbleData.getOverflowBubbleWithKey(appBubbleKey)).isNull(); } @Test public void testShowOrHideAppBubble_updateExistedBubbleInOverflow_updateIntentInBubble() { String appBubbleKey = Bubble.getAppBubbleKeyForApp(mAppBubbleIntent.getPackage(), mUser0); mBubbleController.showOrHideAppBubble(mAppBubbleIntent, mUser0, mAppBubbleIcon); // Collapse the stack so we don't need to wait for the dismiss animation in the test mBubbleController.collapseStack(); // Dismiss the app bubble so it's in the overflow mBubbleController.dismissBubble(appBubbleKey, Bubbles.DISMISS_USER_GESTURE); assertThat(mBubbleData.getOverflowBubbleWithKey(appBubbleKey)).isNotNull(); // Modify the intent to include new extras. Intent newAppBubbleIntent = new Intent(mContext, BubblesTestActivity.class) .setPackage(mContext.getPackageName()) .putExtra("hello", "world"); // Calling this while collapsed will re-add and expand the app bubble mBubbleController.showOrHideAppBubble(newAppBubbleIntent, mUser0, mAppBubbleIcon); assertThat(mBubbleData.getSelectedBubble().getKey()).isEqualTo(appBubbleKey); assertThat(mBubbleController.isStackExpanded()).isTrue(); assertThat(mBubbleData.getBubbles().size()).isEqualTo(1); assertThat(mBubbleData.getBubbles().get(0).getAppBubbleIntent()).extras().string( "hello").isEqualTo("world"); assertThat(mBubbleData.getOverflowBubbleWithKey(appBubbleKey)).isNull(); } @Test public void testCreateBubbleFromOngoingNotification() { NotificationEntry notif = new NotificationEntryBuilder() Loading