adb shell命令整理之service

service可给Android 服务传消息,具体用法如下:

Usage: service [-h|-?] 
       service list 
       service check SERVICE 
       service call SERVICE CODE [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.

在Android 4.2.2模拟器上运行如下命令:

adb shell service list

Found 70 services:
0       sip: [android.net.sip.ISipService]
1       phone: [com.android.internal.telephony.ITelephony]
2       iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
3       simphonebook: [com.android.internal.telephony.IIccPhoneBook]
4       isms: [com.android.internal.telephony.ISms]
5       dreams: [android.service.dreams.IDreamManager]
6       commontime_management: []
7       samplingprofiler: []
8       diskstats: []
9       appwidget: [com.android.internal.appwidget.IAppWidgetService]
10      backup: [android.app.backup.IBackupManager]
11      uimode: [android.app.IUiModeManager]
12      serial: [android.hardware.ISerialManager]
13      usb: [android.hardware.usb.IUsbManager]
14      audio: [android.media.IAudioService]
15      wallpaper: [android.app.IWallpaperManager]
16      dropbox: [com.android.internal.os.IDropBoxManagerService]
17      search: [android.app.ISearchManager]
18      country_detector: [android.location.ICountryDetector]
19      location: [android.location.ILocationManager]
20      devicestoragemonitor: []
21      notification: [android.app.INotificationManager]
22      updatelock: [android.os.IUpdateLock]
23      throttle: [android.net.IThrottleManager]
24      servicediscovery: [android.net.nsd.INsdManager]
25      connectivity: [android.net.IConnectivityManager]
26      wifi: [android.net.wifi.IWifiManager]
27      wifip2p: [android.net.wifi.p2p.IWifiP2pManager]
28      netpolicy: [android.net.INetworkPolicyManager]
29      netstats: [android.net.INetworkStatsService]
30      textservices: [com.android.internal.textservice.ITextServicesManager]
31      network_management: [android.os.INetworkManagementService]
32      clipboard: [android.content.IClipboard]
33      statusbar: [com.android.internal.statusbar.IStatusBarService]
34      device_policy: [android.app.admin.IDevicePolicyManager]
35      lock_settings: [com.android.internal.widget.ILockSettings]
36      mount: [IMountService]
37      accessibility: [android.view.accessibility.IAccessibilityManager]
38      input_method: [com.android.internal.view.IInputMethodManager]
39      bluetooth_manager: [android.bluetooth.IBluetoothManager]
40      input: [android.hardware.input.IInputManager]
41      window: [android.view.IWindowManager]
42      alarm: [android.app.IAlarmManager]
43      vibrator: [android.os.IVibratorService]
44      battery: []
45      hardware: [android.os.IHardwareService]
46      content: [android.content.IContentService]
47      account: [android.accounts.IAccountManager]
48      user: [android.os.IUserManager]
49      permission: [android.os.IPermissionController]
50      cpuinfo: []
51      dbinfo: []
52      gfxinfo: []
53      meminfo: []
54      activity: [android.app.IActivityManager]
55      package: [android.content.pm.IPackageManager]
56      media.audio_policy: [android.media.IAudioPolicyService]
57      scheduling_policy: [android.os.ISchedulingPolicyService]
58      telephony.registry: [com.android.internal.telephony.ITelephonyRegistry]
59      display: [android.hardware.display.IDisplayManager]
60      usagestats: [com.android.internal.app.IUsageStats]
61      batteryinfo: [com.android.internal.app.IBatteryStats]
62      power: [android.os.IPowerManager]
63      entropy: []
64      sensorservice: [android.gui.SensorServer]
65      media.camera: [android.hardware.ICameraService]
66      media.player: [android.media.IMediaPlayerService]
67      media.audio_flinger: [android.media.IAudioFlinger]
68      SurfaceFlinger: [android.ui.ISurfaceComposer]
69      drm.drmManager: [drm.IDrmManagerService]

envsetup.sh中揭示了几条未揭露的adb shell命令:

1.绑定port启动ViewServer
adb shell service call window 1 i32 $port

2.停止ViewServer
adb shell service call window 2

3.检查ViewServer是否正在运行
adb shell service call window 3

4.按home键(详见KeyEvent.java中的定义)
adb shell input keyevent 3

5.按back键
adb shell input keyevent 4

6.按menu键
adb shell input keyevent 82

7.ViewRootImpl.java
设置系统属性“viewancestor.profile_rendering”为true能强制当前窗口以60 HZ渲染。它可用作度量潜在帧率。

8.显示fps
dumpsys gfxinfo activity_name

adb shell service call SurfaceFlinger 1013 来源见SurfaceFlinger.cpp中函数onTransact的switch片段,使用见surface_stats_collector.py

你可能感兴趣的:(Android)