Merge "Bluetooth: Use "Disable" in-band ringing instead of "Enable""
am: 80c0656ca6

Change-Id: Ifab1cde7af9421ce140c298df295c75e5e9055ed
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 788c1ac..a05fbfc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1601,6 +1601,11 @@
     <!-- Bluetooth settings.  Dock Setting Dialog - Remember setting and don't ask user again -->
     <string name="bluetooth_dock_settings_remember">Remember settings</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>
+
     <!-- Wifi Display settings. The title of the screen. [CHAR LIMIT=40] -->
     <string name="wifi_display_settings_title">Cast</string>
     <!-- Wifi Display settings. The title of a menu item to enable wireless display [CHAR LIMIT=40] -->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index ecfa5a8..bf83a5e 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -224,9 +224,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"
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index ffc5598..ffe9db4 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -210,12 +210,12 @@
             "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 @@
     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 @@
         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 @@
         }
         updateBluetoothShowDevicesWithoutUserFriendlyNameOptions();
         updateBluetoothDisableAbsVolumeOptions();
-        updateBluetoothEnableInbandRingingOptions();
+        updateBluetoothDisableInbandRingingOptions();
         updateBluetoothA2dpConfigurationValues();
         updatePrivateDnsSummary();
     }
@@ -872,10 +872,6 @@
                 onPreferenceTreeClick(cb);
             }
         }
-        if (mBluetoothEnableInbandRinging != null) {
-            mBluetoothEnableInbandRinging.setChecked(true);
-            onPreferenceTreeClick(mBluetoothEnableInbandRinging);
-        }
         mBugReportInPowerController.resetPreference();
         mEnableAdbController.resetPreference();
         resetDebuggerOptions();
@@ -1523,17 +1519,17 @@
                 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 @@
             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 {