Merge "Add a desktop mode API to hide stashed apps" into udc-qpr-dev
This commit is contained in:
@@ -514,6 +514,11 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll
|
||||
// Stashing of desktop apps not needed. Apps always launch on desktop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideStashedDesktopApps(int displayId) throws RemoteException {
|
||||
// Stashing of desktop apps not needed. Apps always launch on desktop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskListener(IDesktopTaskListener listener) throws RemoteException {
|
||||
// TODO(b/261234402): move visibility from sysui state to listener
|
||||
|
||||
@@ -131,6 +131,18 @@ class DesktopTasksController(
|
||||
desktopModeTaskRepository.setStashed(displayId, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stashed state for the given display
|
||||
*/
|
||||
fun hideStashedDesktopApps(displayId: Int) {
|
||||
KtProtoLog.v(
|
||||
WM_SHELL_DESKTOP_MODE,
|
||||
"DesktopTasksController: hideStashedApps displayId=%d",
|
||||
displayId
|
||||
)
|
||||
desktopModeTaskRepository.setStashed(displayId, false)
|
||||
}
|
||||
|
||||
/** Get number of tasks that are marked as visible */
|
||||
fun getVisibleTaskCount(displayId: Int): Int {
|
||||
return desktopModeTaskRepository.getVisibleTaskCount(displayId)
|
||||
@@ -753,6 +765,13 @@ class DesktopTasksController(
|
||||
) { c -> c.stashDesktopApps(displayId) }
|
||||
}
|
||||
|
||||
override fun hideStashedDesktopApps(displayId: Int) {
|
||||
ExecutorUtils.executeRemoteCallWithTaskPermission(
|
||||
controller,
|
||||
"hideStashedDesktopApps"
|
||||
) { c -> c.hideStashedDesktopApps(displayId) }
|
||||
}
|
||||
|
||||
override fun getVisibleTaskCount(displayId: Int): Int {
|
||||
val result = IntArray(1)
|
||||
ExecutorUtils.executeRemoteCallWithTaskPermission(
|
||||
|
||||
@@ -29,6 +29,9 @@ interface IDesktopMode {
|
||||
/** Stash apps on the desktop to allow launching another app from home screen */
|
||||
void stashDesktopApps(int displayId);
|
||||
|
||||
/** Hide apps that may be stashed */
|
||||
void hideStashedDesktopApps(int displayId);
|
||||
|
||||
/** Get count of visible desktop tasks on the given display */
|
||||
int getVisibleTaskCount(int displayId);
|
||||
|
||||
|
||||
@@ -587,6 +587,17 @@ class DesktopTasksControllerTest : ShellTestCase() {
|
||||
assertThat(desktopModeTaskRepository.isStashed(SECOND_DISPLAY)).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hideStashedDesktopApps_stateUpdates() {
|
||||
desktopModeTaskRepository.setStashed(DEFAULT_DISPLAY, true)
|
||||
desktopModeTaskRepository.setStashed(SECOND_DISPLAY, true)
|
||||
controller.hideStashedDesktopApps(DEFAULT_DISPLAY)
|
||||
|
||||
assertThat(desktopModeTaskRepository.isStashed(DEFAULT_DISPLAY)).isFalse()
|
||||
// Check that second display is not affected
|
||||
assertThat(desktopModeTaskRepository.isStashed(SECOND_DISPLAY)).isTrue()
|
||||
}
|
||||
|
||||
private fun setUpFreeformTask(displayId: Int = DEFAULT_DISPLAY): RunningTaskInfo {
|
||||
val task = createFreeformTask(displayId)
|
||||
whenever(shellTaskOrganizer.getRunningTaskInfo(task.taskId)).thenReturn(task)
|
||||
|
||||
Reference in New Issue
Block a user