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

Commit 8ef645da authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Configuration#isScreenHdr should depend on hasHdrDisplay"

parents 98bb3f5c f739badb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1426,7 +1426,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        config.densityDpi = displayInfo.logicalDensityDpi;

        config.colorMode =
                (displayInfo.isHdr()
                ((displayInfo.isHdr() && mService.hasHdrSupport())
                        ? Configuration.COLOR_MODE_HDR_YES
                        : Configuration.COLOR_MODE_HDR_NO)
                        | (displayInfo.isWideColorGamut() && mService.hasWideColorGamutSupport()
+20 −1
Original line number Diff line number Diff line
@@ -734,8 +734,9 @@ public class WindowManagerService extends IWindowManager.Stub
    final DisplayManagerInternal mDisplayManagerInternal;
    final DisplayManager mDisplayManager;

    // Indicates whether this device supports wide color gamut rendering
    // Indicates whether this device supports wide color gamut / HDR rendering
    private boolean mHasWideColorGamutSupport;
    private boolean mHasHdrSupport;

    // Who is holding the screen on.
    private Session mHoldingScreenOn;
@@ -4504,6 +4505,7 @@ public class WindowManagerService extends IWindowManager.Stub
        mPolicy.systemReady();
        mTaskSnapshotController.systemReady();
        mHasWideColorGamutSupport = queryWideColorGamutSupport();
        mHasHdrSupport = queryHdrSupport();
    }

    private static boolean queryWideColorGamutSupport() {
@@ -4519,6 +4521,19 @@ public class WindowManagerService extends IWindowManager.Stub
        return false;
    }

    private static boolean queryHdrSupport() {
        try {
            ISurfaceFlingerConfigs surfaceFlinger = ISurfaceFlingerConfigs.getService();
            OptionalBool hasHdr = surfaceFlinger.hasHDRDisplay();
            if (hasHdr != null) {
                return hasHdr.value;
            }
        } catch (RemoteException e) {
            // Ignore, we're in big trouble if we can't talk to SurfaceFlinger's config store
        }
        return false;
    }

    // -------------------------------------------------------------
    // Async Handler
    // -------------------------------------------------------------
@@ -7499,6 +7514,10 @@ public class WindowManagerService extends IWindowManager.Stub
                SystemProperties.getInt("persist.sys.sf.native_mode", 0) != 1;
    }

    boolean hasHdrSupport() {
        return mHasHdrSupport && hasWideColorGamutSupport();
    }

    void updateNonSystemOverlayWindowsVisibilityIfNeeded(WindowState win, boolean surfaceShown) {
        if (!win.hideNonSystemOverlayWindowsWhenVisible()
                && !mHidingNonSystemOverlayWindows.contains(win)) {