Relationship between Activity, Window, and View
The Android graphical user interface (graphical user Interface, referred to as GUI), follows the general rules of the Gwes (Graphics window Event System) and manages a system of user input (event management) and System screen output (window and interface Drawing).
In Android development, if you want to display an interface, you will first write a activtiy subclass, so it is understood that activity is an interface, which is quite broad. The system is responsible for creating the activity subclass written by the developer, activity creation is creating a Window object (usually Phonewindow), and a View object (Decorview) is added when the window is created. So the relationship between the three is activity---Window---View, the following is a brief description of the three main responsibilities (see the official 3 categories of related documents):
Activity: The app shows the boss of an interface and is not responsible for screen display, primarily for interacting with Android systems. window: is responsible for displaying the layout (multiple windows are displayed at the top and bottom levels, or on the upper and lower sides), display levels, event handling. View: is responsible for controlling how the specific view area and the event handling within the view area are drawn.
Second, Window System
The Windows management of Android is Client/server (c/s) mode.
Clientactivity opens a session (opens the Iwindowsession Aidl interface) and joins the window to the WindowManager via this interface
Server adds the window child to the WindowManager
Windowmanagerserviceandroid window issues to consider when designing:
Management of Window Z-order order (how Windows overlay)
Calculation of the active window and notification of its change
Window attribution (which app belongs to)
Input Method Management
Iii. window type and Hierarchy
Windowmanagerservice-Iwindow <-viewroot (View variable, token for IPC communication)
Window type, the larger the int value, the higher the display
| Window type |
How to create |
Range of values |
| application window |
Activity internal Complete Creation |
1 ~ 99 |
| child window |
Created by parent window |
1000 ~ 1999 |
| System window |
System judgment shows only one layer |
2000 ~ 2999 |
Reference: Android Core Analysis (-----) Basic architecture Principles of Windows Management for Android Gews
Android Core Analytics (-----Android gwes android window management
Anatomy of the Android Kernel Chapter 8th New Year's Day the process of creating a window chapter 14th Windowmanagerservice Working principle
Android window simply learns to organize a