Bluetooth MaxConnectedAudioDevices show correct number

* When the preference is changed by the user, it will update the UI
* When the Developer options is enabled, it will set the system property
to default number
* Change string "Maximum number of connected Bluetooth audio devices" to
"Maximum connected Bluetooth audio devices" per discussion with Lindsay

Bug: 71603731
Test: m
ROBOTEST_FILTER="BluetoothMaxConnectedAudioDevicesPreferenceControllerTest"
RunSettingsRoboTests -j40
Change-Id: I3e59534585065c84530da73ffded21894c845ce9
This commit is contained in:
Hansong Zhang
2018-01-05 14:47:26 -08:00
parent de4bef0243
commit de2855abdf
3 changed files with 20 additions and 9 deletions

View File

@@ -67,6 +67,7 @@ public class BluetoothMaxConnectedAudioDevicesPreferenceController extends
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValue.toString());
updateState(preference);
return true;
}
@@ -88,13 +89,13 @@ public class BluetoothMaxConnectedAudioDevicesPreferenceController extends
@Override
protected void onDeveloperOptionsSwitchEnabled() {
mPreference.setEnabled(true);
mPreference.setValue(mListValues[0]);
mPreference.setSummary(mListSummaries[0]);
updateState(mPreference);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
mPreference.setEnabled(false);
SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, mListValues[0]);
mPreference.setValue(mListValues[0]);
mPreference.setSummary(mListSummaries[0]);
}