service call
Keep in mind that system services' interface aren't necessary exposed through .aidl files. In some cases, such as for the Activity Manager, the interface definitoin is hardcoded directly into a regular Java file instead of being autogenerated. And in the case of C-based system services, the Binder marshaling and unmarshaling is all done straight in C code.
Many of the commands here are located in the framework/base/cmds/ directory of the AOSP sources, though in 4.2/Jelly Bean, some of these commands have been moved to frameworks/native/cmds/
service call SERVICE CALL [i32 INT | s16 STR] Options: i32: Write the integer INT into the send parcel. s16: Write the UTF-16 string STR into the send parcel.
The interface names provided in between square brackets allow you to browse the AOSP sources to find the matching .aidl file that defines the interface.
The IStatusBarService interface definition from 4.2 :frameworks/base/core/java/com/android/internal/statusbar/IStatusBarService.aidl
Most interestlingly, you can use service call to directly invoke system services' Binder-exposed methods. In order to do that, you first need to understand that service's interface. Note that service call actually needs a method code, not a method's name. To find the codes matching the mehtod name defined the interface, you need to lookup the code generated by th aidl tool based on the interface definition.
out/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/telephony/java/com/android/internal/telephony/IPhoneSubInfo.java static final int TRANSACTION_getIsimImpu =(android.os.IBinder.FIRST_CALL_TRANSACTION + 13);
Also, note that frameworks/base/core/java/android/os/IBinder.java has the following defintion for FIRST_CALL_TRANSCATION:
int FIRST_CALL_TRANSACTION = 0x00000001;
Using system services requires writing code that interacts with the Binder-exposed API in some way, shape, or form. In some cases, however, the AOSP includes command-line utilities for directly interactins with certain system services. These utilities open the door for using many of the following utilities as part of scripts either in production or during development.
The system services' APIs are typically protected by Android's permission system, which requires apps' manifest files to declare upfront which permissions they require. Generally, a system service will check whether its caller has the appropriate permissions before going ahead and servicing the caller's request. Part of this checking will require checking the caller's PID and using the Package Manager's services to verify the originating .apk's right.
There are four types of components available to app developers: activities, services, broadcast receivers, and content providers. The first three types of components are activated through intents, and one of am's majore features is its ability to send intents straight from the command line.
am
usage: am [subcommand] [options]
start an Activity: am start [-D] [-W] <INTENT>
-D: enable debugging
-W: wait for launch to complete.
start a Service: am startservice <INTENT>
send a broadcast Intent: am broadcast <INTENT>
start an Instrumentation: am instrument [flags] <COMPONENT>
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT>
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>
-p <FILE>: writing profiling data to <FILE>
-w: wait for instrumentation to finish before returning.
start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop
start monitoring: am monitor [--gdb <port>]
--gdb: start gdbserv on the given port at carsh/ANR
<INTENT> specifications incude these flags:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e | --es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--esn <EXTRA_KEY> ...]
[--ez <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>]
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--debug-log-resolution]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-no-history]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top]
[--receiver-registered-only] [--receiver-replace-pending]
[<URI>]
svc
svc is something of a Swiss Army knife in attempting to provide you with the ability to control serveral system services
1. svc
2.svc help power
ime
The ime command lets you communicate with the Input Method system service to control the system's use of available input methods.
usage: ime list [-a] [-s]
ime enable ID
ime disable ID
ime set ID
The list command prints all enabled input methods. Use
-a option to see all input methods.
-s option to see only a single summary line of each.
The enable command allows the given input method ID to be used.
The disable command disallows the given input method ID from use.
The set command switches to the given input method ID.
stagefright -h
stagefright -a -o /sdcard/trainwhistle.mp3
dalvikvm -help
dvz
dexdump 查询apk内部可调用方法:
dexdump 这样可以看到命令提示
dexdump /system/framework/services.jar
dexdump -d /system/app/Launcher2.apk
vold
vold takes care of many of the key operatoins required by the Mount Service, such as mounting and formating volumes.
/etc/vold.fstab /system/core/rootdir/etc/vold.fstab

ndc
浙公网安备 33010602011771号