平时会遇到开机时间变长问题,可以通过以下log来看:
logcat -v time -b events|grep boot
01-01 20:00:02.329 I/boot_progress_start( 1135): 4539
01-01 20:00:02.969 I/boot_progress_preload_start( 1135): 5175
01-01 20:00:05.509 I/boot_progress_preload_end( 1135): 7713
01-01 20:00:05.679 I/boot_progress_system_run( 1712): 7889
01-01 20:00:05.839 I/boot_progress_pms_start( 1712): 8040
01-01 20:00:05.879 I/boot_progress_pms_system_scan_start( 1712): 8080
01-01 20:00:10.979 I/boot_progress_pms_data_scan_start( 1712): 13182
01-01 20:00:10.979 I/boot_progress_pms_scan_end( 1712): 13182
01-01 20:00:11.139 I/boot_progress_pms_ready( 1712): 13342
01-01 20:00:25.989 I/boot_progress_ams_ready( 1712): 28190
这些都是 android 原生添加的 log,从这些log可以看到android各个阶段所需要的时间,如果跟之前比有明显增长,就需要看看到底是哪里有问题。
同时,一般造成开机时间变长,可以看看framework 中系统 service启动是否有异常:
01-02 08:00:00.189 1690 1690 I SystemServer: Power Manager
01-02 08:00:00.189 1690 1690 I SystemServer: Activity Manager
01-02 08:00:00.499 1690 1690 I SystemServer: Display Manager
01-02 08:00:00.499 1690 1690 I SystemServer: Telephony Registry
01-02 08:00:00.499 1690 1690 I SystemServer: Scheduling Policy
01-02 08:00:00.509 1690 1690 I SystemServer: Package Manager
01-02 08:00:02.989 1690 1690 I SystemServer: Entropy Mixer
01-02 08:00:02.999 1690 1690 I SystemServer: User Service
01-02 08:00:02.999 1690 1690 I SystemServer: Account Manager
01-02 08:00:03.009 1690 1690 I SystemServer: Content Manager
01-02 08:00:03.009 1690 1690 I SystemServer: System Content Providers
01-02 08:00:03.039 1690 1690 I SystemServer: Lights Service
01-02 08:00:03.039 1690 1690 I SystemServer: Battery Service
01-02 08:00:03.049 1690 1690 I SystemServer: Vibrator Service
01-02 08:00:03.049 1690 1690 I SystemServer: Consumer IR Service
01-02 08:00:03.049 1690 1690 I SystemServer: Alarm Manager
01-02 08:00:03.059 1690 1690 I SystemServer: Init Watchdog
01-02 08:00:03.059 1690 1690 I SystemServer: Input Manager
01-02 08:00:03.059 1690 1690 I SystemServer: Window Manager
01-02 08:00:03.119 1690 1690 I SystemServer: Bluetooth Manager Service
01-02 08:00:08.129 1690 1690 I SystemServer: Input Method Service
01-02 08:00:08.149 1690 1690 I SystemServer: Accessibility Manager
01-02 08:00:08.239 1690 1690 I SystemServer: Mount Service
01-02 08:00:08.249 1690 1690 I SystemServer: LockSettingsService
01-02 08:00:08.249 1690 1690 I SystemServer: Device Policy
01-02 08:00:08.249 1690 1690 I SystemServer: Status Bar
先到这里,写文章一大难事。做个记录,后面有空更新......