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

Commit b7763138 authored by Christine Franks's avatar Christine Franks
Browse files

Add configurable mapping between color modes

There are two categories of color modes: the standard color modes, which
are defined and implemented in AOSP, and a reserved range of vendor color
modes, which are defined and implemented by the vendor. Currently, there
is no way to distinguish between two vendor's color modes that use the
same value within the reserved range. This will allow OEMs to specify a
hint as to which vendor's color mode definitions were used on the
original device. If the hint from the restored device matches the hint
on the new device, the color mode from the restored device can still be
considered valid for the new device if it is within the vendor reserved
range. If it does not match, the restored device's color mode value is
invalid on the new device, and must be replaced by the default on the
new device.

Bug: 167449433
Test: builds
Change-Id: Ie5ac0a2d783e1ea703e0342f5cdb41dca07d04d4
parent 7cdfcd8a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -356,6 +356,18 @@ public final class ColorDisplayManager {
        return mManager.getColorMode();
    }

    /**
     * Returns whether the specified color mode is part of the standard set.
     *
     * @hide
     */
    public static boolean isStandardColorMode(int mode) {
        return mode == ColorDisplayManager.COLOR_MODE_NATURAL
                || mode == ColorDisplayManager.COLOR_MODE_BOOSTED
                || mode == ColorDisplayManager.COLOR_MODE_SATURATED
                || mode == ColorDisplayManager.COLOR_MODE_AUTOMATIC;
    }

    /**
     * Returns whether the device has a wide color gamut display.
     *
+9 −0
Original line number Diff line number Diff line
@@ -3983,6 +3983,14 @@ public final class Settings {
         */
        public static final String DISPLAY_COLOR_MODE = "display_color_mode";
        /**
         * Hint to decide whether restored vendor color modes are compatible with the new device. If
         * unset or a match is not made, only the standard color modes will be restored.
         * @hide
         */
        public static final String DISPLAY_COLOR_MODE_VENDOR_HINT =
                "display_color_mode_vendor_hint";
        /**
         * The user selected min refresh rate in frames per second.
         *
@@ -4941,6 +4949,7 @@ public final class Settings {
            PRIVATE_SETTINGS.add(EGG_MODE);
            PRIVATE_SETTINGS.add(SHOW_BATTERY_PERCENT);
            PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE);
            PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE_VENDOR_HINT);
        }
        /**
+15 −0
Original line number Diff line number Diff line
@@ -898,6 +898,21 @@
        -->
    </integer-array>

    <!-- Mapping for default ColorDisplayManager.COLOR_MODE_xxx to other color modes, if
         if applicable. By default, all map to the same value. -->
    <integer-array name="config_mappedColorModes">
        <item>0</item> <!-- COLOR_MODE_NATURAL -->
        <item>1</item> <!-- COLOR_MODE_BOOSTED -->
        <item>2</item> <!-- COLOR_MODE_SATURATED -->
        <item>3</item> <!-- COLOR_MODE_AUTOMATIC -->
    </integer-array>

    <!-- Hint to decide whether restored vendor color modes are compatible with the new device. If
         unset or a match is not made, only the standard color modes will be restored. If set, it
         should be a unique identifier for the kinds of vendor modes this device supports, such as a
         manufacturer name. -->
    <string name="config_vendorColorModesRestoreHint" translatable="false"></string>

    <!-- Color mode to use when accessibility transforms are enabled. This color mode must be
         supported by the device, but not necessarily appear in config_availableColorModes. The
         regularly selected color mode will be used if this value is negative. -->
+2 −0
Original line number Diff line number Diff line
@@ -3194,6 +3194,8 @@
  <java-symbol type="array" name="config_reduceBrightColorsCoefficients" />
  <java-symbol type="array" name="config_reduceBrightColorsCoefficientsNative" />
  <java-symbol type="array" name="config_availableColorModes" />
  <java-symbol type="array" name="config_mappedColorModes" />
  <java-symbol type="string" name="config_vendorColorModesRestoreHint" />
  <java-symbol type="integer" name="config_accessibilityColorMode" />
  <java-symbol type="array" name="config_displayCompositionColorModes" />
  <java-symbol type="array" name="config_displayCompositionColorSpaces" />
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public class SystemSettings {
        Settings.System.NOTIFICATION_VIBRATION_INTENSITY,
        Settings.System.RING_VIBRATION_INTENSITY,
        Settings.System.HAPTIC_FEEDBACK_INTENSITY,
        Settings.System.DISPLAY_COLOR_MODE_VENDOR_HINT, // must precede DISPLAY_COLOR_MODE
        Settings.System.DISPLAY_COLOR_MODE,
        Settings.System.ALARM_ALERT,
        Settings.System.NOTIFICATION_LIGHT_PULSE,
Loading