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

Commit 24d5f3bc authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use toggle override if device has desktop mode..." into main

parents 242fb7b7 5496c7ad
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -487,12 +487,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);
    }
}