diff options
Diffstat (limited to 'core/java/android/view/Display.java')
| -rw-r--r-- | core/java/android/view/Display.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index ba2509302094..821bb2516b02 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -43,7 +43,9 @@ import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; /** * Provides information about the size and density of a logical display. @@ -382,6 +384,23 @@ public final class Display { /** @hide */ public static final int COLOR_MODE_DISPLAY_P3 = 9; + /** @hide **/ + @IntDef(prefix = {"COLOR_MODE_"}, value = { + COLOR_MODE_INVALID, + COLOR_MODE_DEFAULT, + COLOR_MODE_BT601_625, + COLOR_MODE_BT601_625_UNADJUSTED, + COLOR_MODE_BT601_525, + COLOR_MODE_BT601_525_UNADJUSTED, + COLOR_MODE_BT709, + COLOR_MODE_DCI_P3, + COLOR_MODE_SRGB, + COLOR_MODE_ADOBE_RGB, + COLOR_MODE_DISPLAY_P3 + }) + @Retention(RetentionPolicy.SOURCE) + public @interface ColorMode {} + /** * Indicates that when display is removed, all its activities will be moved to the primary * display and the topmost activity should become focused. @@ -960,6 +979,37 @@ public final class Display { } /** + * Gets the supported wide color gamuts of this device. + * + * @return Supported WCG color spaces. + * @hide + */ + public @ColorMode ColorSpace[] getSupportedWideColorGamut() { + synchronized (this) { + final ColorSpace[] defaultColorSpaces = new ColorSpace[0]; + updateDisplayInfoLocked(); + if (!isWideColorGamut()) { + return defaultColorSpaces; + } + + final int[] colorModes = getSupportedColorModes(); + final List<ColorSpace> colorSpaces = new ArrayList<>(); + for (int colorMode : colorModes) { + // Refer to DisplayInfo#isWideColorGamut. + switch (colorMode) { + case COLOR_MODE_DCI_P3: + colorSpaces.add(ColorSpace.get(ColorSpace.Named.DCI_P3)); + break; + case COLOR_MODE_DISPLAY_P3: + colorSpaces.add(ColorSpace.get(ColorSpace.Named.DISPLAY_P3)); + break; + } + } + return colorSpaces.toArray(defaultColorSpaces); + } + } + + /** * Gets the app VSYNC offset, in nanoseconds. This is a positive value indicating * the phase offset of the VSYNC events provided by Choreographer relative to the * display refresh. For example, if Choreographer reports that the refresh occurred |
