Loading res/values/arrays.xml +4 −2 Original line number Diff line number Diff line Loading @@ -318,7 +318,8 @@ <!-- Bluetooth developer settings: Titles for maximum number of connected audio devices --> <string-array name="bluetooth_max_connected_audio_devices"> <item>1 (Default)</item> <item>Use System Default: <xliff:g id="default_bluetooth_max_connected_audio_devices">%1$d</xliff:g></item> <item>1</item> <item>2</item> <item>3</item> <item>4</item> Loading @@ -326,7 +327,8 @@ </string-array> <!-- Bluetooth developer settings: Values for maximum number of connected audio devices --> <string-array name="bluetooth_max_connected_audio_devices_values"> <string-array translatable="false" name="bluetooth_max_connected_audio_devices_values"> <item></item> <item>1</item> <item>2</item> <item>3</item> Loading src/com/android/settings/development/DevelopmentSettings.java +39 −15 Original line number Diff line number Diff line Loading @@ -901,6 +901,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment } writeOverlayDisplayDevicesOptions(null); writeAppProcessLimitOptions(null); writeBluetoothMaxConnectedAudioDevices(""); mHaveDebugSettings = false; updateAllOptions(); mDontPokeProperties = false; Loading Loading @@ -1884,12 +1885,44 @@ public class DevelopmentSettings extends RestrictedSettingsFragment mBluetoothSelectA2dpLdacPlaybackQuality.setValue(values[index]); mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]); // Init the maximum connected devices - Default values = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices_values); summaries = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices); // Init the maximum connected devices initBluetoothMaxConnectedAudioDevicesPreference(); updateBluetoothMaxConnectedAudioDevicesPreference(); } private void initBluetoothMaxConnectedAudioDevicesPreference() { int defaultMaxConnectedAudioDevices = getResources().getInteger( com.android.internal.R.integer.config_bluetooth_max_connected_audio_devices); final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries(); entries[0] = String.format(entries[0].toString(), defaultMaxConnectedAudioDevices); mBluetoothSelectMaxConnectedAudioDevices.setEntries(entries); } private void updateBluetoothMaxConnectedAudioDevicesPreference() { final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries(); final String currentValue = SystemProperties.get(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY); int index = 0; if (!currentValue.isEmpty()) { index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(currentValue); if (index < 0) { // Reset property value when value is illegal SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, ""); index = 0; mBluetoothSelectMaxConnectedAudioDevices.setValue(values[index]); mBluetoothSelectMaxConnectedAudioDevices.setSummary(summaries[index]); } } mBluetoothSelectMaxConnectedAudioDevices.setValueIndex(index); mBluetoothSelectMaxConnectedAudioDevices.setSummary(entries[index]); } private void writeBluetoothMaxConnectedAudioDevices(Object newValue) { String newValueString = newValue.toString(); if (mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValueString) <= 0) { // Reset property value when default is chosen or when value is illegal newValueString = ""; } SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValueString); updateBluetoothMaxConnectedAudioDevicesPreference(); } private void writeBluetoothAvrcpVersion(Object newValue) { Loading Loading @@ -2058,15 +2091,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment } } private void writeBluetoothMaxConnectedAudioDevices(Object newValue) { SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValue.toString()); int index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValue.toString()); if (index >= 0) { String[] titles = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices); mBluetoothSelectMaxConnectedAudioDevices.setSummary(titles[index]); } } private void writeBluetoothConfigurationOption(Preference preference, Object newValue) { String[] summaries; Loading Loading
res/values/arrays.xml +4 −2 Original line number Diff line number Diff line Loading @@ -318,7 +318,8 @@ <!-- Bluetooth developer settings: Titles for maximum number of connected audio devices --> <string-array name="bluetooth_max_connected_audio_devices"> <item>1 (Default)</item> <item>Use System Default: <xliff:g id="default_bluetooth_max_connected_audio_devices">%1$d</xliff:g></item> <item>1</item> <item>2</item> <item>3</item> <item>4</item> Loading @@ -326,7 +327,8 @@ </string-array> <!-- Bluetooth developer settings: Values for maximum number of connected audio devices --> <string-array name="bluetooth_max_connected_audio_devices_values"> <string-array translatable="false" name="bluetooth_max_connected_audio_devices_values"> <item></item> <item>1</item> <item>2</item> <item>3</item> Loading
src/com/android/settings/development/DevelopmentSettings.java +39 −15 Original line number Diff line number Diff line Loading @@ -901,6 +901,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment } writeOverlayDisplayDevicesOptions(null); writeAppProcessLimitOptions(null); writeBluetoothMaxConnectedAudioDevices(""); mHaveDebugSettings = false; updateAllOptions(); mDontPokeProperties = false; Loading Loading @@ -1884,12 +1885,44 @@ public class DevelopmentSettings extends RestrictedSettingsFragment mBluetoothSelectA2dpLdacPlaybackQuality.setValue(values[index]); mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]); // Init the maximum connected devices - Default values = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices_values); summaries = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices); // Init the maximum connected devices initBluetoothMaxConnectedAudioDevicesPreference(); updateBluetoothMaxConnectedAudioDevicesPreference(); } private void initBluetoothMaxConnectedAudioDevicesPreference() { int defaultMaxConnectedAudioDevices = getResources().getInteger( com.android.internal.R.integer.config_bluetooth_max_connected_audio_devices); final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries(); entries[0] = String.format(entries[0].toString(), defaultMaxConnectedAudioDevices); mBluetoothSelectMaxConnectedAudioDevices.setEntries(entries); } private void updateBluetoothMaxConnectedAudioDevicesPreference() { final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries(); final String currentValue = SystemProperties.get(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY); int index = 0; if (!currentValue.isEmpty()) { index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(currentValue); if (index < 0) { // Reset property value when value is illegal SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, ""); index = 0; mBluetoothSelectMaxConnectedAudioDevices.setValue(values[index]); mBluetoothSelectMaxConnectedAudioDevices.setSummary(summaries[index]); } } mBluetoothSelectMaxConnectedAudioDevices.setValueIndex(index); mBluetoothSelectMaxConnectedAudioDevices.setSummary(entries[index]); } private void writeBluetoothMaxConnectedAudioDevices(Object newValue) { String newValueString = newValue.toString(); if (mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValueString) <= 0) { // Reset property value when default is chosen or when value is illegal newValueString = ""; } SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValueString); updateBluetoothMaxConnectedAudioDevicesPreference(); } private void writeBluetoothAvrcpVersion(Object newValue) { Loading Loading @@ -2058,15 +2091,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment } } private void writeBluetoothMaxConnectedAudioDevices(Object newValue) { SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValue.toString()); int index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValue.toString()); if (index >= 0) { String[] titles = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices); mBluetoothSelectMaxConnectedAudioDevices.setSummary(titles[index]); } } private void writeBluetoothConfigurationOption(Preference preference, Object newValue) { String[] summaries; Loading