I use the following sequence of KeyCode commands to clear one and only one app in the recent apps menu, technically called the “application switcher dialog” in the Android KeyEvent documentation (https://developer.android.com/reference/android/view/KeyEvent):
adb shell input keyevent KEYCODE_APP_SWITCH adb shell input keyevent KEYCODE_DPAD_DOWN adb shell input keyevent KEYCODE_DEL
What I want is the ability to close multiple apps at once. Using the recent apps menu physically, I do this by tapping on the “Clear All” button.
Is there a way to simulate or initiate this action using ADB commands similar to the ones I listed above?
Please take careful note that I already know how to close or clear one app at a time. I am asking this because I’m looking for a quick way to close apps, besides repeated invocations of the above command sequence.