Loading res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -396,6 +396,11 @@ <!-- Summary for bluetooth item in connection detail page --> <string name="bluetooth_pref_summary">Allow device to pair and connect to bluetooth devices</string> <!-- Setting Checkbox title for disabling Bluetooth inband ringing in Development Settings --> <string name="bluetooth_disable_inband_ringing">Disable in-band ringing</string> <!-- Summary of checkbox for disabling Bluetooth inband ringing in Development Settings --> <string name="bluetooth_disable_inband_ringing_summary">Don’t play custom phone ringtones on Bluetooth headsets</string> <!-- Title for connected device group [CHAR LIMIT=none]--> <string name="connected_device_connected_title">Currently connected</string> <!-- Title for connected device group [CHAR LIMIT=none]--> Loading res/xml/development_settings.xml +3 −3 Original line number Diff line number Diff line Loading @@ -240,9 +240,9 @@ android:summary="@string/bluetooth_disable_absolute_volume_summary"/> <SwitchPreference android:key="bluetooth_enable_inband_ringing" android:title="@string/bluetooth_enable_inband_ringing" android:summary="@string/bluetooth_enable_inband_ringing_summary"/> android:key="bluetooth_disable_inband_ringing" android:title="@string/bluetooth_disable_inband_ringing" android:summary="@string/bluetooth_disable_inband_ringing_summary"/> <ListPreference android:key="bluetooth_select_avrcp_version" Loading src/com/android/settings/development/BluetoothInbandRingingPreferenceController.java +11 −12 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ public class BluetoothInbandRingingPreferenceController extends DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin { 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"; @VisibleForTesting static final String BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY = "persist.bluetooth.enableinbandringing"; static final String BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY = "persist.bluetooth.disableinbandringing"; private SwitchPreference mPreference; Loading @@ -50,7 +50,7 @@ public class BluetoothInbandRingingPreferenceController extends @Override public String getPreferenceKey() { return BLUETOOTH_ENABLE_INBAND_RINGING_KEY; return BLUETOOTH_DISABLE_INBAND_RINGING_KEY; } @Override Loading @@ -62,16 +62,16 @@ public class BluetoothInbandRingingPreferenceController extends @Override public boolean onPreferenceChange(Preference preference, Object newValue) { final boolean isEnabled = (Boolean) newValue; SystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, isEnabled ? "true" : "false"); final boolean isChecked = (Boolean) newValue; SystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, isChecked ? "true" : "false"); return true; } @Override public void updateState(Preference preference) { final boolean isEnabled = SystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, true /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); mPreference.setChecked(isEnabled); } Loading @@ -83,9 +83,8 @@ public class BluetoothInbandRingingPreferenceController extends @Override protected void onDeveloperOptionsSwitchDisabled() { mPreference.setEnabled(false); // the default setting for this preference is the enabled state mPreference.setChecked(true); SystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, "true"); mPreference.setChecked(false); SystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, "false"); } @VisibleForTesting Loading tests/robotests/src/com/android/settings/development/BluetoothInbandRingingPreferenceControllerTest.java +8 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.settings.development; import static com.android.settings.development.BluetoothInbandRingingPreferenceController .BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY; .BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -84,7 +84,7 @@ public class BluetoothInbandRingingPreferenceControllerTest { mController.onPreferenceChange(mPreference, true /* new value */); final boolean mode = SettingsShadowSystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, false /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); assertThat(mode).isTrue(); } Loading @@ -94,14 +94,14 @@ public class BluetoothInbandRingingPreferenceControllerTest { mController.onPreferenceChange(mPreference, false /* new value */); final boolean mode = SettingsShadowSystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, false /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); assertThat(mode).isFalse(); } @Test public void updateState_settingEnabled_preferenceShouldBeChecked() { SettingsShadowSystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, SettingsShadowSystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, Boolean.toString(true)); mController.updateState(mPreference); Loading @@ -110,7 +110,7 @@ public class BluetoothInbandRingingPreferenceControllerTest { @Test public void updateState_settingDisabled_preferenceShouldNotBeChecked() { SettingsShadowSystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, SettingsShadowSystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, Boolean.toString(false)); mController.updateState(mPreference); Loading @@ -122,11 +122,11 @@ public class BluetoothInbandRingingPreferenceControllerTest { mController.onDeveloperOptionsDisabled(); final boolean mode = SettingsShadowSystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, false /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); assertThat(mode).isTrue(); assertThat(mode).isFalse(); verify(mPreference).setEnabled(false); verify(mPreference).setChecked(true); verify(mPreference).setChecked(false); } @Test Loading Loading
res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -396,6 +396,11 @@ <!-- Summary for bluetooth item in connection detail page --> <string name="bluetooth_pref_summary">Allow device to pair and connect to bluetooth devices</string> <!-- Setting Checkbox title for disabling Bluetooth inband ringing in Development Settings --> <string name="bluetooth_disable_inband_ringing">Disable in-band ringing</string> <!-- Summary of checkbox for disabling Bluetooth inband ringing in Development Settings --> <string name="bluetooth_disable_inband_ringing_summary">Don’t play custom phone ringtones on Bluetooth headsets</string> <!-- Title for connected device group [CHAR LIMIT=none]--> <string name="connected_device_connected_title">Currently connected</string> <!-- Title for connected device group [CHAR LIMIT=none]--> Loading
res/xml/development_settings.xml +3 −3 Original line number Diff line number Diff line Loading @@ -240,9 +240,9 @@ android:summary="@string/bluetooth_disable_absolute_volume_summary"/> <SwitchPreference android:key="bluetooth_enable_inband_ringing" android:title="@string/bluetooth_enable_inband_ringing" android:summary="@string/bluetooth_enable_inband_ringing_summary"/> android:key="bluetooth_disable_inband_ringing" android:title="@string/bluetooth_disable_inband_ringing" android:summary="@string/bluetooth_disable_inband_ringing_summary"/> <ListPreference android:key="bluetooth_select_avrcp_version" Loading
src/com/android/settings/development/BluetoothInbandRingingPreferenceController.java +11 −12 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ public class BluetoothInbandRingingPreferenceController extends DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin { 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"; @VisibleForTesting static final String BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY = "persist.bluetooth.enableinbandringing"; static final String BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY = "persist.bluetooth.disableinbandringing"; private SwitchPreference mPreference; Loading @@ -50,7 +50,7 @@ public class BluetoothInbandRingingPreferenceController extends @Override public String getPreferenceKey() { return BLUETOOTH_ENABLE_INBAND_RINGING_KEY; return BLUETOOTH_DISABLE_INBAND_RINGING_KEY; } @Override Loading @@ -62,16 +62,16 @@ public class BluetoothInbandRingingPreferenceController extends @Override public boolean onPreferenceChange(Preference preference, Object newValue) { final boolean isEnabled = (Boolean) newValue; SystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, isEnabled ? "true" : "false"); final boolean isChecked = (Boolean) newValue; SystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, isChecked ? "true" : "false"); return true; } @Override public void updateState(Preference preference) { final boolean isEnabled = SystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, true /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); mPreference.setChecked(isEnabled); } Loading @@ -83,9 +83,8 @@ public class BluetoothInbandRingingPreferenceController extends @Override protected void onDeveloperOptionsSwitchDisabled() { mPreference.setEnabled(false); // the default setting for this preference is the enabled state mPreference.setChecked(true); SystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, "true"); mPreference.setChecked(false); SystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, "false"); } @VisibleForTesting Loading
tests/robotests/src/com/android/settings/development/BluetoothInbandRingingPreferenceControllerTest.java +8 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.settings.development; import static com.android.settings.development.BluetoothInbandRingingPreferenceController .BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY; .BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -84,7 +84,7 @@ public class BluetoothInbandRingingPreferenceControllerTest { mController.onPreferenceChange(mPreference, true /* new value */); final boolean mode = SettingsShadowSystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, false /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); assertThat(mode).isTrue(); } Loading @@ -94,14 +94,14 @@ public class BluetoothInbandRingingPreferenceControllerTest { mController.onPreferenceChange(mPreference, false /* new value */); final boolean mode = SettingsShadowSystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, false /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); assertThat(mode).isFalse(); } @Test public void updateState_settingEnabled_preferenceShouldBeChecked() { SettingsShadowSystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, SettingsShadowSystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, Boolean.toString(true)); mController.updateState(mPreference); Loading @@ -110,7 +110,7 @@ public class BluetoothInbandRingingPreferenceControllerTest { @Test public void updateState_settingDisabled_preferenceShouldNotBeChecked() { SettingsShadowSystemProperties.set(BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, SettingsShadowSystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, Boolean.toString(false)); mController.updateState(mPreference); Loading @@ -122,11 +122,11 @@ public class BluetoothInbandRingingPreferenceControllerTest { mController.onDeveloperOptionsDisabled(); final boolean mode = SettingsShadowSystemProperties.getBoolean( BLUETOOTH_ENABLE_INBAND_RINGING_PROPERTY, false /* default */); BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */); assertThat(mode).isTrue(); assertThat(mode).isFalse(); verify(mPreference).setEnabled(false); verify(mPreference).setChecked(true); verify(mPreference).setChecked(false); } @Test Loading