首页 > 代码库 > Android 系统启动不起原因查找

Android 系统启动不起原因查找

我们遇到Android系统开机界面(bootanimation)后,系统没法运行起来的问题,

系统一直出现 waiting for ...日志

似乎在等什么服务启动

因此怀疑system server 被block了

调试方法如下:

1. adb shell mkdir /data/anr/

2. adb shell ps | grep system_server


system    1138  234   908376 39440 ffffffff 40061a54 S system_server


3.  adb shell kill -3 1138


4. adb shell pull /data/anr/trace.txt


----- pid 1138 at 2014-01-01 08:40:42 -----
Cmd line: system_server


JNI: CheckJNI is off; workarounds are off; pins=1; globals=289


DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)


"main" prio=5 tid=1 MONITOR
  | group="main" sCount=1 dsCount=0 obj=0x4159ee58 self=0x414be920
  | sysTid=1138 nice=-2 sched=0/0 cgrp=apps handle=1073963348
  | state=S schedstat=( 6367457522 242583118 5270 ) utm=595 stm=41 core=0
  at com.android.server.am.ActivityManagerService.registerReceiver(ActivityManagerService.java:~13106)


  - waiting to lock <0x41965278> (a com.android.server.am.ActivityManagerService) held by tid=27 (InputDispatcher)


  at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1458)
  at android.app.ContextImpl.registerReceiverAsUser(ContextImpl.java:1433)
  at android.content.pm.RegisteredServicesCache.<init>(RegisteredServicesCache.java:134)
  at android.content.SyncAdaptersCache.<init>(SyncAdaptersCache.java:43)
  at com.android.server.content.SyncManager.<init>(SyncManager.java:399)
  at com.android.server.content.ContentService.getSyncManager(ContentService.java:75)
  at com.android.server.content.ContentService.notifyChange(ContentService.java:283)
  at android.content.ContentResolver.notifyChange(ContentResolver.java:1621)
  at com.android.providers.settings.SettingsProvider.sendNotify(SettingsProvider.java:262)
  at com.android.providers.settings.SettingsProvider.insertForUser(SettingsProvider.java:941)
  at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:645)
  at android.content.ContentProvider$Transport.call(ContentProvider.java:325)
  at android.provider.Settings$NameValueCache.putStringForUser(Settings.java:903)
  at android.provider.Settings$System.putStringForUser(Settings.java:1169)
  at android.provider.Settings$System.putIntForUser(Settings.java:1274)
  at android.provider.Settings$System.putInt(Settings.java:1268)

可以清晰的看到调用堆栈,是谁阻塞了system_server 的运行。





Android 系统启动不起原因查找