Bluetooth: Use "Disable" in-band ringing instead of "Enable"

* Given that in-band ringing is enabled by default on supported devices,
  the corresponding development settings should be rephrased from
  "Enable in-band ringing" to "Disable in-band ringing" to hint that it
  is enabled by default
* This also gets rid of special logic to check that option in
  initialization
* Add strings to reflect this change as well

Bug: 65383086
Test: make, try toggling the preference and verify whether in-band
ringing works or not

Change-Id: I29f91c7d12c725b12452ec163b75051ff28f500d
Merged-In: I29f91c7d12c725b12452ec163b75051ff28f500d
This commit is contained in:
Jack He
2017-12-07 15:09:07 -08:00
parent 985b432fc0
commit 7d563bd1de
3 changed files with 26 additions and 25 deletions

View File

@@ -210,12 +210,12 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
"persist.bluetooth.disableabsvol";
private static final String BLUETOOTH_AVRCP_VERSION_PROPERTY =
"persist.bluetooth.avrcpversion";
private static final String BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY =
"persist.bluetooth.enableinbandringing";
private static final String BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY =
"persist.bluetooth.disableinbandringing";
private static final String BLUETOOTH_BTSNOOP_ENABLE_PROPERTY =
"persist.bluetooth.btsnoopenable";
private static final String BLUETOOTH_ENABLE_INBAND_RINGING_KEY = "bluetooth_enable_inband_ringing";
private static final String BLUETOOTH_DISABLE_INBAND_RINGING_KEY = "bluetooth_disable_inband_ringing";
private static final String BLUETOOTH_SELECT_AVRCP_VERSION_KEY = "bluetooth_select_avrcp_version";
private static final String BLUETOOTH_SELECT_A2DP_CODEC_KEY = "bluetooth_select_a2dp_codec";
private static final String BLUETOOTH_SELECT_A2DP_SAMPLE_RATE_KEY = "bluetooth_select_a2dp_sample_rate";
@@ -291,7 +291,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private SwitchPreference mTetheringHardwareOffload;
private SwitchPreference mBluetoothShowDevicesWithoutNames;
private SwitchPreference mBluetoothDisableAbsVolume;
private SwitchPreference mBluetoothEnableInbandRinging;
private SwitchPreference mBluetoothDisableInbandRinging;
private BluetoothA2dp mBluetoothA2dp;
private final Object mBluetoothA2dpLock = new Object();
@@ -513,10 +513,10 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mBluetoothShowDevicesWithoutNames =
findAndInitSwitchPref(BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_KEY);
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
mBluetoothEnableInbandRinging = findAndInitSwitchPref(BLUETOOTH_ENABLE_INBAND_RINGING_KEY);
mBluetoothDisableInbandRinging = findAndInitSwitchPref(BLUETOOTH_DISABLE_INBAND_RINGING_KEY);
if (!BluetoothHeadset.isInbandRingingSupported(getContext())) {
removePreference(mBluetoothEnableInbandRinging);
mBluetoothEnableInbandRinging = null;
removePreference(mBluetoothDisableInbandRinging);
mBluetoothDisableInbandRinging = null;
}
mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
@@ -858,7 +858,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
}
updateBluetoothShowDevicesWithoutUserFriendlyNameOptions();
updateBluetoothDisableAbsVolumeOptions();
updateBluetoothEnableInbandRingingOptions();
updateBluetoothDisableInbandRingingOptions();
updateBluetoothA2dpConfigurationValues();
updatePrivateDnsSummary();
}
@@ -872,10 +872,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
onPreferenceTreeClick(cb);
}
}
if (mBluetoothEnableInbandRinging != null) {
mBluetoothEnableInbandRinging.setChecked(true);
onPreferenceTreeClick(mBluetoothEnableInbandRinging);
}
mBugReportInPowerController.resetPreference();
mEnableAdbController.resetPreference();
resetDebuggerOptions();
@@ -1523,17 +1519,17 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mBluetoothDisableAbsVolume.isChecked() ? "true" : "false");
}
private void updateBluetoothEnableInbandRingingOptions() {
if (mBluetoothEnableInbandRinging != null) {
updateSwitchPreference(mBluetoothEnableInbandRinging,
SystemProperties.getBoolean(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, true));
private void updateBluetoothDisableInbandRingingOptions() {
if (mBluetoothDisableInbandRinging != null) {
updateSwitchPreference(mBluetoothDisableInbandRinging,
SystemProperties.getBoolean(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false));
}
}
private void writeBluetoothEnableInbandRingingOptions() {
if (mBluetoothEnableInbandRinging != null) {
SystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY,
mBluetoothEnableInbandRinging.isChecked() ? "true" : "false");
private void writeBluetoothDisableInbandRingingOptions() {
if (mBluetoothDisableInbandRinging != null) {
SystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY,
mBluetoothDisableInbandRinging.isChecked() ? "true" : "false");
}
}
@@ -2592,8 +2588,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
writeBluetoothShowDevicesWithoutUserFriendlyNameOptions();
} else if (preference == mBluetoothDisableAbsVolume) {
writeBluetoothDisableAbsVolumeOptions();
} else if (preference == mBluetoothEnableInbandRinging) {
writeBluetoothEnableInbandRingingOptions();
} else if (preference == mBluetoothDisableInbandRinging) {
writeBluetoothDisableInbandRingingOptions();
} else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
resetShortcutManagerThrottling();
} else {