Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +8 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ public class RecentTasksController implements TaskStackListenerCallback, private final RecentTasksImpl mImpl = new RecentTasksImpl(); private final ActivityTaskManager mActivityTaskManager; private final TaskStackTransitionObserver mTaskStackTransitionObserver; private final RecentsShellCommandHandler mRecentsShellCommandHandler; private RecentsTransitionHandler mTransitionHandler = null; private IRecentTasksListener mListener; private final boolean mPcFeatureEnabled; Loading Loading @@ -167,6 +168,7 @@ public class RecentTasksController implements TaskStackListenerCallback, mDesktopUserRepositories = desktopUserRepositories; mTaskStackTransitionObserver = taskStackTransitionObserver; mMainExecutor = mainExecutor; mRecentsShellCommandHandler = new RecentsShellCommandHandler(this); shellInit.addInitCallback(this::onInit, this); } Loading @@ -183,6 +185,7 @@ public class RecentTasksController implements TaskStackListenerCallback, mShellController.addExternalInterface(IRecentTasks.DESCRIPTOR, this::createExternalInterface, this); mShellCommandHandler.addDumpCallback(this::dump, this); mShellCommandHandler.addCommandCallback("recents", mRecentsShellCommandHandler, this); mUserId = ActivityManager.getCurrentUser(); mDesktopUserRepositories.ifPresent( desktopUserRepositories -> Loading Loading @@ -656,6 +659,11 @@ public class RecentTasksController implements TaskStackListenerCallback, return mActivityTaskManager.removeTask(taskId); } /** Removes all recent tasks that are visible. */ public void removeAllVisibleRecentTasks() throws RemoteException { ActivityTaskManager.getService().removeAllVisibleRecentTasks(); } public void dump(@NonNull PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; pw.println(prefix + TAG); Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsShellCommandHandler.kt 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.recents import android.os.RemoteException import com.android.wm.shell.sysui.ShellCommandHandler.ShellCommandActionHandler import java.io.PrintWriter class RecentsShellCommandHandler( private val recentTasksController: RecentTasksController ) : ShellCommandActionHandler { override fun onShellCommand(args: Array<out String>, pw: PrintWriter): Boolean { when (args[0]) { "clearAll" -> return runClearAll(pw) else -> { pw.println("Invalid command: " + args[0]) return false } } } override fun printShellCommandHelp(pw: PrintWriter, prefix: String) { pw.println("${prefix}clearAll") pw.println("$prefix Clears all visible recent tasks.") } private fun runClearAll(pw: PrintWriter): Boolean { try { recentTasksController.removeAllVisibleRecentTasks() } catch (e: RemoteException) { pw.println("Exception while removing visible recent tasks:") e.printStackTrace(pw) return false } return true } } No newline at end of file libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/CopyContentInSplit.kt +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.RecentTasksUtils import com.android.wm.shell.flicker.utils.SplitScreenUtils import org.junit.After import org.junit.Before Loading Loading @@ -61,7 +62,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { @After fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation) } } libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/DismissSplitScreenByDivider.kt +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.RecentTasksUtils import com.android.wm.shell.flicker.utils.SplitScreenUtils import org.junit.After import org.junit.Before Loading Loading @@ -74,7 +75,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { @After fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation) } } libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/DismissSplitScreenByGoHome.kt +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.RecentTasksUtils import com.android.wm.shell.flicker.utils.SplitScreenUtils import org.junit.After import org.junit.Before Loading Loading @@ -60,7 +61,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { @After fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation) } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +8 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,7 @@ public class RecentTasksController implements TaskStackListenerCallback, private final RecentTasksImpl mImpl = new RecentTasksImpl(); private final ActivityTaskManager mActivityTaskManager; private final TaskStackTransitionObserver mTaskStackTransitionObserver; private final RecentsShellCommandHandler mRecentsShellCommandHandler; private RecentsTransitionHandler mTransitionHandler = null; private IRecentTasksListener mListener; private final boolean mPcFeatureEnabled; Loading Loading @@ -167,6 +168,7 @@ public class RecentTasksController implements TaskStackListenerCallback, mDesktopUserRepositories = desktopUserRepositories; mTaskStackTransitionObserver = taskStackTransitionObserver; mMainExecutor = mainExecutor; mRecentsShellCommandHandler = new RecentsShellCommandHandler(this); shellInit.addInitCallback(this::onInit, this); } Loading @@ -183,6 +185,7 @@ public class RecentTasksController implements TaskStackListenerCallback, mShellController.addExternalInterface(IRecentTasks.DESCRIPTOR, this::createExternalInterface, this); mShellCommandHandler.addDumpCallback(this::dump, this); mShellCommandHandler.addCommandCallback("recents", mRecentsShellCommandHandler, this); mUserId = ActivityManager.getCurrentUser(); mDesktopUserRepositories.ifPresent( desktopUserRepositories -> Loading Loading @@ -656,6 +659,11 @@ public class RecentTasksController implements TaskStackListenerCallback, return mActivityTaskManager.removeTask(taskId); } /** Removes all recent tasks that are visible. */ public void removeAllVisibleRecentTasks() throws RemoteException { ActivityTaskManager.getService().removeAllVisibleRecentTasks(); } public void dump(@NonNull PrintWriter pw, String prefix) { final String innerPrefix = prefix + " "; pw.println(prefix + TAG); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsShellCommandHandler.kt 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.recents import android.os.RemoteException import com.android.wm.shell.sysui.ShellCommandHandler.ShellCommandActionHandler import java.io.PrintWriter class RecentsShellCommandHandler( private val recentTasksController: RecentTasksController ) : ShellCommandActionHandler { override fun onShellCommand(args: Array<out String>, pw: PrintWriter): Boolean { when (args[0]) { "clearAll" -> return runClearAll(pw) else -> { pw.println("Invalid command: " + args[0]) return false } } } override fun printShellCommandHelp(pw: PrintWriter, prefix: String) { pw.println("${prefix}clearAll") pw.println("$prefix Clears all visible recent tasks.") } private fun runClearAll(pw: PrintWriter): Boolean { try { recentTasksController.removeAllVisibleRecentTasks() } catch (e: RemoteException) { pw.println("Exception while removing visible recent tasks:") e.printStackTrace(pw) return false } return true } } No newline at end of file
libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/CopyContentInSplit.kt +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.RecentTasksUtils import com.android.wm.shell.flicker.utils.SplitScreenUtils import org.junit.After import org.junit.Before Loading Loading @@ -61,7 +62,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { @After fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation) } }
libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/DismissSplitScreenByDivider.kt +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.RecentTasksUtils import com.android.wm.shell.flicker.utils.SplitScreenUtils import org.junit.After import org.junit.Before Loading Loading @@ -74,7 +75,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { @After fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation) } }
libs/WindowManager/Shell/tests/e2e/splitscreen/scenarios/src/com/android/wm/shell/scenarios/DismissSplitScreenByGoHome.kt +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.Utils import com.android.wm.shell.flicker.utils.RecentTasksUtils import com.android.wm.shell.flicker.utils.SplitScreenUtils import org.junit.After import org.junit.Before Loading Loading @@ -60,7 +61,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) { @After fun teardown() { primaryApp.exit(wmHelper) secondaryApp.exit(wmHelper) RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation) } }