Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +25 −10 Original line number Diff line number Diff line Loading @@ -588,8 +588,16 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, private void openHandleMenu(int taskId) { final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskId); decoration.createHandleMenu(checkNumberOfOtherInstances(decoration.mTaskInfo) >= MANAGE_WINDOWS_MINIMUM_INSTANCES); // TODO(b/379873022): Run the instance check and the AssistContent request in // createHandleMenu on the same bg thread dispatch. mBgExecutor.execute(() -> { final int numOfInstances = checkNumberOfOtherInstances(decoration.mTaskInfo); mMainExecutor.execute(() -> { decoration.createHandleMenu( numOfInstances >= MANAGE_WINDOWS_MINIMUM_INSTANCES ); }); }); } private void onToggleSizeInteraction( Loading Loading @@ -763,11 +771,19 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, return; } decoration.closeHandleMenu(); decoration.createManageWindowsMenu(getTaskSnapshots(decoration.mTaskInfo), mBgExecutor.execute(() -> { final ArrayList<Pair<Integer, TaskSnapshot>> snapshotList = getTaskSnapshots(decoration.mTaskInfo); mMainExecutor.execute(() -> decoration.createManageWindowsMenu( snapshotList, /* onIconClickListener= */ (Integer requestedTaskId) -> { decoration.closeManageWindowsMenu(); mDesktopTasksController.openInstance(decoration.mTaskInfo, requestedTaskId); mDesktopTasksController.openInstance(decoration.mTaskInfo, requestedTaskId); return Unit.INSTANCE; } ) ); }); } Loading Loading @@ -1814,11 +1830,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, // TODO(b/336289597): Rather than returning number of instances, return a list of valid // instances, then refer to the list's size and reuse the list for Manage Windows menu. final IActivityTaskManager activityTaskManager = ActivityTaskManager.getService(); final IActivityManager activityManager = ActivityManager.getService(); try { return activityTaskManager.getRecentTasks(Integer.MAX_VALUE, ActivityManager.RECENT_WITH_EXCLUDED, activityManager.getCurrentUserId()).getList().stream().filter( info.userId).getList().stream().filter( recentTaskInfo -> (recentTaskInfo.taskId != info.taskId && recentTaskInfo.baseActivity != null && recentTaskInfo.baseActivity.getPackageName() Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelAppHandleOnlyTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ class DesktopModeWindowDecorViewModelAppHandleOnlyTest : times(1) ).setAppHandleEducationTooltipCallbacks(openHandleMenuCallbackCaptor.capture(), any()) openHandleMenuCallbackCaptor.lastValue.invoke(task.taskId) bgExecutor.flushAll() testShellExecutor.flushAll() verify(decor, times(1)).createHandleMenu(anyBoolean()) } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt +2 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,8 @@ class DesktopModeWindowDecorViewModelTests : DesktopModeWindowDecorViewModelTest times(1) ).setAppHandleEducationTooltipCallbacks(openHandleMenuCallbackCaptor.capture(), any()) openHandleMenuCallbackCaptor.lastValue.invoke(task.taskId) bgExecutor.flushAll() testShellExecutor.flushAll() verify(decor, times(1)).createHandleMenu(anyBoolean()) } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTestsBase.kt +1 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,7 @@ open class DesktopModeWindowDecorViewModelTestsBase : ShellTestCase() { } else { statusBars() } userId = context.userId } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +25 −10 Original line number Diff line number Diff line Loading @@ -588,8 +588,16 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, private void openHandleMenu(int taskId) { final DesktopModeWindowDecoration decoration = mWindowDecorByTaskId.get(taskId); decoration.createHandleMenu(checkNumberOfOtherInstances(decoration.mTaskInfo) >= MANAGE_WINDOWS_MINIMUM_INSTANCES); // TODO(b/379873022): Run the instance check and the AssistContent request in // createHandleMenu on the same bg thread dispatch. mBgExecutor.execute(() -> { final int numOfInstances = checkNumberOfOtherInstances(decoration.mTaskInfo); mMainExecutor.execute(() -> { decoration.createHandleMenu( numOfInstances >= MANAGE_WINDOWS_MINIMUM_INSTANCES ); }); }); } private void onToggleSizeInteraction( Loading Loading @@ -763,11 +771,19 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, return; } decoration.closeHandleMenu(); decoration.createManageWindowsMenu(getTaskSnapshots(decoration.mTaskInfo), mBgExecutor.execute(() -> { final ArrayList<Pair<Integer, TaskSnapshot>> snapshotList = getTaskSnapshots(decoration.mTaskInfo); mMainExecutor.execute(() -> decoration.createManageWindowsMenu( snapshotList, /* onIconClickListener= */ (Integer requestedTaskId) -> { decoration.closeManageWindowsMenu(); mDesktopTasksController.openInstance(decoration.mTaskInfo, requestedTaskId); mDesktopTasksController.openInstance(decoration.mTaskInfo, requestedTaskId); return Unit.INSTANCE; } ) ); }); } Loading Loading @@ -1814,11 +1830,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, // TODO(b/336289597): Rather than returning number of instances, return a list of valid // instances, then refer to the list's size and reuse the list for Manage Windows menu. final IActivityTaskManager activityTaskManager = ActivityTaskManager.getService(); final IActivityManager activityManager = ActivityManager.getService(); try { return activityTaskManager.getRecentTasks(Integer.MAX_VALUE, ActivityManager.RECENT_WITH_EXCLUDED, activityManager.getCurrentUserId()).getList().stream().filter( info.userId).getList().stream().filter( recentTaskInfo -> (recentTaskInfo.taskId != info.taskId && recentTaskInfo.baseActivity != null && recentTaskInfo.baseActivity.getPackageName() Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelAppHandleOnlyTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ class DesktopModeWindowDecorViewModelAppHandleOnlyTest : times(1) ).setAppHandleEducationTooltipCallbacks(openHandleMenuCallbackCaptor.capture(), any()) openHandleMenuCallbackCaptor.lastValue.invoke(task.taskId) bgExecutor.flushAll() testShellExecutor.flushAll() verify(decor, times(1)).createHandleMenu(anyBoolean()) } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt +2 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,8 @@ class DesktopModeWindowDecorViewModelTests : DesktopModeWindowDecorViewModelTest times(1) ).setAppHandleEducationTooltipCallbacks(openHandleMenuCallbackCaptor.capture(), any()) openHandleMenuCallbackCaptor.lastValue.invoke(task.taskId) bgExecutor.flushAll() testShellExecutor.flushAll() verify(decor, times(1)).createHandleMenu(anyBoolean()) } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTestsBase.kt +1 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,7 @@ open class DesktopModeWindowDecorViewModelTestsBase : ShellTestCase() { } else { statusBars() } userId = context.userId } } Loading