Merge "Fix memory leak of page "Languages & input""
am: f94ff6ce6f

Change-Id: Ie22f77eff353807e5a24cb6a2317b688f9b70193
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 3984c21..5e1a468 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -316,24 +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>1 (Default)</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 name="bluetooth_max_connected_audio_devices_values">
-        <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 bd7ce41..cdc7d22 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1606,11 +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>
 
-    <!-- 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/xml/development_prefs.xml b/res/xml/development_prefs.xml
index fb73ec4..bf83a5e 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -270,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/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index 40c827b..2d5c70f 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -215,9 +215,6 @@
     private static final String BLUETOOTH_BTSNOOP_ENABLE_PROPERTY =
                                     "persist.bluetooth.btsnoopenable";
 
-    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_SELECT_AVRCP_VERSION_KEY = "bluetooth_select_avrcp_version";
     private static final String BLUETOOTH_SELECT_A2DP_CODEC_KEY = "bluetooth_select_a2dp_codec";
@@ -225,8 +222,6 @@
     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";
 
@@ -306,7 +301,6 @@
     private ListPreference mBluetoothSelectA2dpBitsPerSample;
     private ListPreference mBluetoothSelectA2dpChannelMode;
     private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality;
-    private ListPreference mBluetoothSelectMaxConnectedAudioDevices;
 
     private SwitchPreference mOtaDisableAutomaticUpdate;
     private SwitchPreference mWifiAllowScansWithTraffic;
@@ -533,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();
@@ -1867,13 +1860,6 @@
         index = 3;
         mBluetoothSelectA2dpLdacPlaybackQuality.setValue(values[index]);
         mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(summaries[index]);
-
-        // Init the maximum connected devices - Default
-        values = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices_values);
-        summaries = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices);
-        index = 0;
-        mBluetoothSelectMaxConnectedAudioDevices.setValue(values[index]);
-        mBluetoothSelectMaxConnectedAudioDevices.setSummary(summaries[index]);
     }
 
     private void writeBluetoothAvrcpVersion(Object newValue) {
@@ -2042,15 +2028,6 @@
         }
     }
 
-    private void writeBluetoothMaxConnectedAudioDevices(Object newValue) {
-        SystemProperties.set(BLUETOOTH_MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, newValue.toString());
-        int index = mBluetoothSelectMaxConnectedAudioDevices.findIndexOfValue(newValue.toString());
-        if (index >= 0) {
-            String[] titles = getResources().getStringArray(R.array.bluetooth_max_connected_audio_devices);
-            mBluetoothSelectMaxConnectedAudioDevices.setSummary(titles[index]);
-        }
-    }
-
     private void writeBluetoothConfigurationOption(Preference preference,
                                                    Object newValue) {
         String[] summaries;
@@ -2647,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/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) {