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

Commit 20eee1cd authored by Kriti Dang's avatar Kriti Dang
Browse files

Make getHdrConversionMode public API.

Bug: 268336142
Test: atest HdrConversionTest
Change-Id: I93f97a3f511817155fab0e751b762327aee0975a
parent fbc06111
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -19530,6 +19530,7 @@ package android.hardware.display {
    method public android.view.Display getDisplay(int);
    method public android.view.Display[] getDisplays();
    method public android.view.Display[] getDisplays(String);
    method @NonNull public android.hardware.display.HdrConversionMode getHdrConversionMode();
    method public int getMatchContentFrameRateUserPreference();
    method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
    method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
@@ -19551,6 +19552,20 @@ package android.hardware.display {
    method public void onDisplayRemoved(int);
  }
  public final class HdrConversionMode implements android.os.Parcelable {
    ctor public HdrConversionMode(int, int);
    ctor public HdrConversionMode(int);
    method public int describeContents();
    method public int getConversionMode();
    method public int getPreferredHdrOutputType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.HdrConversionMode> CREATOR;
    field public static final int HDR_CONVERSION_FORCE = 3; // 0x3
    field public static final int HDR_CONVERSION_PASSTHROUGH = 1; // 0x1
    field public static final int HDR_CONVERSION_SYSTEM = 2; // 0x2
    field public static final int HDR_CONVERSION_UNSUPPORTED = 0; // 0x0
  }
  public final class VirtualDisplay {
    method public android.view.Display getDisplay();
    method public android.view.Surface getSurface();
+0 −14
Original line number Diff line number Diff line
@@ -1416,7 +1416,6 @@ package android.hardware.display {
    method public boolean areUserDisabledHdrTypesAllowed();
    method @RequiresPermission(android.Manifest.permission.MODIFY_USER_PREFERRED_DISPLAY_MODE) public void clearGlobalUserPreferredDisplayMode();
    method @Nullable public android.view.Display.Mode getGlobalUserPreferredDisplayMode();
    method @NonNull public android.hardware.display.HdrConversionMode getHdrConversionMode();
    method @NonNull public android.hardware.display.HdrConversionMode getHdrConversionModeSetting();
    method @NonNull public int[] getSupportedHdrOutputTypes();
    method @NonNull public int[] getUserDisabledHdrTypes();
@@ -1438,19 +1437,6 @@ package android.hardware.display {
    field public static final int VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 512; // 0x200
  }

  public final class HdrConversionMode implements android.os.Parcelable {
    ctor public HdrConversionMode(int, int);
    ctor public HdrConversionMode(int);
    method public int describeContents();
    method public int getConversionMode();
    method public int getPreferredHdrOutputType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.HdrConversionMode> CREATOR;
    field public static final int HDR_CONVERSION_FORCE = 3; // 0x3
    field public static final int HDR_CONVERSION_PASSTHROUGH = 1; // 0x1
    field public static final int HDR_CONVERSION_SYSTEM = 2; // 0x2
  }

}

package android.hardware.fingerprint {
+6 −9
Original line number Diff line number Diff line
@@ -1441,17 +1441,14 @@ public final class DisplayManager {

    /**
     * Returns the {@link HdrConversionMode} of the device, which is set by the user.

     *
     * When {@link HdrConversionMode#getConversionMode} is
     * {@link HdrConversionMode#HDR_CONVERSION_SYSTEM}, the
     * {@link HdrConversionMode#getPreferredHdrOutputType} depicts the systemPreferredHdrOutputType.
     * The HDR conversion mode chosen by user which considers the app override is returned. Apps can
     * override HDR conversion using
     * {@link android.view.WindowManager.LayoutParams#disableHdrConversion}.
     *
     * @see #setHdrConversionMode
     * @see #getSupportedHdrOutputTypes
     * @see #getHdrConversionModeSetting()
     * @hide
     * {@link android.view.WindowManager.LayoutParams#setHdrConversionEnabled(boolean)}.
     */
    @TestApi
    @NonNull
    public HdrConversionMode getHdrConversionMode() {
        return mGlobal.getHdrConversionMode();
@@ -1465,7 +1462,7 @@ public final class DisplayManager {
     *
     * @see #setHdrConversionMode
     * @see #getSupportedHdrOutputTypes
     * @see #getHdrConversionMode()
     * @see #getHdrConversionMode
     * @hide
     */
    @TestApi
+23 −15
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.hardware.display;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.Display;
@@ -35,17 +34,22 @@ import java.lang.annotation.RetentionPolicy;
 * <p>
 * HDR conversion mode has a conversionMode and preferredHdrOutputType. </p><p>
 * The conversionMode can be one of:
 * HDR_CONVERSION_PASSSTHROUGH : HDR conversion is disabled. The output HDR type will change
 * dynamically to match the content. In this mode, preferredHdrOutputType should not be set.
 * HDR_CONVERSION_AUTO: The output HDR type is selected by the implementation. In this mode,
 * preferredHdrOutputType should not be set.
 * HDR_CONVERSION_FORCE : The implementation converts all content to this HDR type, when possible.
 * {@link HdrConversionMode#HDR_CONVERSION_UNSUPPORTED} : HDR conversion is unsupported. In this
 * mode, preferredHdrOutputType should not be set.
 * {@link HdrConversionMode#HDR_CONVERSION_PASSTHROUGH} : HDR conversion is disabled. The output HDR
 * type will change dynamically to match the content. In this mode, preferredHdrOutputType should
 * not be set.
 * {@link HdrConversionMode#HDR_CONVERSION_SYSTEM}: The output HDR type is selected by the
 * implementation. In this mode, preferredHdrOutputType will be the mode preferred by the system
 * when querying. However, it should be set to HDR_TYPE_INVALID when setting the mode.
 * {@link HdrConversionMode#HDR_CONVERSION_FORCE}: The implementation converts all content to this
 * HDR type, when possible.
 * In this mode, preferredHdrOutputType should be set.
 * </p>
 * @hide
 */
@TestApi
public final class HdrConversionMode implements Parcelable {
    /** HDR output conversion is unsupported */
    public static final int HDR_CONVERSION_UNSUPPORTED = 0;
    /** HDR output conversion is disabled */
    public static final int HDR_CONVERSION_PASSTHROUGH = 1;
    /** HDR output conversion is managed by the device manufacturer's implementation. */
@@ -82,18 +86,20 @@ public final class HdrConversionMode implements Parcelable {
    private final @ConversionMode int mConversionMode;
    private @Display.HdrCapabilities.HdrType int mPreferredHdrOutputType;

    public HdrConversionMode(int conversionMode, int preferredHdrOutputType) {
        if (conversionMode != HdrConversionMode.HDR_CONVERSION_FORCE
                && preferredHdrOutputType != -1) {
    public HdrConversionMode(@ConversionMode int conversionMode,
            @Display.HdrCapabilities.HdrType int preferredHdrOutputType) {
        if ((conversionMode == HdrConversionMode.HDR_CONVERSION_PASSTHROUGH
                || conversionMode == HDR_CONVERSION_UNSUPPORTED)
                && preferredHdrOutputType != Display.HdrCapabilities.HDR_TYPE_INVALID) {
            throw new IllegalArgumentException("preferredHdrOutputType must not be set if"
                    + " the conversion mode is not HDR_CONVERSION_FORCE");
                    + " the conversion mode is " + hdrConversionModeString(conversionMode));
        }

        mConversionMode = conversionMode;
        mPreferredHdrOutputType = preferredHdrOutputType;
    }

    public HdrConversionMode(int conversionMode) {
    public HdrConversionMode(@ConversionMode int conversionMode) {
        mConversionMode = conversionMode;
        mPreferredHdrOutputType = Display.HdrCapabilities.HDR_TYPE_INVALID;
    }
@@ -102,10 +108,12 @@ public final class HdrConversionMode implements Parcelable {
        this(source.readInt(), source.readInt());
    }

    @ConversionMode
    public int getConversionMode() {
        return mConversionMode;
    }

    @Display.HdrCapabilities.HdrType
    public int getPreferredHdrOutputType() {
        return mPreferredHdrOutputType;
    }
@@ -144,7 +152,7 @@ public final class HdrConversionMode implements Parcelable {
                && mPreferredHdrOutputType == other.getPreferredHdrOutputType();
    }

    private static String hdrConversionModeString(int hdrConversionMode) {
    private static String hdrConversionModeString(@ConversionMode int hdrConversionMode) {
        switch (hdrConversionMode) {
            case HDR_CONVERSION_PASSTHROUGH:
                return "HDR_CONVERSION_PASSTHROUGH";
@@ -153,7 +161,7 @@ public final class HdrConversionMode implements Parcelable {
            case HDR_CONVERSION_FORCE:
                return "HDR_CONVERSION_FORCE";
            default:
                return "HDR_CONVERSION_UNKNOWN";
                return "HDR_CONVERSION_UNSUPPORTED";
        }
    }
}
 No newline at end of file
+11 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ public class DisplayControl {
    private static native void nativeOverrideHdrTypes(IBinder displayToken, int[] modes);
    private static native long[] nativeGetPhysicalDisplayIds();
    private static native IBinder nativeGetPhysicalDisplayToken(long physicalDisplayId);
    private static native void nativeSetHdrConversionMode(int conversionMode,
    private static native int nativeSetHdrConversionMode(int conversionMode,
            int preferredHdrOutputType, int[] autoHdrTypes, int autoHdrTypesLength);
    private static native int[] nativeGetSupportedHdrOutputTypes();
    private static native boolean nativeGetHdrOutputConversionSupport();
@@ -105,15 +105,22 @@ public class DisplayControl {
    }

    /**
     * Sets the HDR conversion mode for the device.
     *
     * Returns the system preferred Hdr output type nn case when HDR conversion mode is
     * {@link android.hardware.display.HdrConversionMode#HDR_CONVERSION_SYSTEM}.
     * Returns Hdr::INVALID in other cases.
     * @hide
     */
    public static void setHdrConversionMode(int conversionMode, int preferredHdrOutputType,
    public static int setHdrConversionMode(int conversionMode, int preferredHdrOutputType,
            int[] autoHdrTypes) {
        int length = autoHdrTypes != null ? autoHdrTypes.length : 0;
        nativeSetHdrConversionMode(conversionMode, preferredHdrOutputType, autoHdrTypes, length);
        return nativeSetHdrConversionMode(
                conversionMode, preferredHdrOutputType, autoHdrTypes, length);
    }

    /**
     * Returns the HDR output types supported by the device.
     * @hide
     */
    public static @Display.HdrCapabilities.HdrType int[] getSupportedHdrOutputTypes() {
@@ -121,6 +128,7 @@ public class DisplayControl {
    }

    /**
     * Returns whether the HDR output conversion is supported by the device.
     * @hide
     */
    public static boolean getHdrOutputConversionSupport() {
Loading