From 00fa2f578e2185ac959b5f9ecd68e50124ef2d58 Mon Sep 17 00:00:00 2001 From: Gustaf Nilklint Date: Tue, 4 Jan 2011 07:56:45 +0100 Subject: [PATCH] Fixed a memory leak in the bluetooth settings Release resources in onPause rather than onResume to fix a memory leak. Without this fix the app will crash if you are in Bluetooth settings and tap "Device name" and then roate the device a few times. Change-Id: I57a8346247c13f5113e7c4ea39dde5b29a7359bb --- src/com/android/settings/bluetooth/BluetoothSettings.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index 78c531ce333..16bb1327a14 100644 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -161,8 +161,6 @@ public class BluetoothSettings extends PreferenceActivity // 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 @@ public class BluetoothSettings extends PreferenceActivity protected void onPause() { super.onPause(); + mDevicePreferenceMap.clear(); + mDeviceList.removeAll(); + mLocalManager.setForegroundActivity(null); mDevicePreferenceMap.clear(); mDeviceList.removeAll();