Merge "Bluetooth: Enable AVDTP Delay reports by default."
am: f8ad32823c  -s ours

Change-Id: If7d482f107e0ce4924748c8b08334cfbbef491e8
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 2e4738b..5e1a468 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -316,26 +316,6 @@
         <item>Never time out</item>
     </string-array>
 
-    <!-- Bluetooth developer settings: Titles for maximum number of connected audio devices -->
-    <string-array name="bluetooth_max_connected_audio_devices">
-        <item>Use System Default: <xliff:g id="default_bluetooth_max_connected_audio_devices">%1$d</xliff:g></item>
-        <item>1</item>
-        <item>2</item>
-        <item>3</item>
-        <item>4</item>
-        <item>5</item>
-    </string-array>
-
-    <!-- Bluetooth developer settings: Values for maximum number of connected audio devices -->
-    <string-array translatable="false" name="bluetooth_max_connected_audio_devices_values">
-        <item></item>
-        <item>1</item>
-        <item>2</item>
-        <item>3</item>
-        <item>4</item>
-        <item>5</item>
-    </string-array>
-
     <!-- Match this with drawable.wifi_signal. --> <skip />
     <!-- Wi-Fi settings. The signal strength a Wi-Fi network has. -->
     <string-array name="wifi_signal">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0d7b095..79e8452 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -779,10 +779,8 @@
     <string name="encryption_and_credential_settings_title">Encryption &amp; credentials</string>
     <!-- Security Settings screen Encryption and crendential summary -->
     <string name="encryption_and_credential_settings_summary" product="default">Phone encrypted</string>
-    <string name="decryption_settings_summary" product="default">Phone not encrypted</string>
     <!-- Security Settings screen Encryption and crendential summary -->
     <string name="encryption_and_credential_settings_summary" product="tablet">Device encrypted</string>
-    <string name="decryption_settings_summary" product="tablet">Device not encrypted</string>
     <!-- Security Settings screen setting option title for the item to take you to the lock screen preference screen [CHAR LIMIT=60] -->
     <string name="lockscreen_settings_title">Lock screen preferences</string>
 
@@ -1608,16 +1606,6 @@
     <!-- 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>
 
-    <!-- Setting title for disabling Bluetooth delay reporting in Development Settings -->
-    <string name="bluetooth_disable_avdtp_delay_reports">Disable Bluetooth Audio Delay Report handling</string>
-    <!-- Summary of checkbox for disabling Bluetooth delay reporting in Development Settings -->
-    <string name="bluetooth_disable_avdtp_delay_reports_summary">Stop Handling Audio Delay Reports received from remote devices</string>
-
-    <!-- Bluetooth developer settings: Maximum number of connected audio devices -->
-    <string name="bluetooth_max_connected_audio_devices_string">Maximum number of 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>
-
     <!-- 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/values/styles_preference.xml b/res/values/styles_preference.xml
index 99ccdfc..056d55a 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -36,9 +36,4 @@
         <item name="android:widgetLayout">@layout/preference_widget_sync_toggle</item>
     </style>
 
-    <style name="SettingsMultiSelectListPreference" parent="Preference.SettingsBase">
-        <item name="android:positiveButtonText">@android:string/ok</item>
-        <item name="android:negativeButtonText">@android:string/cancel</item>
-    </style>
-
 </resources>
\ No newline at end of file
diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml
index 742a436..b1e332b 100644
--- a/res/xml/apn_editor.xml
+++ b/res/xml/apn_editor.xml
@@ -157,7 +157,6 @@
         android:entries="@array/bearer_entries"
         android:entryValues="@array/bearer_values"
         android:persistent="false"
-        style="@style/SettingsMultiSelectListPreference"
         />
     <ListPreference
         android:title="@string/mvno_type"
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index db01394..bf83a5e 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -228,11 +228,6 @@
             android:title="@string/bluetooth_disable_inband_ringing"
             android:summary="@string/bluetooth_disable_inband_ringing_summary"/>
 
-        <SwitchPreference
-            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"
             android:title="@string/bluetooth_select_avrcp_version_string"
@@ -275,13 +270,6 @@
             android:entries="@array/bluetooth_a2dp_codec_ldac_playback_quality_titles"
             android:entryValues="@array/bluetooth_a2dp_codec_ldac_playback_quality_values" />
 
-        <ListPreference
-            android:key="bluetooth_max_connected_audio_devices"
-            android:title="@string/bluetooth_max_connected_audio_devices_string"
-            android:dialogTitle="@string/bluetooth_max_connected_audio_devices_dialog_title"
-            android:entries="@array/bluetooth_max_connected_audio_devices"
-            android:entryValues="@array/bluetooth_max_connected_audio_devices_values" />
-
         <com.android.settings.development.PrivateDnsModeDialogPreference
             android:key="select_private_dns_configuration"
             android:title="@string/select_private_dns_configuration_title"
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index ade4782..7946dd9 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -60,6 +60,7 @@
     <Preference
         android:key="encryption_and_credential"
         android:title="@string/encryption_and_credential_settings_title"
+        android:summary="@string/encryption_and_credential_settings_summary"
         android:fragment="com.android.settings.EncryptionAndCredential"/>
 
     <Preference android:key="manage_trust_agents"
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 23b149a..55f21fd 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -427,17 +427,6 @@
         mEnterprisePrivacyPreferenceController.displayPreference(root);
         mEnterprisePrivacyPreferenceController.onResume();
 
-        final Preference encryptioncredential = root.findPreference(KEY_ENCRYPTION_AND_CREDENTIALS);
-        if (LockPatternUtils.isDeviceEncryptionEnabled()) {
-                final String summaryencrypt = getContext().getString(
-                        R.string.encryption_and_credential_settings_summary);
-                encryptioncredential.setSummary(summaryencrypt);
-        } else {
-                final String summarydecrypt = getContext().getString(
-                        R.string.decryption_settings_summary);
-                encryptioncredential.setSummary(summarydecrypt);
-        }
-
         return root;
     }
 
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index e0ae111..2d5c70f 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -214,22 +214,14 @@
                                     "persist.bluetooth.disableinbandringing";
     private static final String BLUETOOTH_BTSNOOP_ENABLE_PROPERTY =
                                     "persist.bluetooth.btsnoopenable";
-    private static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY =
-            "persist.bluetooth.disabledelayreports";
-
-    static final String BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY =
-            "persist.bluetooth.maxconnectedaudiodevices";
 
     private static final String BLUETOOTH_DISABLE_INBAND_RINGING_KEY = "bluetooth_disable_inband_ringing";
-    private static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY = "bluetooth_disable_avdtp_delay_reports";
     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";
     private static final String BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY = "bluetooth_select_a2dp_bits_per_sample";
     private static final String BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY = "bluetooth_select_a2dp_channel_mode";
     private static final String BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY = "bluetooth_select_a2dp_ldac_playback_quality";
-    private static final String BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_KEY =
-            "bluetooth_max_connected_audio_devices";
 
     private static final String PRIVATE_DNS_PREF_KEY = "select_private_dns_configuration";
 
@@ -300,7 +292,6 @@
     private SwitchPreference mBluetoothShowDevicesWithoutNames;
     private SwitchPreference mBluetoothDisableAbsVolume;
     private SwitchPreference mBluetoothDisableInbandRinging;
-    private SwitchPreference mBluetoothDisableAvdtpDelayReport;
 
     private BluetoothA2dp mBluetoothA2dp;
     private final Object mBluetoothA2dpLock = new Object();
@@ -310,7 +301,6 @@
     private ListPreference mBluetoothSelectA2dpBitsPerSample;
     private ListPreference mBluetoothSelectA2dpChannelMode;
     private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality;
-    private ListPreference mBluetoothSelectMaxConnectedAudioDevices;
 
     private SwitchPreference mOtaDisableAutomaticUpdate;
     private SwitchPreference mWifiAllowScansWithTraffic;
@@ -530,7 +520,6 @@
             removePreference(mBluetoothDisableInbandRinging);
             mBluetoothDisableInbandRinging = null;
         }
-        mBluetoothDisableAvdtpDelayReport = findAndInitSwitchPref(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY);
 
         mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
         mBluetoothSelectA2dpCodec = addListPreference(BLUETOOTH_SELECT_A2DP_CODEC_KEY);
@@ -538,7 +527,6 @@
         mBluetoothSelectA2dpBitsPerSample = addListPreference(BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY);
         mBluetoothSelectA2dpChannelMode = addListPreference(BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY);
         mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
-        mBluetoothSelectMaxConnectedAudioDevices = addListPreference(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_KEY);
         initBluetoothConfigurationValues();
 
         updatePrivateDnsSummary();
@@ -873,7 +861,6 @@
         updateBluetoothShowDevicesWithoutUserFriendlyNameOptions();
         updateBluetoothDisableAbsVolumeOptions();
         updateBluetoothDisableInbandRingingOptions();
-        updateBluetoothDisableAvdtpDelayReportOptions();
         updateBluetoothA2dpConfigurationValues();
         updatePrivateDnsSummary();
     }
@@ -901,7 +888,6 @@
         }
         writeOverlayDisplayDevicesOptions(null);
         writeAppProcessLimitOptions(null);
-        writeBluetoothMaxConnectedAudioDevices("");
         mHaveDebugSettings = false;
         updateAllOptions();
         mDontPokeProperties = false;
@@ -1549,16 +1535,6 @@
         }
     }
 
-    private void updateBluetoothDisableAvdtpDelayReportOptions() {
-        updateSwitchPreference(mBluetoothDisableAvdtpDelayReport,
-                SystemProperties.getBoolean(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false));
-    }
-
-    private void writeBluetoothDisableAvdtpDelayReportOptions() {
-        SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
-                mBluetoothDisableAvdtpDelayReport.isChecked() ? "true" : "false");
-    }
-
     private void updateMobileDataAlwaysOnOptions() {
         updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt(
                 getActivity().getContentResolver(),
@@ -1884,45 +1860,6 @@
         index = 3;
         mBluetoothSelectA2dpLdacPlaybackQuality.setValue(values[index]);
         mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]);
-
-        // Init the maximum connected devices
-        initBluetoothMaxConnectedAudioDevicesPreference();
-        updateBluetoothMaxConnectedAudioDevicesPreference();
-    }
-
-    private void initBluetoothMaxConnectedAudioDevicesPreference() {
-        int defaultMaxConnectedAudioDevices = getResources().getInteger(
-                com.android.internal.R.integer.config_bluetooth_max_connected_audio_devices);
-        final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries();
-        entries[0] = String.format(entries[0].toString(), defaultMaxConnectedAudioDevices);
-        mBluetoothSelectMaxConnectedAudioDevices.setEntries(entries);
-    }
-
-    private void updateBluetoothMaxConnectedAudioDevicesPreference() {
-        final CharSequence[] entries = mBluetoothSelectMaxConnectedAudioDevices.getEntries();
-        final String currentValue =
-                SystemProperties.get(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY);
-        int index = 0;
-        if (!currentValue.isEmpty()) {
-            index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(currentValue);
-            if (index < 0) {
-                // Reset property value when value is illegal
-                SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, "");
-                index = 0;
-            }
-        }
-        mBluetoothSelectMaxConnectedAudioDevices.setValueIndex(index);
-        mBluetoothSelectMaxConnectedAudioDevices.setSummary(entries[index]);
-    }
-
-    private void writeBluetoothMaxConnectedAudioDevices(Object newValue) {
-        String newValueString = newValue.toString();
-        if (mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValueString) <= 0) {
-            // Reset property value when default is chosen or when value is illegal
-            newValueString = "";
-        }
-        SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValueString);
-        updateBluetoothMaxConnectedAudioDevicesPreference();
     }
 
     private void writeBluetoothAvrcpVersion(Object newValue) {
@@ -2656,8 +2593,6 @@
             writeBluetoothDisableAbsVolumeOptions();
         } else if (preference == mBluetoothDisableInbandRinging) {
             writeBluetoothDisableInbandRingingOptions();
-        } else if (preference == mBluetoothDisableAvdtpDelayReport) {
-            writeBluetoothDisableAvdtpDelayReportOptions();
         } else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
             resetShortcutManagerThrottling();
         } else {
@@ -2689,9 +2624,6 @@
                    (preference == mBluetoothSelectA2dpLdacPlaybackQuality)) {
             writeBluetoothConfigurationOption(preference, newValue);
             return true;
-        } else if (preference == mBluetoothSelectMaxConnectedAudioDevices) {
-            writeBluetoothMaxConnectedAudioDevices(newValue);
-            return true;
         } else if (preference == mLogdSize) {
             writeLogdSizeOption(newValue);
             return true;
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index d61b71c..190af4d 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -37,7 +37,6 @@
 import android.net.wifi.WpsInfo;
 import android.nfc.NfcAdapter;
 import android.os.Bundle;
-import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.PowerManager;
 import android.os.Process;
@@ -704,10 +703,6 @@
     private void updateAccessPointsDelayed() {
         // Safeguard from some delayed event handling
         if (getActivity() != null && !mIsRestricted && mWifiManager.isWifiEnabled()) {
-            Handler handler = getView().getHandler();
-            if (handler != null && handler.hasCallbacks(mUpdateAccessPointsRunnable)) {
-                return;
-            }
             setProgressBarVisible(true);
             getView().postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
         }
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index 02883e3..c0c0ccf 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -21,7 +21,6 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_PACKAGE_NAME := SettingsTests
-LOCAL_PRIVATE_PLATFORM_APIS := true
 
 LOCAL_INSTRUMENTATION_FOR := Settings
 
diff --git a/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java b/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java
index be1a599..4455549 100644
--- a/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java
+++ b/tests/robotests/src/com/android/settings/core/instrumentation/InstrumentableFragmentCodeInspector.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.core.instrumentation;
 
-import static com.google.common.truth.Truth.assertWithMessage;
-
 import android.app.Fragment;
 import android.util.ArraySet;
 
@@ -27,6 +25,8 @@
 import java.util.List;
 import java.util.Set;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
 /**
  * {@link CodeInspector} that verifies all fragments implements Instrumentable.
  */
@@ -67,5 +67,7 @@
         assertWithMessage(sb.toString())
                 .that(broken.isEmpty())
                 .isTrue();
+        assertNoObsoleteInGrandfatherList("grandfather_not_implementing_instrumentable",
+                grandfather_notImplementingInstrumentable);
     }
 }
diff --git a/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java b/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java
index 0769af5..b4a91c5 100644
--- a/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java
+++ b/tests/robotests/src/com/android/settings/search/SearchIndexProviderCodeInspector.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.search;
 
-import static com.google.common.truth.Truth.assertWithMessage;
-
 import android.util.ArraySet;
 import android.util.Log;
 
@@ -30,6 +28,8 @@
 import java.util.List;
 import java.util.Set;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
 /**
  * {@link CodeInspector} to ensure fragments implement search components correctly.
  */
@@ -144,6 +144,15 @@
         assertWithMessage(notInProviderRegistryError)
                 .that(notInSearchProviderRegistry)
                 .isEmpty();
+        assertNoObsoleteInGrandfatherList("grandfather_not_implementing_indexable",
+                notImplementingIndexableGrandfatherList);
+        assertNoObsoleteInGrandfatherList("grandfather_not_implementing_index_provider",
+                notImplementingIndexProviderGrandfatherList);
+        assertNoObsoleteInGrandfatherList("grandfather_not_in_search_index_provider_registry",
+                notInSearchIndexableRegistryGrandfatherList);
+        assertNoObsoleteInGrandfatherList(
+                "grandfather_not_sharing_pref_controllers_with_search_provider",
+                notSharingPrefControllersGrandfatherList);
     }
 
     private boolean hasSearchIndexProvider(Class clazz) {