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

Commit e7770650 authored by Steve Pfetsch's avatar Steve Pfetsch Committed by Android (Google) Code Review
Browse files

Merge "Enable color temperature developer setting"

parents c4c84604 b3fef371
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -35,4 +35,7 @@
    <!-- Carrier_enabled editable -->
    <bool name="config_allow_edit_carrier_enabled" translatable="false">false</bool>

    <!-- When true enable color temperature setting. -->
    <bool name="config_enableColorTemperature">false</bool>

</resources>
+6 −0
Original line number Diff line number Diff line
@@ -86,6 +86,12 @@
        android:dialogTitle="@string/select_webview_provider_dialog_title"
        android:summary="%s" />

    <SwitchPreference
        android:key="color_temperature"
        android:title="@string/color_temperature"
        android:summary="@string/color_temperature_desc"
        android:persistent="false" />

    <PreferenceCategory android:key="debug_debugging_category"
            android:title="@string/debug_debugging_category">

+29 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
    private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace";
    private static final String TUNER_UI_KEY = "tuner_ui";
    private static final String COLOR_TEMPERATURE_PROPERTY = "persist.sys.debug.color_temp";

    private static final String DEBUG_APP_KEY = "debug_app";
    private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
@@ -177,6 +178,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private static final String KEY_COLOR_MODE = "color_mode";
    private static final String FORCE_RESIZABLE_KEY = "force_resizable_activities";
    private static final String ENABLE_FREEFORM_SUPPORT_KEY = "enable_freeform_support";
    private static final String COLOR_TEMPERATURE_KEY = "color_temperature";

    private static final String INACTIVE_APPS_KEY = "inactive_apps";

@@ -285,6 +287,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment

    private SwitchPreference mEnableFreeformSupport;

    private SwitchPreference mColorTemperaturePreference;

    private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();

    private final ArrayList<SwitchPreference> mResetSwitchPrefs
@@ -480,6 +484,15 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            mColorModePreference = null;
        }
        updateWebViewProviderOptions();

        mColorTemperaturePreference = (SwitchPreference) findPreference(COLOR_TEMPERATURE_KEY);
        if (getResources().getBoolean(R.bool.config_enableColorTemperature)) {
            mAllPrefs.add(mColorTemperaturePreference);
            mResetSwitchPrefs.add(mColorTemperaturePreference);
        } else {
            removePreference(COLOR_TEMPERATURE_KEY);
            mColorTemperaturePreference = null;
        }
    }

    private ListPreference addListPreference(String prefKey) {
@@ -690,6 +703,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        updateForceResizableOptions();
        updateEnableFreeformWindowsSupportOptions();
        updateWebViewProviderOptions();
        if (mColorTemperaturePreference != null) {
            updateColorTemperature();
        }
    }

    private void resetDangerousOptions() {
@@ -1257,6 +1273,17 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        }
    }

    private void updateColorTemperature() {
        updateSwitchPreference(mColorTemperaturePreference,
                SystemProperties.getBoolean(COLOR_TEMPERATURE_PROPERTY, false));
    }

    private void writeColorTemperature() {
        SystemProperties.set(COLOR_TEMPERATURE_PROPERTY,
                mColorTemperaturePreference.isChecked() ? "1" : "0");
        pokeSystemProperties();
    }

    private void updateUSBAudioOptions() {
        updateSwitchPreference(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
                Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
@@ -1830,6 +1857,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            writeLegacyDhcpClientOptions();
        } else if (preference == mMobileDataAlwaysOn) {
            writeMobileDataAlwaysOnOptions();
        } else if (preference == mColorTemperaturePreference) {
            writeColorTemperature();
        } else if (preference == mUSBAudio) {
            writeUSBAudioOptions();
        } else if (preference == mForceResizable) {