Http://raymond1860.spaces.live.com/Blog/cns! Bf47b6fd104579c9! 797. Entry 1. directory tree
/Framework/base/API
/Framework/base/AWT
/Framework/base/build
/Framework/base/camera The Hal interface library of camera. Finally, the native shared library libcamera. So is generated. during compilation, use_camera_stub is defined to determine whether the system supports camera hardware. If no actual camera hardware is available, libcamera. So will be generated at the compilation stage in conjunction with the virtual camera static library (libcamerastub. A, generated by camerahardwarestub. cpp, fakecamera.
/Framework/base/cmds commands used when the Android system is started
/Framework/base/cmds/AM
/Framework/base/cmds/app_process
The executable file app_process, which can be started based on input parameters (refer to init. in RC, the Statement service zygote/system/bin/app_process-xzygote/system/bin -- zygote -- start-system-server ).
The program will link libandroid_runtime.so to Android runtime. I will analyze this part in detail later.
/Framework/base/cmds/backup
Executable program btool
/Framework/base/cmds/bmgr
Java executable programs, backup manager, and Java libraries are distributed to the target system/framework/bmgr. Jar
/Framework/base/cmds/bootanimation
Android starts the animation effect program, which must run after Android runtime starts.
/Framework/base/cmds/dumpstate
Android system debugging auxiliary tool, generate executable program dumpstate, and create two programs dumpcrash bugreport pointing to this program.
/Framework/base/cmds/dumpsys
Generate executable dumpsys
/Framework/base/cmds/ime
Java executable program, IME Input Method Manager, And the Java library is distributed to the target system/framework/ime. Jar
/Framework/base/cmds/Input
Java executable program, management of input events such as key event, text event, etc., distribution to the target system in the form of Java Library/system/framework/input. Jar
/Framework/base/cmds/installd
The executable program installd and install manager is only run in a non-Simulator System and installed to the target system/bin/installd.
/Framework/base/cmds/keystore
The executable program keystore. Purpose ??? Run only in a non-Simulator System and install it on the target system/bin/keystore.
/Framework/base/cmds/PM
Java executable program, package manager, and Java library are distributed to the target system/framework/PM. Jar
/Framework/base/cmds/Runtime
Runtime executable program, used only in Simulator
/Framework/base/cmds/service
Service executable program, used to find, check, call service, install to target system/bin/service
/Framework/base/cmds/servicemanager
Android System Service Manager, executable file, installed to the target system/bin/servicemanager
Servicemanager works with the binder driver of the kernel to add, query, obtain, and check services.
/Framework/base/cmds/surfaceflinger
Surfaceflinger executable program, installed to the target system/bin/surfaceflinger,
This program initializes surfaceflinger, surfaceflinger: inistantiate (), and the program will link to libsurfaceflinger. So
/Framework/base/cmds/svc
/Framework/base/cmds/system_server
System server library libsystem_server.so-> system/lib/libsystem_server.so and system_server executable programs-> system/bin/system_server.
What is the purpose of the executable program ????
/Framework/CORE/
/Framework/CORE/config
Several simple Java constants (debug flag, etc)
/Framework/CORE/Java /*
Framewor K core, which mainly refers to application framework, which is distributed to/system/framework/
Including framework. jar, framework-tests.jar sure ???
/Framework/CORE/JNI
The JNI interface implementation library required by the Framework is distributed to/system/lib/libandroid_runtime.so.
/Framework/CORE/Res
Package the resource files required by framework,/system/framework/framework-res.apk,
/Framework/libs
/Framework/libs/audioflinger, Generate libaudioflinger. So, If there is no actual hardware or static library libaudiointerface. A (audio interface Virtual Device) link.
If the actual hardware is connected to libaudio. So, if Bluetooth is supported, it is connected to liba2dp. So.
/Framework/libs/surfaceflinger
Generate libsurfaceflinger. So
/Framework/libs/UI
Generate libui. So
/Framework/libs/utils
Generate libutils. So
/Framework/services/Java /*
System Server Java executable program service. jar, which is distributed to/system/framework/service. Jar
/Framework/services/JNI /*
System server JNI interface implementation library, libanroid_servers.so, distributed to/system/lib/libanroid_servers.so
Start zygote
-Xzygote/system/bin -- zygote -- start-system-Server
Androidruntime-> appruntime
Int main (INT argc, const char * const argv [])
{
Appruntime runtime; generates an androidruntime instance
...
Androidruntime. Start ("com. Android. Internal. OS. zygoteinit", startsystemserver );
}
Androidruntime. Start ("com. Android. Internal. OS. zygoteinit", startsystemserver );
Call Android: Start (const char * classname, const bool startsystemserver)
/Framework/base/CORE/JNI/androidruntime. cpp
Processing content of this function: 1. process some Parameter options of Jave virtual machine;
2. Create a Dalvik Java Vm, jni_createjavavm (& mjavavm, & ENV, & initargs );
3. register the JNI interface in Android runtime to the virtual machine;
4. Call the main function of Java class com. Android. Internal. OS. zygoteinit
In the main function of COM. Android. Internal. OS. zygoteinit,
1. Register zygote socket to receive requests;
2. Load the preloaded class‑resourcesto accelerate the startup speed. The files are stored in the preloaded-classes,framework-res.apk's res in framework.jar;
3. Start System server;
Fork generates an independent process named system-server and calls the main function of the COM. Android. server. systemserver class;
In the handlesystemserverprocess function, runtimeinit. zygoteinit calls the onzygoteinit function of appruntime.
4. The runtimeinit. zygoteinit function calls the main function of the COM. Android. server. systemserver class.
In this main function, the system first loads the android_server shared library libandroid_server.so source code in/framework/base/service/JNI
The jni_onload function is defined in this library. Therefore, Dalvik calls the jni_onload function when loading libandroid_server.so. This function registers the android server to the Java Virtual Machine, including keyinputqueue, hardwareservice, alarmmanager, batteryservice, sensorservice, and systemserver;
Call the native function init1 registered in libanroid_server.so, which is located in/frameworks/base/services/JNI/com_android_server_systemserver.cpp;
The init1 function calls the system_init function in libsystem_server, which is located in/frameworks/base/cmds/system_server/library/system_init.cpp, this function registers surfaceflinger/audioflinger/mediaplayer/cameraservice and other components to servicemanager.
The system_init function calls the init2 function of Java class com. Android. server. systemserver;
5. In the init2 function, Android creates a serverthread in which Android starts to register various services to the Service Manager.
Including entropyservice, powermanager, activitymanager, telephony, packagemanager, contentmanager, contentprovider, Batteryservice, hardwareservice, and alarmmanager.
Note that this thread uses logoff to execute the thread
So far, the android system server has been started.
|