用 adb 模拟 "Clearing the back stack"

Simulate "Clearing the back stack" with adb

来自android指南Tasks and Back Stack

Clearing the back stack

If the user leaves a task for a long time, the system clears the task of all activities except the root activity. When the user returns to the task again, only the root activity is restored.

如何用 adb 命令模拟这个? 我想这并不完全是杀死应用程序(比如调用: adb shell am kill < package name >

谢谢。

If the user leaves a task for a long time, the system clears the task of all activities except the root activity.

因此,这是完全相同的行为,当系统需要分配资源但它没有空闲 RAM 时,它会开始终止进程​​以获取内存。要模拟您可以执行此命令:

adb shell am send-trim-memory com.your.package MODERATE