Selected from the Anatomy of Android kernel
The framework defines the client component and the server-side component functions and interfaces. Contains 3 main parts: Server side, client and Linux driver.
(a) service-side
The server consists of two major classes, Windowmanagerservice (WMS) and Activitymanagerservice (AMS). The role of the WMS is to assign Windows to all applications and manage those windows. This includes assigning window sizes, adjusting the stacking order of each window, and hiding or displaying windows. The role of AMS is to manage activity in all applications.
In addition, there are 2 message processing classes on the server side:
1) Keyq class: This class is the internal WMS class, inherits from the Keyinputqueue class, Keyq object once created, immediately start a thread, the thread will continue to read the user's UI action messages, such as keys, touch screen, trackball, mouse, etc. And put these messages into a message queue Queueevent class.
2) Inputdispatcherthread class: Once the object of this class is created, a thread is started immediately, and the thread will continuously remove the user message from the Queueevent and filter it (with the corresponding function in WMS), after filtering, These messages are then sent to the currently active client program.
(ii) client
Clients mainly include the following important classes:
1) Activitythread class: This class is the main thread class of the application, all APK programs have only one Activitythread class, and the entry of the program is the static main () function in the class.
2) Activity class: This class is a minimal running unit of the APK program, an APK program can contain multiple activity objects, and the Activitythread main class chooses which activity object to run based on the user action.
3) Phonewindow class: This class inherits from the window class, while the Phonewindow class contains a Decorview object. In short, Phonewindow is a framelayout that is packaged in a certain package and provides a common set of window-handling interfaces.
4) window class: This class provides a common set of window operations API, where the window is only at the program level, the WMS manages the window is not window class, but a view or viewgroup class, generally refers to the Decorview class, That is, a decorview is a window of all WMS management. Window is an abstract type.
5) Decorview class: This class is a subclass of Framelayout and is an inner class in Phonewindow. Decor's English is decoration, that is, the meaning of "decoration", Decorview is the ordinary framelayout has been a certain modification, such as adding a generic titlebar, and respond to specific key messages and so on.
6) Viewroot class: When the WMS manages client windows, it is necessary to notify the client to do some kind of operation, which is done by asynchronous message, the implementation is to use handler, Viewroot is inherited handler, its role is to receive WMS notifications.
7) W class: This class inherits from Binder and is an inner class of viewroot.
8) WindowManager class: The client wants to request to create a window, and the task of creating a window is done by the WMS, the WindowManager class is like a department manager who needs to tell it that it interacts with the WMS and the client cannot interact directly with the WMS.
(iii) Linux drivers
The Linux driver and the framework are related mainly to two parts, namely Surfaceflingger (SF) and binder. Each window corresponds to a surface, and the SF drive is the function of displaying each surface on the same screen.
The role of binder drivers is to provide a cross-process (IPC) messaging mechanism.
Transferred from: http://blog.sina.com.cn/s/blog_49f62c3501010aml.html
Android Framework Frames _ Goto