Loading core/java/android/hardware/display/DisplayTopology.java +6 −1 Original line number Diff line number Diff line Loading @@ -835,10 +835,15 @@ public final class DisplayTopology implements Parcelable { */ @NonNull public Map<Integer, TreeNode> allNodesIdMap() { var pend = new ArrayDeque<TreeNode>(); var found = new HashMap<Integer, TreeNode>(); if (mRoot == null) { return found; } var pend = new ArrayDeque<TreeNode>(); pend.push(mRoot); do { TreeNode node = pend.pop(); found.put(node.mDisplayId, node); Loading core/tests/coretests/src/android/hardware/display/DisplayTopologyTest.kt +13 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ class DisplayTopologyTest { assertThat(topology.primaryDisplayId).isEqualTo(displayId) verifyDisplay(topology.root!!, displayId, width, height, density, noOfChildren = 0) assertThat(topology.allNodesIdMap()) .isEqualTo(mapOf(displayId to topology.root!!)) } @Test Loading @@ -62,9 +65,13 @@ class DisplayTopologyTest { assertThat(topology.primaryDisplayId).isEqualTo(displayId1) val display1 = topology.root!! val display2 = display1.children[0] verifyDisplay(display1, displayId1, width1, height1, density, noOfChildren = 1) verifyDisplay(display1.children[0], displayId2, width2, height2, density, POSITION_TOP, verifyDisplay(display2, displayId2, width2, height2, density, POSITION_TOP, offset = width1 / 2f - width2 / 2f, noOfChildren = 0) assertThat(topology.allNodesIdMap()) .isEqualTo(mapOf(displayId1 to display1, displayId2 to display2)) } @Test Loading Loading @@ -1141,6 +1148,11 @@ class DisplayTopologyTest { } } @Test fun allNodesIdMap_nullRoot() { assertThat(topology.allNodesIdMap()).isEmpty() } data class DisplayArrangement(val logicalWidth: Int, val logicalHeight: Int, val logicalDensity: Int, val arrangeX: Float, val arrangeY: Float) Loading Loading
core/java/android/hardware/display/DisplayTopology.java +6 −1 Original line number Diff line number Diff line Loading @@ -835,10 +835,15 @@ public final class DisplayTopology implements Parcelable { */ @NonNull public Map<Integer, TreeNode> allNodesIdMap() { var pend = new ArrayDeque<TreeNode>(); var found = new HashMap<Integer, TreeNode>(); if (mRoot == null) { return found; } var pend = new ArrayDeque<TreeNode>(); pend.push(mRoot); do { TreeNode node = pend.pop(); found.put(node.mDisplayId, node); Loading
core/tests/coretests/src/android/hardware/display/DisplayTopologyTest.kt +13 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ class DisplayTopologyTest { assertThat(topology.primaryDisplayId).isEqualTo(displayId) verifyDisplay(topology.root!!, displayId, width, height, density, noOfChildren = 0) assertThat(topology.allNodesIdMap()) .isEqualTo(mapOf(displayId to topology.root!!)) } @Test Loading @@ -62,9 +65,13 @@ class DisplayTopologyTest { assertThat(topology.primaryDisplayId).isEqualTo(displayId1) val display1 = topology.root!! val display2 = display1.children[0] verifyDisplay(display1, displayId1, width1, height1, density, noOfChildren = 1) verifyDisplay(display1.children[0], displayId2, width2, height2, density, POSITION_TOP, verifyDisplay(display2, displayId2, width2, height2, density, POSITION_TOP, offset = width1 / 2f - width2 / 2f, noOfChildren = 0) assertThat(topology.allNodesIdMap()) .isEqualTo(mapOf(displayId1 to display1, displayId2 to display2)) } @Test Loading Loading @@ -1141,6 +1148,11 @@ class DisplayTopologyTest { } } @Test fun allNodesIdMap_nullRoot() { assertThat(topology.allNodesIdMap()).isEmpty() } data class DisplayArrangement(val logicalWidth: Int, val logicalHeight: Int, val logicalDensity: Int, val arrangeX: Float, val arrangeY: Float) Loading