diff options
author | Marin Shalamanov <shalamanov@google.com> | 2021-02-22 18:28:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-02-22 18:28:27 +0000 |
commit | 1b520a6d3f38d2bc6c288fde8fb76e65efd98cbc (patch) | |
tree | 49994dc599d1837c01c91baf80778896380809cc /core/java | |
parent | 1c74818f30450346135777fd9f54de865655a9b9 (diff) | |
parent | 463ad8ee22fecc4e0f53757c618c5e77239f6467 (diff) |
Merge "Introduce DynamicDisplayInfo" into sc-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/view/SurfaceControl.java | 134 |
1 files changed, 78 insertions, 56 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 66b9617714a6..7d049d09a677 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -68,6 +68,7 @@ import java.lang.ref.WeakReference; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; +import java.util.Arrays; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -161,25 +162,21 @@ public final class SurfaceControl implements Parcelable { int L, int T, int R, int B); private static native void nativeSetDisplaySize(long transactionObj, IBinder displayToken, int width, int height); - private static native DisplayInfo nativeGetDisplayInfo(IBinder displayToken); - private static native DisplayMode[] nativeGetDisplayModes( - IBinder displayToken); + private static native StaticDisplayInfo nativeGetStaticDisplayInfo(IBinder displayToken); + private static native DynamicDisplayInfo nativeGetDynamicDisplayInfo(IBinder displayToken); private static native DisplayedContentSamplingAttributes nativeGetDisplayedContentSamplingAttributes(IBinder displayToken); private static native boolean nativeSetDisplayedContentSamplingEnabled(IBinder displayToken, boolean enable, int componentMask, int maxFrames); private static native DisplayedContentSample nativeGetDisplayedContentSample( IBinder displayToken, long numFrames, long timestamp); - private static native int nativeGetActiveDisplayMode(IBinder displayToken); private static native boolean nativeSetDesiredDisplayModeSpecs(IBinder displayToken, DesiredDisplayModeSpecs desiredDisplayModeSpecs); private static native DesiredDisplayModeSpecs nativeGetDesiredDisplayModeSpecs(IBinder displayToken); - private static native int[] nativeGetDisplayColorModes(IBinder displayToken); private static native DisplayPrimaries nativeGetDisplayNativePrimaries( IBinder displayToken); private static native int[] nativeGetCompositionDataspaces(); - private static native int nativeGetActiveColorMode(IBinder displayToken); private static native boolean nativeSetActiveColorMode(IBinder displayToken, int colorMode); private static native void nativeSetAutoLowLatencyMode(IBinder displayToken, boolean on); @@ -191,8 +188,6 @@ public final class SurfaceControl implements Parcelable { private static native void nativeReparent(long transactionObj, long nativeObject, long newParentNativeObject); - private static native Display.HdrCapabilities nativeGetHdrCapabilities(IBinder displayToken); - private static native boolean nativeGetAutoLowLatencyModeSupport(IBinder displayToken); private static native boolean nativeGetGameContentTypeSupport(IBinder displayToken); @@ -1707,7 +1702,7 @@ public final class SurfaceControl implements Parcelable { * * @hide */ - public static final class DisplayInfo { + public static final class StaticDisplayInfo { public boolean isInternal; public float density; public boolean secure; @@ -1715,7 +1710,7 @@ public final class SurfaceControl implements Parcelable { @Override public String toString() { - return "DisplayInfo{isInternal=" + isInternal + return "StaticDisplayInfo{isInternal=" + isInternal + ", density=" + density + ", secure=" + secure + ", deviceProductInfo=" + deviceProductInfo + "}"; @@ -1725,7 +1720,7 @@ public final class SurfaceControl implements Parcelable { public boolean equals(@Nullable Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - DisplayInfo that = (DisplayInfo) o; + StaticDisplayInfo that = (StaticDisplayInfo) o; return isInternal == that.isInternal && density == that.density && secure == that.secure @@ -1739,6 +1734,49 @@ public final class SurfaceControl implements Parcelable { } /** + * Dynamic information about physical display. + * + * @hide + */ + public static final class DynamicDisplayInfo { + public DisplayMode[] supportedDisplayModes; + public int activeDisplayModeId; + + public int[] supportedColorModes; + public int activeColorMode; + + public Display.HdrCapabilities hdrCapabilities; + + @Override + public String toString() { + return "DynamicDisplayInfo{" + + "supportedDisplayModes=" + Arrays.toString(supportedDisplayModes) + + ", activeDisplayModeId=" + activeDisplayModeId + + ", supportedColorModes=" + Arrays.toString(supportedColorModes) + + ", activeColorMode=" + activeColorMode + + ", hdrCapabilities=" + hdrCapabilities + "}"; + } + + @Override + public boolean equals(@Nullable Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DynamicDisplayInfo that = (DynamicDisplayInfo) o; + return Arrays.equals(supportedDisplayModes, that.supportedDisplayModes) + && activeDisplayModeId == that.activeDisplayModeId + && Arrays.equals(supportedColorModes, that.supportedColorModes) + && activeColorMode == that.activeColorMode + && Objects.equals(hdrCapabilities, that.hdrCapabilities); + } + + @Override + public int hashCode() { + return Objects.hash(supportedDisplayModes, activeDisplayModeId, activeDisplayModeId, + activeColorMode, hdrCapabilities); + } + } + + /** * Configuration supported by physical display. * * @hide @@ -1749,6 +1787,7 @@ public final class SurfaceControl implements Parcelable { */ public static final int INVALID_DISPLAY_MODE_ID = -1; + public int id; public int width; public int height; public float xDpi; @@ -1768,7 +1807,8 @@ public final class SurfaceControl implements Parcelable { @Override public String toString() { - return "DisplayConfig{width=" + width + return "DisplayMode{id=" + id + + ", width=" + width + ", height=" + height + ", xDpi=" + xDpi + ", yDpi=" + yDpi @@ -1777,46 +1817,58 @@ public final class SurfaceControl implements Parcelable { + ", presentationDeadlineNanos=" + presentationDeadlineNanos + ", group=" + group + "}"; } - } - /** - * @hide - */ - public static void setDisplayPowerMode(IBinder displayToken, int mode) { - if (displayToken == null) { - throw new IllegalArgumentException("displayToken must not be null"); + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DisplayMode that = (DisplayMode) o; + return id == that.id + && width == that.width + && height == that.height + && Float.compare(that.xDpi, xDpi) == 0 + && Float.compare(that.yDpi, yDpi) == 0 + && Float.compare(that.refreshRate, refreshRate) == 0 + && appVsyncOffsetNanos == that.appVsyncOffsetNanos + && presentationDeadlineNanos == that.presentationDeadlineNanos + && group == that.group; + } + + @Override + public int hashCode() { + return Objects.hash(id, width, height, xDpi, yDpi, refreshRate, appVsyncOffsetNanos, + presentationDeadlineNanos, group); } - nativeSetDisplayPowerMode(displayToken, mode); } /** * @hide */ - public static SurfaceControl.DisplayInfo getDisplayInfo(IBinder displayToken) { + public static void setDisplayPowerMode(IBinder displayToken, int mode) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - return nativeGetDisplayInfo(displayToken); + nativeSetDisplayPowerMode(displayToken, mode); } /** * @hide */ - public static DisplayMode[] getDisplayModes(IBinder displayToken) { + public static StaticDisplayInfo getStaticDisplayInfo(IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - return nativeGetDisplayModes(displayToken); + return nativeGetStaticDisplayInfo(displayToken); } /** * @hide */ - public static int getActiveDisplayMode(IBinder displayToken) { + public static DynamicDisplayInfo getDynamicDisplayInfo(IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); } - return nativeGetActiveDisplayMode(displayToken); + return nativeGetDynamicDisplayInfo(displayToken); } /** @@ -1978,16 +2030,6 @@ public final class SurfaceControl implements Parcelable { } /** - * @hide - */ - public static int[] getDisplayColorModes(IBinder displayToken) { - if (displayToken == null) { - throw new IllegalArgumentException("displayToken must not be null"); - } - return nativeGetDisplayColorModes(displayToken); - } - - /** * Color coordinates in CIE1931 XYZ color space * * @hide @@ -2057,16 +2099,6 @@ public final class SurfaceControl implements Parcelable { /** * @hide */ - public static int getActiveColorMode(IBinder displayToken) { - if (displayToken == null) { - throw new IllegalArgumentException("displayToken must not be null"); - } - return nativeGetActiveColorMode(displayToken); - } - - /** - * @hide - */ public static boolean setActiveColorMode(IBinder displayToken, int colorMode) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); @@ -2169,16 +2201,6 @@ public final class SurfaceControl implements Parcelable { /** * @hide */ - public static Display.HdrCapabilities getHdrCapabilities(IBinder displayToken) { - if (displayToken == null) { - throw new IllegalArgumentException("displayToken must not be null"); - } - return nativeGetHdrCapabilities(displayToken); - } - - /** - * @hide - */ public static boolean getAutoLowLatencyModeSupport(IBinder displayToken) { if (displayToken == null) { throw new IllegalArgumentException("displayToken must not be null"); |