diff options
author | Sumit Bajpai <sbajpai@codeaurora.org> | 2013-04-25 18:57:02 +0530 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2013-07-24 07:21:20 +0200 |
commit | a37ddac8d03e30996b3fbbef5d7adbbe8f9a05d2 (patch) | |
tree | 06909af010eaeee9939102e2b5be290eacdde9cf /services | |
parent | 4ff298acd7539011e192b75cd7f09c6b63487811 (diff) | |
download | frameworks_base-a37ddac8d03e30996b3fbbef5d7adbbe8f9a05d2.zip frameworks_base-a37ddac8d03e30996b3fbbef5d7adbbe8f9a05d2.tar.gz frameworks_base-a37ddac8d03e30996b3fbbef5d7adbbe8f9a05d2.tar.bz2 |
BT: Fix memory leak when BT on & off done many times
Solves a memory leak in BatteryStatsService when Bluetooth
is turn on/off. Solution adds missing close of proxy then
Bluetooth is turned off.
Change-Id: I65f9db298459c7c15f6a10c752992f1d38469445
CRs-Fixed: 476145
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/am/BatteryStatsService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/java/com/android/server/am/BatteryStatsService.java b/services/java/com/android/server/am/BatteryStatsService.java index ab20208..99cb2c8 100644 --- a/services/java/com/android/server/am/BatteryStatsService.java +++ b/services/java/com/android/server/am/BatteryStatsService.java @@ -330,6 +330,13 @@ public final class BatteryStatsService extends IBatteryStats.Stub { synchronized (mStats) { mBluetoothPendingStats = false; mStats.noteBluetoothOffLocked(); + mStats.setBtHeadset(null); + } + + BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); + if (adapter != null && mBluetoothHeadset != null) { + adapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset); + mBluetoothHeadset = null; } } |