Android 开机启动过程

系统启动过程:
Boot(system/core/init/Init.c)------>mounting(system/core/mountd/Mountd.c)----->androidRuntime------->dalvikvm

然后系统初始化:

系统初始的第一步是用JNI方式实现的,对应java代码为(frameworks/base/services/java/com /android/server/SystemServer.java) init1(Native)函数,对应的JNI C++代码为(frameworks/base/core/jni/server /com_android_server_SystemServer.cpp),而实现的C++代码为(frameworks/base/cmds/system_server/library/ System_init.cpp)   中的system_init()函数。
system_init调用SurfaceFlinger,SurfaceFlinger的readyToRun()函数用BootAnimation来实现开机动画。

系统初始化的第二步,将启动ServerThread进程,参见SystemServer.init2()。ServerThread将启动各种系统服务,具体参见ServerThread的run函数,ServerThread同在SystemServer.java中。

SystemServer::init2 will start a new thread to start all JAVA services as follows:

Core Services:

1.       Starting Power Manager

2.       Creating Activity Manager

3.       Starting Telephony Registry

4.       Starting Package Manager

5.       Set Activity Manager Service as System Process

6.       Starting Context Manager

7.       Starting System Context Providers

8.       Starting Battery Service

9.       Starting Alarm Manager

10.   Starting Sensor Service

11.   Starting Window Manager

12.   Starting Bluetooth Service

13.   Starting Mount Service

Other services

1.       Starting Status Bar Service

2.       Starting Hardware Service

3.       Starting NetStat Service

4.       Starting Connectivity Service

5.       Starting Notification Manager

6.       Starting DeviceStorageMonitor Service

7.       Starting Location Manager

8.       Starting Search Service

9.       Starting Clipboard Service

10.   Starting Checkin Service

11.   Starting Wallpaper Service

12.   Starting Audio Service

13.   Starting HeadsetObserver

14.   Starting AdbSettingsObserver

Finally SystemServer::init2 will call ActivityManagerService.systemReady to launch the first activity by senting Intent.CATEGORY_HOME intent.

你可能感兴趣的:(java,android,manager,service,jni,System)