OSDN Git Service

Bluetooth: Enable AVDTP Delay reports by default.
authorAjay Panicker <apanicke@google.com>
Wed, 7 Mar 2018 23:55:02 +0000 (15:55 -0800)
committerAjay Panicker <apanicke@google.com>
Fri, 9 Mar 2018 21:21:45 +0000 (21:21 +0000)
Bug: 32755225
Test: See that delay reports are enabled when connecting to device
Change-Id: Icba9be6fc8ba455d37df39d283e36129f6acb536
(cherry picked from commit a8cf0b9371bf9bcb2b92243ec29b822f1f021098)

res/values/strings.xml
res/xml/development_settings.xml
src/com/android/settings/development/BluetoothDelayReportsPreferenceController.java
tests/robotests/src/com/android/settings/development/BluetoothDelayReportsPreferenceControllerTest.java

index c64880e..fdb83b3 100644 (file)
     <string name="bluetooth_max_connected_audio_devices_string">Maximum connected Bluetooth audio devices</string>
     <!-- Bluetooth developer settings: Maximum number of connected audio devices -->
     <string name="bluetooth_max_connected_audio_devices_dialog_title">Select maximum number of connected Bluetooth audio devices</string>
-    <!-- Bluetooth developer settings: Checkbox title for enabling Bluetooth receiving AVDTP delay reports -->
-    <string name="bluetooth_enable_avdtp_delay_reports">Enable Bluetooth AVDTP delay reports</string>
-    <!-- Bluetooth developer settings: Summary of checkbox for enabling Bluetooth receiving AVDTP delay reports -->
-    <string name="bluetooth_enable_avdtp_delay_reports_summary">Allow receiving Bluetooth AVDTP delay reports</string>
+    <!-- Bluetooth developer settings: Checkbox title for disabling Bluetooth receiving AVDTP delay reports -->
+    <string name="bluetooth_disable_avdtp_delay_reports">Disable Bluetooth AVDTP delay reports</string>
+    <!-- Bluetooth developer settings: Summary of checkbox for disabling Bluetooth receiving AVDTP delay reports -->
+    <string name="bluetooth_disable_avdtp_delay_reports_summary">Disallow receiving Bluetooth AVDTP delay reports</string>
 
     <!-- Wifi Display settings. The title of the screen. [CHAR LIMIT=40] -->
     <string name="wifi_display_settings_title">Cast</string>
index 571f38e..282a512 100644 (file)
             android:summary="@string/bluetooth_disable_inband_ringing_summary" />
 
         <SwitchPreference
-            android:key="bluetooth_enable_avdtp_delay_reports"
-            android:title="@string/bluetooth_enable_avdtp_delay_reports"
-            android:summary="@string/bluetooth_enable_avdtp_delay_reports_summary"/>
+            android:key="bluetooth_disable_avdtp_delay_reports"
+            android:title="@string/bluetooth_disable_avdtp_delay_reports"
+            android:summary="@string/bluetooth_disable_avdtp_delay_reports_summary"/>
 
         <ListPreference
             android:key="bluetooth_select_avrcp_version"
index 0858555..6c7a7dd 100644 (file)
@@ -28,11 +28,11 @@ import com.android.settingslib.development.DeveloperOptionsPreferenceController;
 public class BluetoothDelayReportsPreferenceController extends DeveloperOptionsPreferenceController
         implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
 
-    private static final String BLUETOOTH_ENABLE_AVDTP_DELAY_REPORT_KEY =
-            "bluetooth_enable_avdtp_delay_reports";
+    private static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY =
+            "bluetooth_disable_avdtp_delay_reports";
     @VisibleForTesting
-    static final String BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY =
-            "persist.bluetooth.enabledelayreports";
+    static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY =
+            "persist.bluetooth.disabledelayreports";
 
     public BluetoothDelayReportsPreferenceController(Context context) {
         super(context);
@@ -40,22 +40,22 @@ public class BluetoothDelayReportsPreferenceController extends DeveloperOptionsP
 
     @Override
     public String getPreferenceKey() {
-        return BLUETOOTH_ENABLE_AVDTP_DELAY_REPORT_KEY;
+        return BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY;
     }
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
-        final boolean isEnabled = (Boolean) newValue;
-        SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY,
-                isEnabled ? "true" : "false");
+        final boolean isDisabled = (Boolean) newValue;
+        SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
+                isDisabled ? "true" : "false");
         return true;
     }
 
     @Override
     public void updateState(Preference preference) {
-        final boolean isEnabled = SystemProperties.getBoolean(
-                BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
-        ((SwitchPreference) mPreference).setChecked(isEnabled);
+        final boolean isDisabled = SystemProperties.getBoolean(
+                BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
+        ((SwitchPreference) mPreference).setChecked(isDisabled);
     }
 
     @Override
@@ -63,7 +63,7 @@ public class BluetoothDelayReportsPreferenceController extends DeveloperOptionsP
         super.onDeveloperOptionsSwitchDisabled();
         // the default setting for this preference is the disabled state
         ((SwitchPreference) mPreference).setChecked(false);
-        SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, "false");
+        SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, "false");
     }
 
 }
index d529fc1..bdaad0a 100644 (file)
@@ -16,7 +16,9 @@
 
 package com.android.settings.development;
 
-import static com.android.settings.development.BluetoothDelayReportsPreferenceController.BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY;
+import static com.android.settings.development.BluetoothDelayReportsPreferenceController
+        .BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY;
+
 import static com.google.common.truth.Truth.assertThat;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
@@ -57,11 +59,11 @@ public class BluetoothDelayReportsPreferenceControllerTest {
     }
 
     @Test
-    public void onPreferenceChanged_settingEnabled_turnOnDelayReports() {
+    public void onPreferenceChanged_settingDisabled_turnOnDelayReports() {
         mController.onPreferenceChange(mPreference, true /* new value */);
 
         final boolean mode = SystemProperties.getBoolean(
-                BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
+                BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
 
         assertThat(mode).isTrue();
     }
@@ -71,14 +73,14 @@ public class BluetoothDelayReportsPreferenceControllerTest {
         mController.onPreferenceChange(mPreference, false /* new value */);
 
         final boolean mode = SystemProperties.getBoolean(
-                BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
+                BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
 
         assertThat(mode).isFalse();
     }
 
     @Test
-    public void updateState_settingEnabled_preferenceShouldBeChecked() {
-        SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY,
+    public void updateState_settingDisabled_preferenceShouldBeChecked() {
+        SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
                 Boolean.toString(true));
         mController.updateState(mPreference);
 
@@ -87,7 +89,7 @@ public class BluetoothDelayReportsPreferenceControllerTest {
 
     @Test
     public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
-        SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY,
+        SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
                 Boolean.toString(false));
         mController.updateState(mPreference);
 
@@ -99,10 +101,10 @@ public class BluetoothDelayReportsPreferenceControllerTest {
         mController.onDeveloperOptionsDisabled();
 
         final boolean mode = SystemProperties.getBoolean(
-                BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
+                BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
 
         assertThat(mode).isFalse();
         assertThat(mPreference.isEnabled()).isFalse();
         assertThat(mPreference.isChecked()).isFalse();
     }
-}
\ No newline at end of file
+}