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

Commit 5496c7ad authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Use toggle override if device has desktop mode...

dev option enabled.

Previous behaviour:
If a device has `enableDisplayContentModeManagement` enabled, do not use
dev options to override flag values in any cases.

New behaviour:
If a device has `enableDisplayContentModeManagement` enabled but has
`config_isDesktopModeDevOptionSupported` value set to `true`, still use
dev option to override flag values.

Bug: 434652526
Test: Manually check the feature enablement on device
Flag: EXEMPT Bug fix
Change-Id: I39e9ca4dafa9ec5958ee7ff907b70bbdcf9e76b3
parent 73d957e3
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -472,12 +472,23 @@ public enum DesktopExperienceFlags {

    /** Returns whether the toggle is overridden by the relevant system property.. */
    private static boolean isToggleOverriddenBySystem() {
        // We never override if display content mode management is enabled or
        // if the desktop experience dev option is not enabled in the build.
        if (enableDisplayContentModeManagement() || !Flags.showDesktopExperienceDevOption()) {
        // We never override if display content mode management is enabled (except when desktop
        // mode dev option is enabled on the device, which indicates that the device only supports
        // desktop mode) or if the desktop experience dev option is not enabled in the build.
        if ((enableDisplayContentModeManagement() && (!isDesktopModeDevOptionSupported()))
                || !Flags.showDesktopExperienceDevOption()) {
            return false;
        }
        return SystemProperties.getBoolean(SYSTEM_PROPERTY_NAME, false);
    }

    private static boolean isDesktopModeDevOptionSupported() {
        Context context = getApplicationContext();
        if (context == null) {
            return false;
        }

        return context.getResources().getBoolean(R.bool.config_isDesktopModeDevOptionSupported);
    }
}