pm 可以执行程序
1|m891a:/ # which pm
/system/bin/pm
m891a:/ # cat /system/bin/pm
#!/system/bin/sh
cmd package "$@"
m891a:/ #
源码位置:AOSP/frameworks/base/cmds/*
cmd文件位置:AOSP/frameworks/native/cmds/cmd/cmd.cpp
if ((argc == 2) && (strcmp(argv[1], "-l") == 0)) {
Vector<String16> services = sm->listServices();
services.sort(sort_func);
aout << "Currently running services:" << endl;
for (size_t i=0; i<services.size(); i++) {
sp<IBinder> service = sm->checkService(services[i]);
if (service != NULL) {
aout << " " << services[i] << endl;
}
}
return 0;
}
可以使用cmd -l
列出所有服务
接下来会调用Package manager (package) commands
127|m891a:/ # cmd package
Package manager (package) commands:
help
Print this help text.
path [--user USER_ID] PACKAGE
Print the path to the .apk of the given PACKAGE.
dump PACKAGE
Print various system state associated with the given PACKAGE.
list features
Prints all features of the system.
......