从ADB/Shell命令模拟强制停止

Dev*_*red 11 shell android adb

有没有使用当前的命令行工具(一种方式adb,am,pm)来模拟用户从设置应用压力停止?kill <pid>从shell 调用只能模拟系统杀死进程时发生的事情,但Force Stop通过删除ActivityRecordAndroid保存的实例来删除应用程序的内存.

我们可以调用shell命令来模拟这种相同的行为吗?

干杯.

Die*_*ano 24

使用:

am force-stop: force stop everything associated with <PACKAGE>.

am kill: Kill all processes associated with <PACKAGE>.  Only kills.
  processes that are safe to kill -- that is, will not impact the user
  experience.
Run Code Online (Sandbox Code Playgroud)

例如:

adb shell am force-stop <PACKAGE>
Run Code Online (Sandbox Code Playgroud)