Merge "Fixed a memory leak in the bluetooth settings"
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 78c531c..16bb132 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -161,8 +161,6 @@
 
         // Repopulate (which isn't too bad since it's cached in the settings
         // bluetooth manager
-        mDevicePreferenceMap.clear();
-        mDeviceList.removeAll();
         addDevices();
 
         if (mScreenType == SCREEN_TYPE_SETTINGS) {
@@ -187,6 +185,9 @@
     protected void onPause() {
         super.onPause();
 
+        mDevicePreferenceMap.clear();
+        mDeviceList.removeAll();
+
         mLocalManager.setForegroundActivity(null);
         mDevicePreferenceMap.clear();
         mDeviceList.removeAll();