manager: Use AM instead of Monkey to start the app. (#1614)

Using Monkey will unlock the rotation, and possibly more unintended
behavior.
link: [ADB shell monkey command changing device orientation
lock](https://stackoverflow.com/q/56684778)
This commit is contained in:
ice
2024-04-11 13:30:06 +08:00
committed by GitHub
parent 582e81d5af
commit 6aa0e4cf28

View File

@@ -366,11 +366,11 @@ fun launchApp(packageName: String) {
val shell = getRootShell()
val result =
shell.newJob().add("monkey -p $packageName -c android.intent.category.LAUNCHER 1").exec()
shell.newJob().add("cmd package resolve-activity --brief $packageName | tail -n 1 | xargs cmd activity start-activity -n").exec()
Log.i(TAG, "launch $packageName result: $result")
}
fun restartApp(packageName: String) {
forceStopApp(packageName)
launchApp(packageName)
}
}