Merge commit '6a19c5cabf1615ffce654a1203554bbaa1d1f72e' into HEAD

Change-Id: Ic7cd65ff8d2fd397a77f635b21bd06bfc17a38dc
This commit is contained in:
Bill Yi
2016-02-17 11:13:33 -08:00
167 changed files with 39313 additions and 52758 deletions

View File

@@ -116,6 +116,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";
@@ -167,6 +168,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
private static final String KEY_COLOR_MODE = "color_mode";
private static final String COLOR_TEMPERATURE_KEY = "color_temperature";
private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY =
"bluetooth_disable_absolute_volume";
@@ -270,6 +272,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private ColorModePreference mColorModePreference;
private SwitchPreference mColorTemperaturePreference;
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
private final ArrayList<SwitchPreference> mResetSwitchPrefs
@@ -302,7 +306,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (android.os.Process.myUserHandle().getIdentifier() != UserHandle.USER_OWNER
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)
|| Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
// Block access to developer options if the user is not the owner, if user policy
// restricts it, or if the device has not been provisioned
mUnavailable = true;
setPreferenceScreen(new PreferenceScreen(getActivity(), null));
return;
@@ -432,6 +440,15 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
removePreference(KEY_COLOR_MODE);
mColorModePreference = null;
}
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) {
@@ -639,6 +656,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
updateMobileDataAlwaysOnOptions();
updateSimulateColorSpace();
updateUSBAudioOptions();
if (mColorTemperaturePreference != null) {
updateColorTemperature();
}
updateBluetoothDisableAbsVolumeOptions();
}
@@ -1184,6 +1204,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);
@@ -1764,6 +1795,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
writeLegacyDhcpClientOptions();
} else if (preference == mMobileDataAlwaysOn) {
writeMobileDataAlwaysOnOptions();
} else if (preference == mColorTemperaturePreference) {
writeColorTemperature();
} else if (preference == mUSBAudio) {
writeUSBAudioOptions();
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {