每个手机可以有多个屏幕, 一个屏幕是一个displaycont, 下面从displaycont开始, 看下层级结构是如何构建的
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: java.lang.RuntimeException: jinyanmeiWMS
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayAreaPolicyBuilder$Feature.(DisplayAreaPolicyBuilder.java:666)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayAreaPolicyBuilder$Feature.(DisplayAreaPolicyBuilder.java:0)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayAreaPolicyBuilder$Feature$Builder.build(DisplayAreaPolicyBuilder.java:813)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayAreaPolicy$DefaultProvider.configureTrustedHierarchyBuilder(DisplayAreaPolicy.java:131)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayAreaPolicy$DefaultProvider.instantiate(DisplayAreaPolicy.java:113)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayContent.configureSurfaces(DisplayContent.java:1307)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.DisplayContent.(DisplayContent.java:1209)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.RootWindowContainer.setWindowManager(RootWindowContainer.java:1273)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.wm.ActivityTaskManagerService.setWindowManager(ActivityTaskManagerService.java:1040)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.am.ActivityManagerService.setWindowManager(ActivityManagerService.java:2052)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.SystemServer.startOtherServices(SystemServer.java:1615)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.SystemServer.run(SystemServer.java:942)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.server.SystemServer.main(SystemServer.java:664)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at java.lang.reflect.Method.invoke(Native Method)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
02-02 19:55:04.258 3530 3530 V jinyanmeiWMS: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
构造displayContent
DisplayContent.java
DisplayContent(Display display, RootWindowContainer root,
@NonNull DeviceStateController deviceStateController) {
final Transaction pendingTransaction = getPendingTransaction();
configureSurfaces(pendingTransaction);
pendingTransaction.apply();
}
DisplayContent.java
private void configureSurfaces(Transaction transaction) {
final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession)
.setOpaque(true)
.setContainerLayer()
.setCallsite("DisplayContent");
mSurfaceControl = b.setName(getName()).setContainerLayer().build();
if (mDisplayAreaPolicy == null) {
// Setup the policy and build the display area hierarchy.
// Build the hierarchy only after creating the surface so it is reparented correctly
mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate(
mWmService, this /* content */, this /* root */,
mImeWindowsContainer);
}
final List> areas =
mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION);
构建DisplayArea
DisplayAreaPolicy.java
/** Provider for platform-default display area policy. */
static final class DefaultProvider implements DisplayAreaPolicy.Provider {
@Override
public DisplayAreaPolicy instantiate(WindowManagerService wmService,
DisplayContent content, RootDisplayArea root,
DisplayArea.Tokens imeContainer) {
final TaskDisplayArea defaultTaskDisplayArea = new TaskDisplayArea(content, wmService,
"DefaultTaskDisplayArea", FEATURE_DEFAULT_TASK_CONTAINER);
final List tdaList = new ArrayList();
tdaList.add(defaultTaskDisplayArea);
// Define the features that will be supported under the root of the whole logical
// display. The policy will build the DisplayArea hierarchy based on this.
final HierarchyBuilder rootHierarchy = new HierarchyBuilder(root);
// Set the essential containers (even if the display doesn't support IME).
rootHierarchy.setImeContainer(imeContainer).setTaskDisplayAreas(tdaList);
if (content.isTrusted()) {
// Only trusted display can have system decorations.
configureTrustedHierarchyBuilder(rootHierarchy, wmService, content);
}
// Instantiate the policy with the hierarchy defined above. This will create and attach
// all the necessary DisplayAreas to the root.
return new DisplayAreaPolicyBuilder().setRootHierarchy(rootHierarchy).build(wmService);
}
这个函数又分为3步
1. 初始化DefaultTaskDisplayArea
final TaskDisplayArea defaultTaskDisplayArea = new TaskDisplayArea(content, wmService,
"DefaultTaskDisplayArea", FEATURE_DEFAULT_TASK_CONTAINER);
生成一个list, 将刚生成的defaultTaskDisplayArea 加进入, 并且设置到HierarchyBuilder的list中
final List tdaList = new ArrayList();
tdaList.add(defaultTaskDisplayArea);
TaskDisplayArea(DisplayContent displayContent, WindowManagerService service, String name,
int displayAreaFeature, boolean createdByOrganizer,
boolean canHostHomeTask) {
super(service, Type.ANY, name, displayAreaFeature);
mDisplayContent = displayContent;
mRootWindowContainer = service.mRoot;
mAtmService = service.mAtmService;
mCreatedByOrganizer = createdByOrganizer;
mCanHostHomeTask = canHostHomeTask;
}
2.初始化HierarchyBuilder
DisplayAreaPolicyBuilder.java
static class HierarchyBuilder {
private static final int LEAF_TYPE_TASK_CONTAINERS = 1;
private static final int LEAF_TYPE_IME_CONTAINERS = 2;
private static final int LEAF_TYPE_TOKENS = 0;
private final RootDisplayArea mRoot;
private final ArrayList mFeatures = new ArrayList();
private final ArrayList mTaskDisplayAreas = new ArrayList();
HierarchyBuilder(RootDisplayArea root) {
mRoot = root;
}
这里的root是 DisplayCont
然后调用 rootHierarchy.setImeContainer(imeContainer).setTaskDisplayAreas(tdaList);
HierarchyBuilder里面有一个两个List
其中一个存储TaskDisplayArea对象, 虽然是list,但是目前TaskDisplayArea只在这里被创建,即目前一个DisplayContent只有一个名为“DefaultTaskDisplayArea”的TaskDisplayArea。
另外一个存储Feature
DisplayAreaPolicyBuilder.HierarchyBuilder.java
HierarchyBuilder setTaskDisplayAreas(List taskDisplayAreas) {
mTaskDisplayAreas.clear();
mTaskDisplayAreas.addAll(taskDisplayAreas);
return this;
}
3.为HierarchyBuilder添加Feature
static final class DefaultProvider implements DisplayAreaPolicy.Provider {
private void configureTrustedHierarchyBuilder(HierarchyBuilder rootHierarchy,
WindowManagerService wmService, DisplayContent content) {
// WindowedMagnification should be on the top so that there is only one surface
// to be magnified.
rootHierarchy.addFeature(new Feature.Builder(wmService.mPolicy, "WindowedMagnification",
FEATURE_WINDOWED_MAGNIFICATION)
.upTo(TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY)
.except(TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY)
// Make the DA dimmable so that the magnify window also mirrors the dim layer.
.setNewDisplayAreaSupplier(DisplayArea.Dimmable::new)
.build());
if (content.isDefaultDisplay) {
// Only default display can have cutout.
// See LocalDisplayAdapter.LocalDisplayDevice#getDisplayDeviceInfoLocked.
rootHierarchy.addFeature(new Feature.Builder(wmService.mPolicy, "HideDisplayCutout",
FEATURE_HIDE_DISPLAY_CUTOUT)
.all()
.except(TYPE_NAVIGATION_BAR, TYPE_NAVIGATION_BAR_PANEL, TYPE_STATUS_BAR,
TYPE_NOTIFICATION_SHADE)
.build())
.addFeature(new Feature.Builder(wmService.mPolicy, "OneHanded",
FEATURE_ONE_HANDED)
.all()
.except(TYPE_NAVIGATION_BAR, TYPE_NAVIGATION_BAR_PANEL,
TYPE_SECURE_SYSTEM_OVERLAY)
.build());
}
rootHierarchy
.addFeature(new Feature.Builder(wmService.mPolicy, "FullscreenMagnification",
FEATURE_FULLSCREEN_MAGNIFICATION)
.all()
.except(TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY, TYPE_INPUT_METHOD,
TYPE_INPUT_METHOD_DIALOG, TYPE_MAGNIFICATION_OVERLAY,
TYPE_NAVIGATION_BAR, TYPE_NAVIGATION_BAR_PANEL)
.build())
.addFeature(new Feature.Builder(wmService.mPolicy, "ImePlaceholder",
FEATURE_IME_PLACEHOLDER)
.and(TYPE_INPUT_METHOD, TYPE_INPUT_METHOD_DIALOG)
.build());
}
可以看到分为两种情况, 默认屏幕要多三中Feature
下面来看Feature是如何构造的
static class Builder {
private final WindowManagerPolicy mPolicy;
private final String mName;
private final int mId;
private final boolean[] mLayers;
private NewDisplayAreaSupplier mNewDisplayAreaSupplier = DisplayArea::new;
private boolean mExcludeRoundedCorner = true;
Builder(WindowManagerPolicy policy, String name, int id) {
mPolicy = policy;
mName = name;
mId = id;
mLayers = new boolean[mPolicy.getMaxWindowLayer() + 1];
}
首先Feature代表的是DisplayArea的一个特征,可以根据Feature来对不同的DisplayArea进行划分。
它的成员变量 有:
mName,很好理解,这个Feature的名字,如上面的“WindowedMagnification”,“HideDisplayCutout”之类的,后续DisplayArea层级结构建立起来后,每个DisplayArea的名字用的就是当前DisplayArea对应的那个Feature的名字。
mId,Feature的ID,如上面的FEATURE_WINDOWED_MAGNIFICATION和FEATURE_HIDE_DISPLAY_CUTOUT,虽说是Feature的ID,因为Feature又是DisplayArea的特征,所以这个ID也可以直接代表DisplayArea的一种特征。
mWindowLayers,代表了这个DisplayArea可以包含哪些层级对应的窗口,后续会分析到。
mNewDisplayAreaSupplier
rootHierarchy.addFeature(new Feature.Builder(wmService.mPolicy, "WindowedMagnification",
FEATURE_WINDOWED_MAGNIFICATION)
.upTo(TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY)
.except(TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY)
// Make the DA dimmable so that the magnify window also mirrors the dim layer.
.setNewDisplayAreaSupplier(DisplayArea.Dimmable::new)
.build());
/**
* Set that the feature applies window types that are layerd at or below the layer of
* the given window type.
*/
Builder upTo(int typeInclusive) {
final int max = layerFromType(typeInclusive, false);
for (int i = 0; i
返回32, 首先将[0, 31] = true, 然后将32改为true;
mLayers[0, 32] = true;
Builder except(int... types) {
for (int i = 0; i
except 是[32]设置为false
所以综合结果就是[0, 31]= true;其他都是false;
default int getWindowLayerFromTypeLw(int type, boolean canAddInternalSystemWindow,
boolean roundedCornerOverlay) {
// Always put the rounded corner layer to the top most.
if (roundedCornerOverlay && canAddInternalSystemWindow) {
return getMaxWindowLayer();
}
if (type >= FIRST_APPLICATION_WINDOW && type
02-02 19:55:04.254 3530 3530 D jinyanmeiWMS: mName:WindowedMagnification
02-02 19:55:04.254 3530 3530 D jinyanmeiWMS: mId:4
02-02 19:55:04.254 3530 3530 D jinyanmeiWMS: mWindowLayers[0]:true
02-02 19:55:04.254 3530 3530 D jinyanmeiWMS: mWindowLayers[1]:true
02-02 19:55:04.254 3530 3530 D jinyanmeiWMS: mWindowLayers[2]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[3]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[4]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[5]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[6]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[7]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[8]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[9]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[10]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[11]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[12]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[13]:true
02-02 19:55:04.255 3530 3530 D jinyanmeiWMS: mWindowLayers[14]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[15]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[16]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[17]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[18]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[19]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[20]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[21]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[22]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[23]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[24]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[25]:true
02-02 19:55:04.256 3530 3530 D jinyanmeiWMS: mWindowLayers[26]:true
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[27]:true
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[28]:true
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[29]:true
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[30]:true
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[31]:true
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[32]:false
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[33]:false
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[34]:false
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[35]:false
02-02 19:55:04.257 3530 3530 D jinyanmeiWMS: mWindowLayers[36]:false
02-02 19:55:04.271 3530 3530 D jinyanmeiWMS: mName:HideDisplayCutout
02-02 19:55:04.271 3530 3530 D jinyanmeiWMS: mId:6
02-02 19:55:04.271 3530 3530 D jinyanmeiWMS: mWindowLayers[0]:true
02-02 19:55:04.271 3530 3530 D jinyanmeiWMS: mWindowLayers[1]:true
02-02 19:55:04.271 3530 3530 D jinyanmeiWMS: mWindowLayers[2]:true
02-02 19:55:04.271 3530 3530 D jinyanmeiWMS: mWindowLayers[3]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[4]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[5]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[6]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[7]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[8]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[9]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[10]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[11]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[12]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[13]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[14]:true
02-02 19:55:04.272 3530 3530 D jinyanmeiWMS: mWindowLayers[15]:false
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[16]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[17]:false
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[18]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[19]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[20]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[21]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[22]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[23]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[24]:false
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[25]:false
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[26]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[27]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[28]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[29]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[30]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[31]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[32]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[33]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[34]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[35]:true
02-02 19:55:04.273 3530 3530 D jinyanmeiWMS: mWindowLayers[36]:false
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mName:OneHanded
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mId:3
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[0]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[1]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[2]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[3]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[4]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[5]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[6]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[7]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[8]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[9]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[10]:true
02-02 19:55:04.282 3530 3530 D jinyanmeiWMS: mWindowLayers[11]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[12]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[13]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[14]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[15]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[16]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[17]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[18]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[19]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[20]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[21]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[22]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[23]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[24]:false
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[25]:false
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[26]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[27]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[28]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[29]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[30]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[31]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[32]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[33]:false
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[34]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[35]:true
02-02 19:55:04.283 3530 3530 D jinyanmeiWMS: mWindowLayers[36]:false
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mName:FullscreenMagnification
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mId:5
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[0]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[1]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[2]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[3]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[4]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[5]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[6]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[7]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[8]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[9]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[10]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[11]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[12]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[13]:false
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[14]:false
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[15]:true
02-02 19:55:04.291 3530 3530 D jinyanmeiWMS: mWindowLayers[16]:true
02-02 19:55:04.291 3530 3530 D ji服务器托管网nyanmeiWMS: mWindowLayers[17]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[18]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[19]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[20]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[21]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[22]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[23]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[24]:false
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[25]:false
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[26]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[27]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[28]:false
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[29]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[30]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[31]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[32]:false
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[33]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[34]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[35]:true
02-02 19:55:04.292 3530 3530 D jinyanmeiWMS: mWindowLayers[36]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mName:ImePlaceholder
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mId:7
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[0]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[1]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[2]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[3]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[4]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[5]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[6]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[7]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[8]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[9]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[10]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[11]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[12]:false
02-02 19:55:04.296 3530 3530 D jinyanmeiWMS: mWindowLayers[13]:true
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[14]:true
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[15]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[16]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[17]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[18]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[19]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[20]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[21]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[22]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[23]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[24]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[25]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[26]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[27]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[28]:false
02-02 19:55:04.297 3530 3530 D jinyanmeiWMS: mWindowLayers[29]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[30]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[31]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[32]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[33]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[34]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[35]:false
02-02 19:55:04.298 3530 3530 D jinyanmeiWMS: mWindowLayers[36]:false
4. 生成DisplayArea层级结构
Result build(WindowManagerService wmService) {
validate();
Slog.v("jinyanmeiWMS", "DisplayAreaPolicyBuilder wmService " + wmService, new RuntimeException("jinyanmeiWMS"));
// Attach DA group roots to screen hierarchy before adding windows to group hierarchies.
mRootHierarchyBuilder.build(mDisplayAreaGroupHierarchyBuilders);
List displayAreaGroupRoots = new ArrayList(
mDisplayAreaGroupHierarchyBuilders.size());
for (int i = 0; i
private void build(@Nullable List displayAreaGroupHierarchyBuilders) {
final WindowManagerPolicy policy = mRoot.mWmService.mPolicy;
final int maxWindowLayerCount = policy.getMaxWindowLayer() + 1;
final DisplayArea.Tokens[] displayAreaForLayer =
new DisplayArea.Tokens[maxWindowLayerCount];
final Map>> featureAreas =
new ArrayMap(mFeatures.size());
Slog.v("jinyanmeiWMS", "DisplayAreaPolicyBuilder maxWindowLayerCount " + maxWindowLayerCount);
Slog.v("jinyanmeiWMS", "DisplayAreaPolicyBuilder build " , new RuntimeException("jinyanmeiWMS"));
for (int i = 0; i ());
}
// This method constructs the layer hierarchy with the following properties:
// (1) Every feature maps to a set of DisplayAreas
// (2) After adding a window, for every feature the window's type belongs to,
// it is a descendant of one of the corresponding DisplayAreas of the feature.
// (3) Z-order is maintained, i.e. if z-range(area) denotes the set of layers of windows
// within a DisplayArea:
// for every pair of DisplayArea siblings (a,b), where a is below b, it holds that
// max(z-range(a))
void instantiateChildren(DisplayArea parent, DisplayArea.Tokens[] areaForLayer,
int level, Map>> areas) {
mChildren.sort(Comparator.comparingInt(pendingArea -> pendingArea.mMinLayer));
Slog.v("jinyanmeiWMS", "instantiateChildren ===============");
Slog.v("jinyanmeiWMS", "instantiateChildren mChildren:" + mChildren.size());
Slog.v("jinyanmeiWMS", "instantiateChildren level:" + level);
for (int i = 0; i
private void build(@Nullable List displayAreaGroupHierarchyBuilders) {
final WindowManagerPolicy policy = mRoot.mWmService.mPolicy;
final int maxWindowLayerCount = policy.getMaxWindowLayer() + 1;
final DisplayArea.Tokens[] displayAreaForLayer =
new DisplayArea.Tokens[maxWindowLayerCount];
final Map>> featureAreas =
new ArrayMap(mFeatures.size());
Slog.v("jinyanmeiWMS", "DisplayAreaPolicyBuilder maxWindowLayerCount " + maxWindowLayerCount);
Slog.v("jinyanmeiWMS", "DisplayAreaPolicyBuilder build " , new RuntimeException("jinyanmeiWMS"));
for (int i = 0; i ());
}
// This method constructs the layer hierarchy with the following properties:
// (1) Every feature maps to a set of DisplayAreas
// (2) After adding a window, for every feature the window's type belongs to,
// it is a descendant of one of the corresponding DisplayAreas of the feature.
// (3) Z-order is maintained, i.e. if z-range(area) denotes the set of layers of windows
// within a DisplayArea:
// for every pair of DisplayArea siblings (a,b), where a is below b, it holds that
// max(z-range(a))
instantiateChildren
912
913 void instantiateChildren(DisplayArea parent, DisplayArea.Tokens[] areaForLayer,
914 int level, Map>> areas) {
915 mChildren.sort(Comparator.comparingInt(pendingArea -> pendingArea.mMinLayer));
916 for (int i = 0; i
把child排下序
为每个chanild创建DisplayArea
933 private DisplayArea createArea(DisplayArea parent,
934 DisplayArea.Tokens[] areaForLayer) {
935 if (mExisting != null) {
936 if (mExisting.asTokens() != null) {
937 // Store the WindowToken container for layers
938 fillAreaForLayers(mExisting.asTokens(), areaForLayer);
939 }
940 return mExisting;
941 }
942 if (mSkipTokens) {
943 return null;
944 }
945 DisplayArea.Type type;
946 if (mMinLayer > APPLICATION_LAYER) {
947 type = DisplayArea.Type.ABOVE_TASKS;
948 } else if (mMaxLayer
可见DisplayArea的type有三种
806 enum Type {
807 /** Can only contain WindowTokens above the APPLICATION_LAYER. */
808 ABOVE_TASKS,
809 /** Can only contain WindowTokens below the APPLICATION_LAYER. */
810 BELOW_TASKS,
811 /** Can contain anything. */
812 ANY;
最终生成的结果
ACTIVITY MANAGER CONTAINERS (dumpsys activity containers) ROOT type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Display 0 name="内置屏幕" type=undefined mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][1080,2520] bounds=[0,0][1080,2520] #2 Leaf:36:36 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 WindowToken{ff2bc0c type=2024 android.os.BinderProxy@d75fb5e} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 79280a4 ScreenDecorOverlayBottom type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowToken{47c8650 type=2024 android.os.BinderProxy@89ac4d} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 337f28b ScreenDecorOverlay type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 HideDisplayCutout:32:35 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #2 OneHanded:34:35 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:34:35 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:34:35 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 FullscreenMagnification:33:33 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:33:33 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 OneHanded:32:32 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:32:32 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowedMagnification:0:31 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #6 HideDisplayCutout:26:31 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 OneHanded:26:31 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #2 FullscreenMagnification:29:31 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:29:31 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 Leaf:28:28 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:26:27 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:26:27 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #5 Leaf:24:25 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowToken{952a908 type=2019 android.os.BinderProxy@a354bf0} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 5eb9120 NavigationBar0 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #4 HideDisplayCutout:18:23 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 OneHanded:18:23 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:18:23 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:18:23 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #3 OneHanded:17:17 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:17:17 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:17:17 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowToken{202d499 type=2040 android.os.BinderProxy@a12c812} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 a5624f8 NotificationShade type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #2 HideDisplayCutout:16:16 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 OneHanded:16:16 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:16:16 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:16:16 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 OneHanded:15:15 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:15:15 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:15:15 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowToken{f0e38b1 type=2000 android.os.BinderProxy@1cac2ca} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 aa3cc0f StatusBar type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 HideDisplayCutout:0:14 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 OneHanded:0:14 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 ImePlaceholder:13:14 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 ImeContainer type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowToken{b203378 type=2011 android.os.Binder@9e803bf} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 11ef791 InputMethod type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 FullscreenMagnification:0:12 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #2 Leaf:3:12 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WindowToken{6efb42e type=2038 android.os.BinderProxy@6fbe96e} type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 f4310ea ShellDropTarget type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 DefaultTaskDisplayArea type=undefined mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 Task=1 type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] 服务器托管网 #0 Task=12 type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 ActivityRecord{e467dfb u0 com.android.launcher3/.uioverrides.QuickstepLauncher t12} type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 25021f4 com.android.launcher3/com.android.launcher3.uioverrides.QuickstepLauncher type=home mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Task=2 type=undefined mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #1 Task=4 type=undefined mode=multi-window override-mode=multi-window requested-bounds=[0,2160][1916,3240] bounds=[0,2160][1916,3240] #0 Task=3 type=undefined mode=multi-window override-mode=multi-window requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 Leaf:0:1 type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 WallpaperWindowToken{eeb8545 token=android.os.Binder@8f58d8e} type=undefined mode=fullscreen override-mode=fullscreen requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520] #0 75b90fe com.android.systemui.wallpapers.ImageWallpaper type=undefined mode=fullscreen override-mode=undefined requested-bounds=[0,0][0,0] bounds=[0,0][1080,2520]
-
DisplayArea层级结构中的每一个DisplayArea,都包含着一个层级值范围,这个层级值范围表明了这个DisplayArea可以容纳哪些类型的窗口。
-
然后在addWindow时候就可以根据对应的窗口的类型把widnow放在合适的位置上了, 可以参考
-
Android14 WMS-添加窗口的过程-CSDN博客
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: Apache Doris 如何基于自增列满足高效字典编码等典型场景需求
自增列(auto_increment)是数据库中常见的一项功能,它提供一种方便高效的方式为行分配唯一标识符,极大简化数据管理的复杂性。当新行插入到表中时,数据库系统会自动选取自增序列中的下一个可用值,并将其分配给指定的列,无需用户手动干预。这种自动化的机制不仅…