1 /*
2 * Copyright 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package android.hardware.display;
18
19 import static android.hardware.display.DisplayTopology.TreeNode.positionToString;
20
21 /**
22 * Graph of the displays in {@link android.hardware.display.DisplayTopology} tree.
23 *
24 * @hide
25 */
DisplayTopologyGraph(int primaryDisplayId, DisplayNode[] displayNodes)26 public record DisplayTopologyGraph(int primaryDisplayId, DisplayNode[] displayNodes) {
27 /**
28 * Display in the topology
29 */
30 public record DisplayNode(
31 int displayId,
32 int density,
33 AdjacentDisplay[] adjacentDisplays) {}
34
35 /**
36 * Edge to adjacent display
37 */
38 public record AdjacentDisplay(
39 // The logical Id of this adjacent display
40 int displayId,
41 // Side of the other display which touches this adjacent display.
42 @DisplayTopology.TreeNode.Position
43 int position,
44 // The distance from the top edge of the other display to the top edge of this display
45 // (in case of POSITION_LEFT or POSITION_RIGHT) or from the left edge of the parent
46 // display to the left edge of this display (in case of POSITION_TOP or
47 // POSITION_BOTTOM). The unit used is density-independent pixels (dp).
48 float offsetDp) {
49 @Override
50 public String toString() {
51 return "AdjacentDisplay{"
52 + "displayId=" + displayId
53 + ", position=" + positionToString(position)
54 + ", offsetDp=" + offsetDp
55 + '}';
56 }
57 }
58 }
59