reference to : http://blog.csdn.net/wangkaiblog/article/details/46050587java
原本覺得存放在/systen/bin/下的monkey、input、am等adb shell命令都是二進制可執行程,偶爾cat input下,發現不是二進制文件,內容以下:android
# Script to start "input" on the device, which has a very rudimentary # shell. # base=/system export CLASSPATH=$base/framework/input.jar exec app_process $base/bin com.android.commands.input.Input $*
這段腳本的做用就是經過app_process工具啓動放在/system/farmework/下的input.jar 文件。我查看了下framework文件夾裏面的確有input.jar文件。shell
What is this app_process
Although not that popular 「app_process」 command is used heavily in Android, for example the well know 「am」 script is using it. Everybody knows how to start an application from adb shell:
am start -n yourpackagename/.activityname
However 「am」 is just a shell script and what stays in the base of the am script is our app_process binary:
app
root@android:/ # cat /system/bin/am cat /system/bin/am # Script to start "am" on the device, which has a very rudimentary # shell. base=/system export CLASSPATH=$base/framework/am.jar exec app_process $base/bin com.android.commands.am.Am "$@" root@android:/ #
So app_process is the binary used to start java code. All the apps, instrumentations or installations are tarted using this.工具
Lets see the official usage output:
ui
root@android:/ # app_process Usage: app_process [java-options] cmd-dir start-class-name [options] Not quite complete as usual :)