summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/hdp
diff options
context:
space:
mode:
authorRavi Nagarajan <nravi@broadcom.com>2012-04-19 10:40:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-16 22:00:58 -0700
commit3fafe61ef25c1899fdc817c52163aec16c31055c (patch)
tree67db2408dbf66ae05d33e84188bf969f8ddf0fa8 /src/com/android/bluetooth/hdp
parentac234ef0ddd67471d82f77c41535a5ea1b68b443 (diff)
downloadandroid_packages_apps_Bluetooth-3fafe61ef25c1899fdc817c52163aec16c31055c.tar.gz
android_packages_apps_Bluetooth-3fafe61ef25c1899fdc817c52163aec16c31055c.tar.bz2
android_packages_apps_Bluetooth-3fafe61ef25c1899fdc817c52163aec16c31055c.zip
Memory profiling changes : Updated the Bluetooth code to handle cleaning up of object references (context, handlers, and collection objects ) during service cleanup.Memory profiling changes : Updated the Bluetooth code to handle cleaning up of object references (context, handlers, and collection objects ) during service cleanup.
Change-Id: I2b0235f71c1feaf32215b2aaf89a2e06d8fa7d73
Diffstat (limited to 'src/com/android/bluetooth/hdp')
-rwxr-xr-x[-rw-r--r--]src/com/android/bluetooth/hdp/HealthService.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/hdp/HealthService.java b/src/com/android/bluetooth/hdp/HealthService.java
index af6b0b6e7..8b8077665 100644..100755
--- a/src/com/android/bluetooth/hdp/HealthService.java
+++ b/src/com/android/bluetooth/hdp/HealthService.java
@@ -106,6 +106,23 @@ public class HealthService extends Service {
public void onDestroy() {
super.onDestroy();
if (DBG) log("Destroying service.");
+
+ //Cleanup other object references
+ if(mHealthChannels != null) {
+ mHealthChannels.clear();
+ mHealthChannels = null;
+ }
+ if(mHealthDevices != null) {
+ mHealthDevices.clear();
+ mHealthDevices = null;
+ }
+ if(mApps != null) {
+ mApps.clear();
+ mApps = null;
+ }
+ if(mAdapter != null)
+ mAdapter = null;
+
}
private void start() {
@@ -132,10 +149,12 @@ public class HealthService extends Service {
if (DBG) log("stop()");
//Cleanup looper
+ mHandler.removeCallbacksAndMessages(null);
Looper looper = mHandler.getLooper();
if (looper != null) {
looper.quit();
}
+ mHandler = null;
//Cleanup native
cleanupNative();