Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +16 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,15 @@ public class DesktopModeStatus { public static final boolean IS_DISPLAY_CHANGE_ENABLED = SystemProperties.getBoolean( "persist.wm.debug.desktop_change_display", false); /** * Flag to indicate that desktop stashing is enabled. * When enabled, swiping home from desktop stashes the open apps. Next app that launches, * will be added to the desktop. */ private static final boolean IS_STASHING_ENABLED = SystemProperties.getBoolean( "persist.wm.debug.desktop_stashing", false); /** * Return {@code true} if desktop mode support is enabled */ Loading Loading @@ -83,6 +92,13 @@ public class DesktopModeStatus { return IS_VEILED_RESIZE_ENABLED; } /** * Return {@code true} if desktop task stashing is enabled when going home. * Allows users to use home screen to add tasks to desktop. */ public static boolean isStashingEnabled() { return IS_STASHING_ENABLED; } /** * Check if desktop mode is active * Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +12 −8 Original line number Diff line number Diff line Loading @@ -150,14 +150,17 @@ class DesktopTasksController( * back to front during the launch. */ fun stashDesktopApps(displayId: Int) { if (DesktopModeStatus.isStashingEnabled()) { KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: stashDesktopApps") desktopModeTaskRepository.setStashed(displayId, true) } } /** * Clear the stashed state for the given display */ fun hideStashedDesktopApps(displayId: Int) { if (DesktopModeStatus.isStashingEnabled()) { KtProtoLog.v( WM_SHELL_DESKTOP_MODE, "DesktopTasksController: hideStashedApps displayId=%d", Loading @@ -165,6 +168,7 @@ class DesktopTasksController( ) desktopModeTaskRepository.setStashed(displayId, false) } } /** Get number of tasks that are marked as visible */ fun getVisibleTaskCount(displayId: Int): Int { Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -498,6 +498,7 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun handleRequest_fullscreenTask_desktopStashed_returnWCTWithAllAppsBroughtToFront() { assumeTrue(ENABLE_SHELL_TRANSITIONS) whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) val stashedFreeformTask = setUpFreeformTask(DEFAULT_DISPLAY) markTaskHidden(stashedFreeformTask) Loading Loading @@ -569,6 +570,7 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun handleRequest_freeformTask_desktopStashed_returnWCTWithAllAppsBroughtToFront() { assumeTrue(ENABLE_SHELL_TRANSITIONS) whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) val stashedFreeformTask = setUpFreeformTask(DEFAULT_DISPLAY) markTaskHidden(stashedFreeformTask) Loading Loading @@ -626,6 +628,8 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun stashDesktopApps_stateUpdates() { whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) controller.stashDesktopApps(DEFAULT_DISPLAY) assertThat(desktopModeTaskRepository.isStashed(DEFAULT_DISPLAY)).isTrue() Loading @@ -634,6 +638,8 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun hideStashedDesktopApps_stateUpdates() { whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) desktopModeTaskRepository.setStashed(DEFAULT_DISPLAY, true) desktopModeTaskRepository.setStashed(SECOND_DISPLAY, true) controller.hideStashedDesktopApps(DEFAULT_DISPLAY) Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +16 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,15 @@ public class DesktopModeStatus { public static final boolean IS_DISPLAY_CHANGE_ENABLED = SystemProperties.getBoolean( "persist.wm.debug.desktop_change_display", false); /** * Flag to indicate that desktop stashing is enabled. * When enabled, swiping home from desktop stashes the open apps. Next app that launches, * will be added to the desktop. */ private static final boolean IS_STASHING_ENABLED = SystemProperties.getBoolean( "persist.wm.debug.desktop_stashing", false); /** * Return {@code true} if desktop mode support is enabled */ Loading Loading @@ -83,6 +92,13 @@ public class DesktopModeStatus { return IS_VEILED_RESIZE_ENABLED; } /** * Return {@code true} if desktop task stashing is enabled when going home. * Allows users to use home screen to add tasks to desktop. */ public static boolean isStashingEnabled() { return IS_STASHING_ENABLED; } /** * Check if desktop mode is active * Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +12 −8 Original line number Diff line number Diff line Loading @@ -150,14 +150,17 @@ class DesktopTasksController( * back to front during the launch. */ fun stashDesktopApps(displayId: Int) { if (DesktopModeStatus.isStashingEnabled()) { KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: stashDesktopApps") desktopModeTaskRepository.setStashed(displayId, true) } } /** * Clear the stashed state for the given display */ fun hideStashedDesktopApps(displayId: Int) { if (DesktopModeStatus.isStashingEnabled()) { KtProtoLog.v( WM_SHELL_DESKTOP_MODE, "DesktopTasksController: hideStashedApps displayId=%d", Loading @@ -165,6 +168,7 @@ class DesktopTasksController( ) desktopModeTaskRepository.setStashed(displayId, false) } } /** Get number of tasks that are marked as visible */ fun getVisibleTaskCount(displayId: Int): Int { Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -498,6 +498,7 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun handleRequest_fullscreenTask_desktopStashed_returnWCTWithAllAppsBroughtToFront() { assumeTrue(ENABLE_SHELL_TRANSITIONS) whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) val stashedFreeformTask = setUpFreeformTask(DEFAULT_DISPLAY) markTaskHidden(stashedFreeformTask) Loading Loading @@ -569,6 +570,7 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun handleRequest_freeformTask_desktopStashed_returnWCTWithAllAppsBroughtToFront() { assumeTrue(ENABLE_SHELL_TRANSITIONS) whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) val stashedFreeformTask = setUpFreeformTask(DEFAULT_DISPLAY) markTaskHidden(stashedFreeformTask) Loading Loading @@ -626,6 +628,8 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun stashDesktopApps_stateUpdates() { whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) controller.stashDesktopApps(DEFAULT_DISPLAY) assertThat(desktopModeTaskRepository.isStashed(DEFAULT_DISPLAY)).isTrue() Loading @@ -634,6 +638,8 @@ class DesktopTasksControllerTest : ShellTestCase() { @Test fun hideStashedDesktopApps_stateUpdates() { whenever(DesktopModeStatus.isStashingEnabled()).thenReturn(true) desktopModeTaskRepository.setStashed(DEFAULT_DISPLAY, true) desktopModeTaskRepository.setStashed(SECOND_DISPLAY, true) controller.hideStashedDesktopApps(DEFAULT_DISPLAY) Loading