Framework framework for Android kernel analysis

The Framework framework consists of 3 main parts, server side, client side, Linux driver

The server side mainly includes the following two main classes:

  • AMS (ActivityManagerService), the main function of AMS is to manage each Activity.
  • WMS (WindowManagerService), WMS mainly manages the stacking order, hiding and display of each window.

The client mainly includes the following aspects:

  • ActivityThread: ActivityThread is the UI thread (main thread). The entry of each APP is in the main function of ActivityThread, and the Handler of the main thread will be generated in the main function of ActivityThread.
  • Activity -> ContextThemeWraper -> ContextWrapper -> Context, inheritance relationship. The invocation of various methods in ContextWrapper is actually the method in ContexImpl that is called, because ContexImpl is the only implementation of Context. The ContextWrapper constructor will pass in a Context object, which is actually ContextImpl, which adopts the decoration mode.
  • Window, the base class for all windows.
  • PhoneWindow inherits from Window, and PhoneWindow is the only implementation of Window. PhoneWindow defines an inner class DecorView, DecorView is the root node of all Views.
  • ViewRoot, ViewRoot inherits from Handler. When Wms manages the window, it needs to notify the client to perform certain operations. These are called through IPC. After the client receives the IPC call, it converts the call into a local asynchronous operation. , the way of implementation is to use ViewRoot, its function is to convert the IPC call of WMS into a local asynchronous call.
  • Class W: This class inherits from Binder and is an inner class of ViewRoot. When WMS notifies the client window, it is called through IPC, and the IPC call will use IBinder, so the W class is the Binder that interacts with the WMS. When the WMS information is obtained, it is transmitted to the client through the Handler.
  • WindowManager: It is responsible for interacting with WMS.

Linux driver: The main parts related to Linux driver and FrameWork mainly include two aspects, namely SurfaceFlingger and Binder. Each window corresponds to a Surface, and the Binder driver is responsible for IPC messaging.

  • List content

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324809265&siteId=291194637