Android Window、WindowManager、WMS

1. WindowWindow

From the start of an app to the display of the main window, several modules such as app, AMS, WMS, and SurfaceFlinger (SF) need to cooperate with each other. The app is responsible for business logic and draws its own view; AMS manages components, process information, and the stack and status of the Activity; WMS manages the windows, sub-windows, and system windows corresponding to the Activity (that is, controls the combined layout between ViewRoots); SF It is used to manage the graphics buffer, and render the things drawn by the app (that is, ViewRoot) synthetically on the screen.

In Android, what is really shown to the user is not Activity, but Window and View. The role of Activity is to deal with some logical issues, such as life cycle management and window creation.

View cannot exist alone, it must be attached to the abstract concept of Window. Each Window corresponds to a View and a ViewRootImpl. Window and View are connected through ViewRootImpl, so where there is a view, there is a Window, such as Activity, Dialog, Toast, etc. Explain that View is an entity that exists in Window, and Window is the direct manager of the actual view. In actual use, the Window cannot be accessed directly, and the access to the Window must pass through the WindowManager.

Android windows are divided into three types:

①System Window: Designed by the system, it can exist independently and is not attached to any application window, such as the status bar (Status Bar), navigation bar (Navigation Bar), wallpaper (Wallpaper), caller display window (Phone) , lock screen window (KeyGuard), information prompt window (Toast), volume adjustment window, mouse cursor, etc.

②Sub Window: such as application-defined dialog box or input method window, the sub-window must be attached to an application window (set the same token).

③Application window (Application Wi

Guess you like

Origin blog.csdn.net/zenmela2011/article/details/129177377