First, let's take a look at the isurfacecomposer interface.
Isurfacecomposer defines the basic interface for the client to interact with the server.
The following figure shows the derived class of the isurfacecomposer interface:
------------------------------------------------------------------
Interface isurfacecomposerclient
->
Bnsurfacecomposerclient
->
Implementation class client, located in surfaceflinger. h file
------------------------------------------------------------------
Interface isurfacecomposer
->
Bnsurfacecomposer: A derived class of an isurfacecomposer interface. It provides an interface for the client to call the server function.
->
Implementation class surfaceflinger
The isurfacecomposer class contains the following member functions for establishing contact with surfaceflinger.
/* Create connection with surface flinger, requires
* Access_surface_flinger permission
*/
Virtual sp <isurfacecomposerclient> createconnection () = 0;
------------------------------------------------------------------
1. The surfacecomposerclient class contains the mclient member variable of the isurfacecomposerclient interface.
2. The surfacecontrol class contains the mclient member variable of the surfacecomposerclient type.
3. surfacecomposerclient: createsurface function. The return value type is surfacecontrol.
(1) Call the createsurface function of mclient to create a surface
Mclient-> createsurface is actually the implementation class client of the called interface isurfacecomposerclient
(2) create a surfacecontrol object and manage the surface created in (1)
(3) return the surfacecontrol object created in (2 ).
4. Create a surfacecomposerclient object
The surfacecomposerclient object is created in JNI and the corresponding file is android_view_surface.cpp. The function is surfacesession_init,
Corresponds to the init function in Java surfacesession.
{"Init", "() V", (void *) surfacesession_init },
To be continued ......