Reprinted please indicate the source of this article: http://www.cnblogs.com/xl19862005
Author: xandy
CS architecture for Android
Before that, it is necessary to clarify the concepts listed in table 1 in tables.
Isurface |
Defines the basic surface interface for GUI system client (application) and server (surfaceflinger) Interaction |
Bpsurface |
An isurface derived class that provides an interface for the server to call the client function. |
Bnsurface |
Another derived class of isurface that provides interfaces for the client to call the server function. After the server receives a call request from the client (through bnsurface), such as registerbuffer and postbuffer, bnsuerface: ontransact is triggered. |
Surface |
(The private class of layerbaseclient) is the derived class of bnsurface. |
Surfacebuffer |
(Surfacebuffer's private class) is the derived class of surface. |
Isurfacecomposer |
Defines basic interfaces for client-to-server interaction |
Bpsurfacecomposer |
Is a derived class that provides an interface for the server to call the client function. |
Bnsurfacecomposer |
Is a derived class that provides the interface client to call the server function. Surfaceflinger class derived from bnsurfacecomposer |
Surfacecomposerclient |
Directly used by the client. The isurface (bnsurface), isurfacecomposer (bnsurfacecomposer), and isurfaceflingerclient interfaces are called to interact with the server. |
Bclient |
Derived from isurfaceflingerclient (bnsurfaceflingerclient), call the createsurface of the server to create a surface. Each surface corresponds to a layer. |
Egldisplay |
ID or handle displayed by the System |
Eglsurface |
System window or framebuffer handle |
Eglconfig |
EGL configuration of Surface |
Eglcontext |
OpenGL ES graphics up and down files |
Nativedisplaytype |
Native system display type |
Nativewindowtype |
Native System window cache type |
Nativepixmaptype |
Native system framebuffer |
Egl_native_window_t |
Defines a local window class. This class provides all the descriptions of the local window and all the methods used to operate the local window in EGL (OpenGL ES and the interface of the local GUI system ). |
-Table 1-Surface Related Concepts
When designing Android, Google's Gui adopts the CS architecture. It can be understood that each newly created surface (the client side is the surface, which corresponds to the layer of the Service side one by one) is a client, the service end is mainly surfaceflinger, which will independently generate a libsurfaceflinger. so library, connect to it through the service name surfaceflinger on the client side, and then use IPC (binder) to set the content of the surface, for example, buffers, format, width, and height are sent to the service. Then, the content of the corresponding surface is calculated, cut, arranged, and output in the threadloop of surfaceflinger, it involves EGL (OpenGL ES) plotting and buffer management.
The CS architecture of the android GUI system 1 shows the correspondingProgramAs shown in process 2, this part of content is included in the frameworks package, where JNI serves as a bridge between the C and C ++ layers and the Java layer.
-Figure 1-CS architecture