Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d228c25 authored by Romain Guy's avatar Romain Guy
Browse files

Expose colorimetry capabilities on Display

Test: CtsDisplayTestCases
Bug: 32984164
Change-Id: I11e6a85a27959c578eeac276ac0e2c8ab8db70bf
parent 7439b7cb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -42215,7 +42215,9 @@ package android.view {
    method public android.view.Display.Mode[] getSupportedModes();
    method public deprecated float[] getSupportedRefreshRates();
    method public deprecated int getWidth();
    method public boolean isHdr();
    method public boolean isValid();
    method public boolean isWideColorGamut();
    field public static final int DEFAULT_DISPLAY = 0; // 0x0
    field public static final int FLAG_PRESENTATION = 8; // 0x8
    field public static final int FLAG_PRIVATE = 4; // 0x4
+2 −0
Original line number Diff line number Diff line
@@ -45519,7 +45519,9 @@ package android.view {
    method public android.view.Display.Mode[] getSupportedModes();
    method public deprecated float[] getSupportedRefreshRates();
    method public deprecated int getWidth();
    method public boolean isHdr();
    method public boolean isValid();
    method public boolean isWideColorGamut();
    field public static final int DEFAULT_DISPLAY = 0; // 0x0
    field public static final int FLAG_PRESENTATION = 8; // 0x8
    field public static final int FLAG_PRIVATE = 4; // 0x4
+2 −0
Original line number Diff line number Diff line
@@ -42504,7 +42504,9 @@ package android.view {
    method public android.view.Display.Mode[] getSupportedModes();
    method public deprecated float[] getSupportedRefreshRates();
    method public deprecated int getWidth();
    method public boolean isHdr();
    method public boolean isValid();
    method public boolean isWideColorGamut();
    field public static final int DEFAULT_DISPLAY = 0; // 0x0
    field public static final int FLAG_PRESENTATION = 8; // 0x8
    field public static final int FLAG_PRIVATE = 4; // 0x4
+49 −5
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ public final class Display {
    public static final int STATE_VR = 5;

    /* The color mode constants defined below must be kept in sync with the ones in
     * system/graphics.h */
     * system/core/include/system/graphics-base.h */

    /**
     * Display color mode: The current color mode is unknown or invalid.
@@ -306,11 +306,24 @@ public final class Display {
     */
    public static final int COLOR_MODE_DEFAULT = 0;

    /**
     * Display color mode: SRGB
     * @hide
     */
    /** @hide */
    public static final int COLOR_MODE_BT601_625 = 1;
    /** @hide */
    public static final int COLOR_MODE_BT601_625_UNADJUSTED = 2;
    /** @hide */
    public static final int COLOR_MODE_BT601_525 = 3;
    /** @hide */
    public static final int COLOR_MODE_BT601_525_UNADJUSTED = 4;
    /** @hide */
    public static final int COLOR_MODE_BT709 = 5;
    /** @hide */
    public static final int COLOR_MODE_DCI_P3 = 6;
    /** @hide */
    public static final int COLOR_MODE_SRGB = 7;
    /** @hide */
    public static final int COLOR_MODE_ADOBE_RGB = 8;
    /** @hide */
    public static final int COLOR_MODE_DISPLAY_P3 = 9;

    /**
     * Internal method to create a display.
@@ -745,6 +758,8 @@ public final class Display {

    /**
     * Returns the display's HDR capabilities.
     *
     * @see #isHdr()
     */
    public HdrCapabilities getHdrCapabilities() {
        synchronized (this) {
@@ -753,6 +768,35 @@ public final class Display {
        }
    }

    /**
     * Returns whether this display supports any HDR type.
     *
     * @see #getHdrCapabilities()
     * @see HdrCapabilities#getSupportedHdrTypes()
     */
    public boolean isHdr() {
        synchronized (this) {
            updateDisplayInfoLocked();
            int[] types = mDisplayInfo.hdrCapabilities.getSupportedHdrTypes();
            return types != null && types.length > 0;
        }
    }

    /**
     * Returns whether this display can be used to display wide color gamut content.
     */
    public boolean isWideColorGamut() {
        synchronized (this) {
            updateDisplayInfoLocked();
            for (int colorMode : mDisplayInfo.supportedColorModes) {
                if (colorMode == COLOR_MODE_DCI_P3 || colorMode > COLOR_MODE_SRGB) {
                    return true;
                }
            }
            return false;
        }
    }

    /**
     * Gets the supported color modes of this device.
     * @hide