那么我们到底都可以dump一些什么呢?
其实最简单的办法就是执行dumpsys,看看其结果,下面是我手机中执行的结果(HTCg14)
# dumpsys
Currently running services:
DeviceManager3LM
Encryption3LMService
HtcAppUsageStatsService
SurfaceFlinger
accessibility
account
activity
alarm
appwidget
audio
backup
battery
batteryinfo
bluetooth
bluetooth_a2dp
bluetooth_hid
bt_fm_management
clipboard
connectivity
content
country_detector
cpuinfo
device_policy
devicestoragemonitor
diskstats
display
drm.drmManager
dropbox
entropy
gfxinfo
hardware
htc_checkin
htchardware
htctelephony
htctelephonyinternal
input_method
iphonesubinfo
isms
location
media.audio_flinger
media.audio_policy
media.camera
media.player
meminfo
mount
netpolicy
netstats
network_management
notification
package
permission
phone
power
samplingprofiler
search
secfirewall
secloader
sensorservice
simphonebook
sip
statusbar
stub_activity
stub_audio
stub_iphonesubinfo
stub_isms
stub_location
stub_phone
stub_telephony.registry
telephony.registry
textservices
throttle
uimode
usagestats
usb
usbnet
userbehavior
vibrator
wallpaper
wifi
wifip2p
window
-------------------------------------------------------------------------------
DUMP OF SERVICE DeviceManager3LM:
-------------------------------------------------------------------------------
DUMP OF SERVICE Encryption3LMService:
由于dump service的log实在太长,我就截取了最前面的“Currently running services”和两个Service的dump信息
为什么DeviceManager3LM和Encryption3LMService后面没有内容?这和Service的内部实现有关,也许它只是写了一个空的dump函数,也许有什么其他条件。
这个问题一会再说,我们先看看这些Service都是在哪注册的
其中大部分Service都是在SystemServer中的main函数里注册的,它调用了一个叫init2的函数
public static final void init2() {
Slog.i(TAG, "Entered the Android system server!");
Thread thr = new ServerThread();
thr.setName("android.server.ServerThread");
thr.start();
}
init2非常简单,所有任务都交给新线程ServerThread来处理