Merge "Enable color temperature developer setting"
This commit is contained in:
committed by
Android (Google) Code Review
commit
e7770650c7
@@ -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) {
|
||||
|
Reference in New Issue
Block a user