一、用法概述:
# service
service
Usage: service [-h|-?]
service list
service check SERVICE
service call SERVICE CODE [i32 INT | s16 STR] [intent] ...
Options:
i32: Write the integer INT into the send parcel.
s16: Write the UTF-16 string STR into the send parcel.
intent: Write and Intent int the send parcel. ARGS can be/n"
action=STR data=STR type=STR launchFlags=INT component=STR categories=STR[,STR,...]/n
二、详解:
1. service list
会列出本机所有正在运行的service, 如:
Found 42 services:
0 phone: [com.android.internal.telephony.ITelephony]
1 iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
2 isms: [com.android.internal.telephony.gsm.ISms]
3 simphonebook: [com.android.internal.telephony.gsm.ISimPhoneBook]
4 appwidget: [com.android.internal.appwidget.IAppWidgetService]
5 audio: [android.media.IAudioService]
6 wallpaper: [android.app.IWallpaperService]
7 checkin: [android.os.ICheckinService]
8 search: [android.app.ISearchManager]
9 location: [android.location.ILocationManager]
10 devicestoragemonitor: []
11 mount: [android.os.IMountService]
12 notification: [android.app.INotificationManager]
13 connectivity: [android.net.IConnectivityManager]
14 wifi: [android.net.wifi.IWifiManager]
15 netstat: [android.os.INetStatService]
16 input_method: [com.android.internal.view.IInputMethodManager]
17 clipboard: [android.text.IClipboard]
18 statusbar: [android.app.IStatusBar]
19 window: [android.view.IWindowManager]
20 sensor: [android.hardware.ISensorService]
21 alarm: [android.app.IAlarmManager]
22 hardware: [android.os.IHardwareService]
23 battery: []
24 content: [android.content.IContentService]
25 permission: [android.os.IPermissionController]
26 activity.providers: []
27 activity.senders: []
28 activity.services: []
29 activity.broadcasts: []
30 cpuinfo: []
31 meminfo: []
32 activity: [android.app.IActivityManager]
33 package: [android.content.pm.IPackageManager]
34 telephony.registry: [com.android.internal.telephony.ITelephonyRegistry]
35 usagestats: [com.android.internal.app.IUsageStats]
36 batteryinfo: [com.android.internal.app.IBatteryStats]
37 power: [android.os.IPowerManager]
38 SurfaceFlinger: [android.ui.ISurfaceComposer]
39 media.camera: [android.hardware.ICameraService]
40 media.player: [android.hardware.IMediaPlayerService]
41 media.audio_flinger: [android.media.IAudioFlinger]
2、service check "service name" 检查service是否存在
如:
# service check phone
Service phone: found
# service check dd
Service dd: not found
3、service call "service name" code intent ....
如:service call power 1