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

Commit e713ee6c authored by Kriti Dang's avatar Kriti Dang Committed by Android (Google) Code Review
Browse files

Merge changes from topic "cherrypick-Display settings HDR formats-mumvl547ah" into sc-dev

* changes:
  Handling Number Format Exception in DiscreteValueIntegerListValidator
  Hdr format settings [Backend]
parents b6c7d6b9 72de55e1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1140,10 +1140,13 @@ package android.hardware.display {
  }

  public final class DisplayManager {
    method public boolean areUserDisabledHdrTypesAllowed();
    method @RequiresPermission(android.Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE) public int getRefreshRateSwitchingType();
    method public boolean isMinimalPostProcessingRequested(int);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAreUserDisabledHdrTypesAllowed(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE) public void setRefreshRateSwitchingType(int);
    method @RequiresPermission(android.Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS) public void setShouldAlwaysRespectAppRequestedMode(boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setUserDisabledHdrTypes(@NonNull int[]);
    method @RequiresPermission(android.Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS) public boolean shouldAlwaysRespectAppRequestedMode();
    field public static final int SWITCHING_TYPE_ACROSS_AND_WITHIN_GROUPS = 2; // 0x2
    field public static final int SWITCHING_TYPE_NONE = 0; // 0x0
@@ -2028,6 +2031,7 @@ package android.provider {

  public static final class Settings.Global extends android.provider.Settings.NameValueTable {
    field public static final String APP_OPS_CONSTANTS = "app_ops_constants";
    field public static final String ARE_USER_DISABLED_HDR_FORMATS_ALLOWED = "are_user_disabled_hdr_formats_allowed";
    field public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
    field public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
    field public static final String DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW = "enable_non_resizable_multi_window";
@@ -2042,6 +2046,7 @@ package android.provider {
    field public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
    field public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
    field public static final String USER_DISABLED_HDR_FORMATS = "user_disabled_hdr_formats";
    field public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
  }

@@ -2642,7 +2647,9 @@ package android.view {
  public final class SurfaceControl implements android.os.Parcelable {
    ctor public SurfaceControl(@NonNull android.view.SurfaceControl, @NonNull String);
    method public static long acquireFrameRateFlexibilityToken();
    method @NonNull public static android.os.IBinder getInternalDisplayToken();
    method public boolean isSameSurface(@NonNull android.view.SurfaceControl);
    method public static void overrideHdrTypes(@NonNull android.os.IBinder, @NonNull int[]);
    method public static void releaseFrameRateFlexibilityToken(long);
  }

+39 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.display;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.HdrCapabilities.HdrType;

import android.Manifest;
import android.annotation.FloatRange;
@@ -709,6 +710,44 @@ public final class DisplayManager {
        cdm.setSaturationLevel(Math.round(level * 100f));
    }

    /**
     * Sets the HDR types that have been disabled by user.
     * @param userDisabledTypes the HDR types to disable.
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
    public void setUserDisabledHdrTypes(@NonNull @HdrType int[] userDisabledTypes) {
        mGlobal.setUserDisabledHdrTypes(userDisabledTypes);
    }

    /**
     * Sets whether or not the user disabled HDR types are returned from
     * {@link Display#getHdrCapabilities}.
     *
     * @param areUserDisabledHdrTypesAllowed If true, the user-disabled types
     * are ignored and returned, if the display supports them. If false, the
     * user-disabled types are taken into consideration and are never returned,
     * even if the display supports them.
     * @hide
     */
    @TestApi
    @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
    public void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed) {
        mGlobal.setAreUserDisabledHdrTypesAllowed(areUserDisabledHdrTypesAllowed);
    }

    /**
     * Returns whether or not the user-disabled HDR types are returned from
     * {@link Display#getHdrCapabilities}.
     *
     * @hide
     */
    @TestApi
    public boolean areUserDisabledHdrTypesAllowed() {
        return mGlobal.areUserDisabledHdrTypesAllowed();
    }

    /**
     * Creates a virtual display.
     *
+43 −0
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package android.hardware.display;


import static android.hardware.display.DisplayManager.EventsMask;
import static android.view.Display.HdrCapabilities.HdrType;

import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -508,6 +510,47 @@ public final class DisplayManagerGlobal {
        }
    }

    /**
     * Sets the HDR types that have been disabled by user.
     * @param userDisabledHdrTypes the HDR types to disable. The HDR types are any of
     */
    public void setUserDisabledHdrTypes(@HdrType int[] userDisabledHdrTypes) {
        try {
            mDm.setUserDisabledHdrTypes(userDisabledHdrTypes);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Sets whether or not the user disabled HDR types are returned from
     * {@link Display#getHdrCapabilities}.
     *
     * @param areUserDisabledHdrTypesAllowed If true, the user-disabled
     * types are ignored and returned, if the display supports them. If
     * false, the user-disabled types are taken into consideration and
     * are never returned, even if the display supports them.
     */
    public void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed) {
        try {
            mDm.setAreUserDisabledHdrTypesAllowed(areUserDisabledHdrTypesAllowed);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    /**
     * Returns whether or not the user-disabled HDR types are returned from
     * {@link Display#getHdrCapabilities}.
     */
    public boolean areUserDisabledHdrTypesAllowed() {
        try {
            return mDm.areUserDisabledHdrTypesAllowed();
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

    public void requestColorMode(int displayId, int colorMode) {
        try {
            mDm.requestColorMode(displayId, colorMode);
+9 −0
Original line number Diff line number Diff line
@@ -68,6 +68,15 @@ interface IDisplayManager {
    // No permissions required.
    WifiDisplayStatus getWifiDisplayStatus();

    // Requires WRITE_SECURE_SETTINGS permission.
    void setUserDisabledHdrTypes(in int[] userDisabledTypes);

    // Requires WRITE_SECURE_SETTINGS permission.
    void setAreUserDisabledHdrTypesAllowed(boolean areUserDisabledHdrTypesAllowed);

    // No permissions required.
    boolean areUserDisabledHdrTypesAllowed();

    // Requires CONFIGURE_DISPLAY_COLOR_MODE
    void requestColorMode(int displayId, int colorMode);

+34 −0
Original line number Diff line number Diff line
@@ -14056,6 +14056,40 @@ public final class Settings {
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
        public static final int ZEN_MODE_ALARMS = 3;
        /**
         * A comma-separated list of HDR formats that have been disabled by the user.
         * <p>
         * If present, these formats will not be reported to apps, even if the display supports
         * them. This list is treated as empty if the ARE_USER_DISABLED_HDR_FORMATS_ALLOWED setting
         * is '1'.
         * </p>
         * @hide
         */
        @TestApi
        @Readable
        @SuppressLint("NoSettingsProvider")
        public static final String USER_DISABLED_HDR_FORMATS = "user_disabled_hdr_formats";
        /**
         * Whether or not user-disabled HDR formats are allowed.
         * <p>
         * The value is boolean (1 or 0). The value '1' means the user preference for disabling a
         * format is ignored, and the disabled formats are still reported to apps (if supported
         * by the display). The value '0' means the user-disabled formats are not reported to
         * apps, even if the display supports them.
         * </p><p>
         * The list of formats disabled by the user are contained in the
         * USER_DISABLED_HDR_FORMATS setting. This list is treated as empty when the value of
         * this setting is '1'.
         * </p>
         * @hide
         */
        @TestApi
        @Readable
        @SuppressLint("NoSettingsProvider")
        public static final String ARE_USER_DISABLED_HDR_FORMATS_ALLOWED =
                "are_user_disabled_hdr_formats_allowed";
        /** @hide */ public static String zenModeToString(int mode) {
            if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
            if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
Loading