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

Commit 7da025f1 authored by Damien Bargiacchi's avatar Damien Bargiacchi Committed by Android (Google) Code Review
Browse files

Merge "Allow config.xml to set the default display's default color mode" into cw-f-dev

parents aa13d0f0 4364bbf9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1936,6 +1936,12 @@
         mirror the content of the default display. -->
    <bool name="config_localDisplaysMirrorContent">true</bool>

    <!-- The default mode for the default display. One of the following values (See Display.java):
             0 - COLOR_MODE_DEFAULT
             7 - COLOR_MODE_SRGB
    -->
    <integer name="config_defaultDisplayDefaultColorMode">0</integer>

    <!-- When true use the linux /dev/input/event subsystem to detect the switch changes
         on the headphone/microphone jack. When false use the older uevent framework. -->
    <bool name="config_useDevInputEventForAudioJack">false</bool>
+1 −0
Original line number Diff line number Diff line
@@ -307,6 +307,7 @@
  <java-symbol type="bool" name="config_supportsMultiWindow" />
  <java-symbol type="bool" name="config_guestUserEphemeral" />
  <java-symbol type="bool" name="config_localDisplaysMirrorContent" />
  <java-symbol type="integer" name="config_defaultDisplayDefaultColorMode" />
  <java-symbol type="bool" name="config_enableAppWidgetService" />
  <java-symbol type="string" name="config_defaultPictureInPictureBounds" />
  <java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" />
+16 −0
Original line number Diff line number Diff line
@@ -220,6 +220,11 @@ public final class DisplayManagerService extends SystemService {
    private final DisplayViewport mTempDefaultViewport = new DisplayViewport();
    private final DisplayViewport mTempExternalTouchViewport = new DisplayViewport();

    // The default color mode for default displays. Overrides the usual
    // Display.Display.COLOR_MODE_DEFAULT for displays with the
    // DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY flag set.
    private final int mDefaultDisplayDefaultColorMode;

    // Temporary list of deferred work to perform when setting the display state.
    // Only used by requestDisplayState.  The field is self-synchronized and only
    // intended for use inside of the requestGlobalDisplayStateInternal function.
@@ -232,6 +237,8 @@ public final class DisplayManagerService extends SystemService {
        mUiHandler = UiThread.getHandler();
        mDisplayAdapterListener = new DisplayAdapterListener();
        mSingleDisplayDemoMode = SystemProperties.getBoolean("persist.demo.singledisplay", false);
        mDefaultDisplayDefaultColorMode = mContext.getResources().getInteger(
            com.android.internal.R.integer.config_defaultDisplayDefaultColorMode);

        PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        mGlobalDisplayBrightness = pm.getDefaultScreenBrightnessSetting();
@@ -703,6 +710,14 @@ public final class DisplayManagerService extends SystemService {
        }
        if (display != null && display.getPrimaryDisplayDeviceLocked() == device) {
            int colorMode = mPersistentDataStore.getColorMode(device);
            if (colorMode == Display.COLOR_MODE_INVALID) {
                if ((device.getDisplayDeviceInfoLocked().flags
                     & DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY) != 0) {
                    colorMode = mDefaultDisplayDefaultColorMode;
                } else {
                    colorMode = Display.COLOR_MODE_DEFAULT;
                }
            }
            display.setRequestedColorModeLocked(colorMode);
        }
        scheduleTraversalLocked(false);
@@ -1043,6 +1058,7 @@ public final class DisplayManagerService extends SystemService {
            pw.println("  mNextNonDefaultDisplayId=" + mNextNonDefaultDisplayId);
            pw.println("  mDefaultViewport=" + mDefaultViewport);
            pw.println("  mExternalTouchViewport=" + mExternalTouchViewport);
            pw.println("  mDefaultDisplayDefaultColorMode=" + mDefaultDisplayDefaultColorMode);
            pw.println("  mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);
            pw.println("  mWifiDisplayScanRequestCount=" + mWifiDisplayScanRequestCount);

+2 −2
Original line number Diff line number Diff line
@@ -183,11 +183,11 @@ final class PersistentDataStore {

    public int getColorMode(DisplayDevice device) {
        if (!device.hasStableUniqueId()) {
            return Display.COLOR_MODE_DEFAULT;
            return Display.COLOR_MODE_INVALID;
        }
        DisplayState state = getDisplayState(device.getUniqueId(), false);
        if (state == null) {
            return Display.COLOR_MODE_DEFAULT;
            return Display.COLOR_MODE_INVALID;
        }
        return state.getColorMode();
    }