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

Commit f739badb authored by Chia-I Wu's avatar Chia-I Wu
Browse files

Configuration#isScreenHdr should depend on hasHdrDisplay

isScreenHdr should check for
ISurfaceFlingerConfigs#{hasHdrDisplay,hasWideColorDisplay} in
addition to DisplayInfo#isHdr before returning true.

Bug: 79478600
Test: am get-config
Change-Id: Ib8bd0d330d2ecde0fdc6b42545c2a0b1faca49d3
parent 8cc536c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1421,7 +1421,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
    // -------------------------------------------------------------
@@ -7510,6 +7525,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)) {