Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskStackListenerTest.kt +0 −48 Original line number Diff line number Diff line Loading @@ -135,52 +135,4 @@ class BubbleTaskStackListenerTest { verify(taskOrganizer).setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) verify(taskViewTaskController).notifyTaskRemovalStarted(task) } @Test fun onActivityRestartAttempt_overflowAppBubbleRestart_promotesFromOverflow() { bubbleData.stub { on { getOverflowBubbleWithTaskId(bubbleTaskId) } doReturn bubble } bubbleTaskStackListener.onActivityRestartAttempt( task, homeTaskVisible = false, clearedTask = false, wasVisible = false, ) verify(bubbleController).promoteBubbleFromOverflow(bubble) verify(bubbleData).setExpanded(true) } @Test @EnableFlags( FLAG_ENABLE_CREATE_ANY_BUBBLE, FLAG_ENABLE_BUBBLE_ANYTHING, FLAG_EXCLUDE_TASK_FROM_RECENTS, FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP, ) fun onActivityRestartAttempt_overflowAppBubbleToFullscreen_notifiesTaskRemoval() { task.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FULLSCREEN bubbleData.stub { on { getOverflowBubbleWithTaskId(bubbleTaskId) } doReturn bubble } bubbleTaskStackListener.onActivityRestartAttempt( task, homeTaskVisible = false, clearedTask = false, wasVisible = false, ) val taskViewTaskController = bubble.taskView.controller val taskOrganizer = taskViewTaskController.taskOrganizer val wct = argumentCaptor<WindowContainerTransaction>().let { wctCaptor -> verify(taskOrganizer).applyTransaction(wctCaptor.capture()) wctCaptor.lastValue } verifyExitBubbleTransaction(wct, bubbleTaskToken.asBinder()) verify(taskOrganizer).setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) verify(taskViewTaskController).notifyTaskRemovalStarted(task) } } libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +1 −0 Original line number Diff line number Diff line Loading @@ -670,6 +670,7 @@ public class Bubble implements BubbleViewProvider { mBubbleTaskView.cleanup(); mBubbleTaskView = null; } mTaskId = INVALID_TASK_ID; } /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +0 −6 Original line number Diff line number Diff line Loading @@ -1259,12 +1259,6 @@ public class BubbleData { b.getIconView() != null && b.getIconView().equals(view)); } /** @return the overflow bubble that matches the provided taskId. */ @Nullable Bubble getOverflowBubbleWithTaskId(int taskId) { return getBubbleWithPredicate(mOverflowBubbles, b -> b.getTaskId() == taskId); } /** @return the overflow bubble that matches the provided key. */ @Nullable public Bubble getOverflowBubbleWithKey(String key) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskStackListener.kt +0 −38 Original line number Diff line number Diff line Loading @@ -64,14 +64,6 @@ class BubbleTaskStackListener( } return@onActivityRestartAttempt } bubbleData.getOverflowBubbleWithTaskId(taskId)?.let { bubble -> if (isBubbleToFullscreen(task)) { moveCollapsedOverflowBubbleToFullscreen(bubble, task) } else { selectAndExpandOverflowBubble(bubble, task) } } } /** Selects and expands a bubble that is currently in the stack. */ Loading Loading @@ -103,36 +95,6 @@ class BubbleTaskStackListener( collapsedBubbleToFullscreenInternal(bubble, task) } /** Selects and expands a bubble that is currently in the overflow. */ private fun selectAndExpandOverflowBubble( bubble: Bubble, task: ActivityManager.RunningTaskInfo, ) { ProtoLog.d( WM_SHELL_BUBBLES, "selectAndExpandOverflowBubble - taskId=%d selecting matching overflow bubble=%s", task.taskId, bubble.key, ) bubbleController.promoteBubbleFromOverflow(bubble) bubbleData.setExpanded(true) } /** Moves a collapsed overflow bubble to fullscreen. */ private fun moveCollapsedOverflowBubbleToFullscreen( bubble: Bubble, task: ActivityManager.RunningTaskInfo, ) { ProtoLog.d( WM_SHELL_BUBBLES, "moveCollapsedOverflowBubbleToFullscreen - taskId=%d " + "moving matching overflow bubble=%s to fullscreen", task.taskId, bubble.key, ) collapsedBubbleToFullscreenInternal(bubble, task) } /** Internal function to move a collapsed bubble to fullscreen task. */ private fun collapsedBubbleToFullscreenInternal( bubble: Bubble, Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; Loading Loading @@ -299,6 +301,20 @@ public class BubbleTest extends ShellTestCase { assertThat(bubbleInfo.getPackageName()).isEqualTo(bubble.getPackageName()); } @Test public void testCleanupTaskView() { // Create a bubble with a task id TaskInfo info = mock(TaskInfo.class); info.taskId = 123; info.baseActivity = new ComponentName(mContext, "SomeActivity"); Bubble bubble = Bubble.createTaskBubble(info, new UserHandle(1), null /* icon */, mMainExecutor, mBgExecutor); assertThat(bubble.getTaskId()).isEqualTo(123); bubble.cleanupTaskView(); assertThat(bubble.getTaskId()).isEqualTo(INVALID_TASK_ID); } private Intent createIntent() { Intent intent = new Intent(mContext, BubblesTestActivity.class); intent.setPackage(mContext.getPackageName()); Loading Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskStackListenerTest.kt +0 −48 Original line number Diff line number Diff line Loading @@ -135,52 +135,4 @@ class BubbleTaskStackListenerTest { verify(taskOrganizer).setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) verify(taskViewTaskController).notifyTaskRemovalStarted(task) } @Test fun onActivityRestartAttempt_overflowAppBubbleRestart_promotesFromOverflow() { bubbleData.stub { on { getOverflowBubbleWithTaskId(bubbleTaskId) } doReturn bubble } bubbleTaskStackListener.onActivityRestartAttempt( task, homeTaskVisible = false, clearedTask = false, wasVisible = false, ) verify(bubbleController).promoteBubbleFromOverflow(bubble) verify(bubbleData).setExpanded(true) } @Test @EnableFlags( FLAG_ENABLE_CREATE_ANY_BUBBLE, FLAG_ENABLE_BUBBLE_ANYTHING, FLAG_EXCLUDE_TASK_FROM_RECENTS, FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP, ) fun onActivityRestartAttempt_overflowAppBubbleToFullscreen_notifiesTaskRemoval() { task.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FULLSCREEN bubbleData.stub { on { getOverflowBubbleWithTaskId(bubbleTaskId) } doReturn bubble } bubbleTaskStackListener.onActivityRestartAttempt( task, homeTaskVisible = false, clearedTask = false, wasVisible = false, ) val taskViewTaskController = bubble.taskView.controller val taskOrganizer = taskViewTaskController.taskOrganizer val wct = argumentCaptor<WindowContainerTransaction>().let { wctCaptor -> verify(taskOrganizer).applyTransaction(wctCaptor.capture()) wctCaptor.lastValue } verifyExitBubbleTransaction(wct, bubbleTaskToken.asBinder()) verify(taskOrganizer).setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) verify(taskViewTaskController).notifyTaskRemovalStarted(task) } }
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +1 −0 Original line number Diff line number Diff line Loading @@ -670,6 +670,7 @@ public class Bubble implements BubbleViewProvider { mBubbleTaskView.cleanup(); mBubbleTaskView = null; } mTaskId = INVALID_TASK_ID; } /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +0 −6 Original line number Diff line number Diff line Loading @@ -1259,12 +1259,6 @@ public class BubbleData { b.getIconView() != null && b.getIconView().equals(view)); } /** @return the overflow bubble that matches the provided taskId. */ @Nullable Bubble getOverflowBubbleWithTaskId(int taskId) { return getBubbleWithPredicate(mOverflowBubbles, b -> b.getTaskId() == taskId); } /** @return the overflow bubble that matches the provided key. */ @Nullable public Bubble getOverflowBubbleWithKey(String key) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskStackListener.kt +0 −38 Original line number Diff line number Diff line Loading @@ -64,14 +64,6 @@ class BubbleTaskStackListener( } return@onActivityRestartAttempt } bubbleData.getOverflowBubbleWithTaskId(taskId)?.let { bubble -> if (isBubbleToFullscreen(task)) { moveCollapsedOverflowBubbleToFullscreen(bubble, task) } else { selectAndExpandOverflowBubble(bubble, task) } } } /** Selects and expands a bubble that is currently in the stack. */ Loading Loading @@ -103,36 +95,6 @@ class BubbleTaskStackListener( collapsedBubbleToFullscreenInternal(bubble, task) } /** Selects and expands a bubble that is currently in the overflow. */ private fun selectAndExpandOverflowBubble( bubble: Bubble, task: ActivityManager.RunningTaskInfo, ) { ProtoLog.d( WM_SHELL_BUBBLES, "selectAndExpandOverflowBubble - taskId=%d selecting matching overflow bubble=%s", task.taskId, bubble.key, ) bubbleController.promoteBubbleFromOverflow(bubble) bubbleData.setExpanded(true) } /** Moves a collapsed overflow bubble to fullscreen. */ private fun moveCollapsedOverflowBubbleToFullscreen( bubble: Bubble, task: ActivityManager.RunningTaskInfo, ) { ProtoLog.d( WM_SHELL_BUBBLES, "moveCollapsedOverflowBubbleToFullscreen - taskId=%d " + "moving matching overflow bubble=%s to fullscreen", task.taskId, bubble.key, ) collapsedBubbleToFullscreenInternal(bubble, task) } /** Internal function to move a collapsed bubble to fullscreen task. */ private fun collapsedBubbleToFullscreenInternal( bubble: Bubble, Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.wm.shell.bubbles; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; Loading Loading @@ -299,6 +301,20 @@ public class BubbleTest extends ShellTestCase { assertThat(bubbleInfo.getPackageName()).isEqualTo(bubble.getPackageName()); } @Test public void testCleanupTaskView() { // Create a bubble with a task id TaskInfo info = mock(TaskInfo.class); info.taskId = 123; info.baseActivity = new ComponentName(mContext, "SomeActivity"); Bubble bubble = Bubble.createTaskBubble(info, new UserHandle(1), null /* icon */, mMainExecutor, mBgExecutor); assertThat(bubble.getTaskId()).isEqualTo(123); bubble.cleanupTaskView(); assertThat(bubble.getTaskId()).isEqualTo(INVALID_TASK_ID); } private Intent createIntent() { Intent intent = new Intent(mContext, BubblesTestActivity.class); intent.setPackage(mContext.getPackageName()); Loading