diff options
| -rw-r--r-- | core/api/test-current.txt | 8 | ||||
| -rw-r--r-- | core/java/android/hardware/display/DisplayManager.java | 2 | ||||
| -rw-r--r-- | core/java/android/hardware/display/DisplayTopology.java | 37 |
3 files changed, 47 insertions, 0 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 0b0738ee14dc..c60a2d451ab3 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -1722,6 +1722,7 @@ package android.hardware.display { public final class DisplayManager { method public boolean areUserDisabledHdrTypesAllowed(); method @RequiresPermission(android.Manifest.permission.MODIFY_USER_PREFERRED_DISPLAY_MODE) public void clearGlobalUserPreferredDisplayMode(); + method @FlaggedApi("com.android.server.display.feature.flags.display_topology") @Nullable @RequiresPermission("android.permission.MANAGE_DISPLAYS") public android.hardware.display.DisplayTopology getDisplayTopology(); method @Nullable public android.view.Display.Mode getGlobalUserPreferredDisplayMode(); method @NonNull public android.hardware.display.HdrConversionMode getHdrConversionModeSetting(); method @NonNull public int[] getSupportedHdrOutputTypes(); @@ -1747,6 +1748,13 @@ package android.hardware.display { field public static final int VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH = 64; // 0x40 } + @FlaggedApi("com.android.server.display.feature.flags.display_topology") public final class DisplayTopology implements android.os.Parcelable { + method public int describeContents(); + method @NonNull public android.util.SparseArray<android.graphics.RectF> getAbsoluteBounds(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.DisplayTopology> CREATOR; + } + } package android.hardware.fingerprint { diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java index a96de4b050a3..fded88212127 100644 --- a/core/java/android/hardware/display/DisplayManager.java +++ b/core/java/android/hardware/display/DisplayManager.java @@ -1873,6 +1873,8 @@ public final class DisplayManager { */ @RequiresPermission(MANAGE_DISPLAYS) @Nullable + @TestApi + @FlaggedApi(Flags.FLAG_DISPLAY_TOPOLOGY) public DisplayTopology getDisplayTopology() { return mGlobal.getDisplayTopology(); } diff --git a/core/java/android/hardware/display/DisplayTopology.java b/core/java/android/hardware/display/DisplayTopology.java index 785a0e0adc48..4ed0fc056e7d 100644 --- a/core/java/android/hardware/display/DisplayTopology.java +++ b/core/java/android/hardware/display/DisplayTopology.java @@ -21,8 +21,10 @@ import static android.hardware.display.DisplayTopology.TreeNode.POSITION_LEFT; import static android.hardware.display.DisplayTopology.TreeNode.POSITION_RIGHT; import static android.hardware.display.DisplayTopology.TreeNode.POSITION_TOP; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.Nullable; +import android.annotation.TestApi; import android.graphics.PointF; import android.graphics.RectF; import android.os.Parcel; @@ -39,6 +41,7 @@ import android.view.Display; import androidx.annotation.NonNull; import com.android.internal.annotations.VisibleForTesting; +import com.android.server.display.feature.flags.Flags; import java.io.PrintWriter; import java.io.StringWriter; @@ -59,6 +62,8 @@ import java.util.Queue; * * @hide */ +@TestApi +@FlaggedApi(Flags.FLAG_DISPLAY_TOPOLOGY) public final class DisplayTopology implements Parcelable { private static final String TAG = "DisplayTopology"; private static final float EPSILON = 0.0001f; @@ -82,6 +87,7 @@ public final class DisplayTopology implements Parcelable { * @param px The value in logical pixels * @param dpi The logical density of the display * @return The value in density-independent pixels + * @hide */ public static float pxToDp(float px, int dpi) { return px * DisplayMetrics.DENSITY_DEFAULT / dpi; @@ -91,6 +97,7 @@ public final class DisplayTopology implements Parcelable { * @param dp The value in density-independent pixels * @param dpi The logical density of the display * @return The value in logical pixels + * @hide */ public static float dpToPx(float dp, int dpi) { return dp * dpi / DisplayMetrics.DENSITY_DEFAULT; @@ -108,8 +115,14 @@ public final class DisplayTopology implements Parcelable { */ private int mPrimaryDisplayId = Display.INVALID_DISPLAY; + /** + * @hide + */ public DisplayTopology() {} + /** + * @hide + */ public DisplayTopology(@Nullable TreeNode root, int primaryDisplayId) { mRoot = root; if (mRoot != null) { @@ -124,15 +137,24 @@ public final class DisplayTopology implements Parcelable { mPrimaryDisplayId = primaryDisplayId; } + /** + * @hide + */ public DisplayTopology(Parcel source) { this(source.readTypedObject(TreeNode.CREATOR), source.readInt()); } + /** + * @hide + */ @Nullable public TreeNode getRoot() { return mRoot; } + /** + * @hide + */ public int getPrimaryDisplayId() { return mPrimaryDisplayId; } @@ -144,6 +166,7 @@ public final class DisplayTopology implements Parcelable { * @param displayId The logical display ID * @param width The width of the display * @param height The height of the display + * @hide */ public void addDisplay(int displayId, float width, float height) { addDisplay(displayId, width, height, /* shouldLog= */ true); @@ -155,6 +178,7 @@ public final class DisplayTopology implements Parcelable { * @param width The new width * @param height The new height * @return True if the topology has changed. + * @hide */ public boolean updateDisplay(int displayId, float width, float height) { TreeNode display = findDisplay(displayId, mRoot); @@ -178,6 +202,7 @@ public final class DisplayTopology implements Parcelable { * one by one. * @param displayId The logical display ID * @return True if the display was present in the topology and removed. + * @hide */ public boolean removeDisplay(int displayId) { if (findDisplay(displayId, mRoot) == null) { @@ -221,6 +246,7 @@ public final class DisplayTopology implements Parcelable { * are the display IDs. * @throws IllegalArgumentException if the keys in {@code positions} are not the exact display * IDs in this topology, no more, no less + * @hide */ public void rearrange(Map<Integer, PointF> newPos) { if (mRoot == null) { @@ -346,6 +372,7 @@ public final class DisplayTopology implements Parcelable { /** * Clamp offsets and remove any overlaps between displays. + * @hide */ public void normalize() { if (mRoot == null) { @@ -494,6 +521,7 @@ public final class DisplayTopology implements Parcelable { /** * @return A deep copy of the topology that will not be modified by the system. + * @hide */ public DisplayTopology copy() { TreeNode rootCopy = mRoot == null ? null : mRoot.copy(); @@ -505,6 +533,7 @@ public final class DisplayTopology implements Parcelable { * (0, 0). * @return Map from logical display ID to the display's absolute bounds */ + @NonNull public SparseArray<RectF> getAbsoluteBounds() { Map<TreeNode, RectF> bounds = new HashMap<>(); getInfo(bounds, /* depths= */ null, /* parents= */ null, mRoot, /* x= */ 0, /* y= */ 0, @@ -529,6 +558,7 @@ public final class DisplayTopology implements Parcelable { /** * Print the object's state and debug information into the given stream. + * @hide * @param pw The stream to dump information to. */ public void dump(PrintWriter pw) { @@ -629,6 +659,9 @@ public final class DisplayTopology implements Parcelable { return result; } + /** + * @hide + */ @Nullable public static TreeNode findDisplay(int displayId, @Nullable TreeNode startingNode) { if (startingNode == null) { @@ -725,6 +758,7 @@ public final class DisplayTopology implements Parcelable { * @param densityPerDisplay The logical display densities, indexed by logical display ID * @return The graph representation of the topology. If there is a corner adjacency, the same * display will appear twice in the list of adjacent displays with both possible placements. + * @hide */ @Nullable public DisplayTopologyGraph getGraph(SparseIntArray densityPerDisplay) { @@ -839,6 +873,9 @@ public final class DisplayTopology implements Parcelable { } } + /** + * @hide + */ public static final class TreeNode implements Parcelable { public static final int POSITION_LEFT = 0; public static final int POSITION_TOP = 1; |