summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Eisenbach <eisenbach@google.com>2016-10-06 17:39:31 -0700
committerAndre Eisenbach <eisenbach@google.com>2016-10-06 17:42:20 -0700
commit5185d1989c93faa3ce4b4410ef49a0205f43b239 (patch)
tree9180534418f5aac89bec6735bb1d18bf76a4327f
parentc295ebb2a781b86550e54639d7488a5b1aa7ab29 (diff)
downloadandroid_packages_apps_Bluetooth-5185d1989c93faa3ce4b4410ef49a0205f43b239.tar.gz
android_packages_apps_Bluetooth-5185d1989c93faa3ce4b4410ef49a0205f43b239.tar.bz2
android_packages_apps_Bluetooth-5185d1989c93faa3ce4b4410ef49a0205f43b239.zip
Ensure LE scan clients are removed when the related app dies
Use the passed in ScanClient in handleStopScan() to ensure that the client appDied flag is in the correct state to ensure proper removal of the client application reference. Bug: 30681588 Change-Id: I0e0067a8e21ebd5f89870a7054b1f4092fe63ae1
-rw-r--r--src/com/android/bluetooth/gatt/ScanManager.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/com/android/bluetooth/gatt/ScanManager.java b/src/com/android/bluetooth/gatt/ScanManager.java
index 5eb31e17d..7dceb2835 100644
--- a/src/com/android/bluetooth/gatt/ScanManager.java
+++ b/src/com/android/bluetooth/gatt/ScanManager.java
@@ -253,10 +253,6 @@ public class ScanManager {
if (client == null) return;
if (mRegularScanClients.contains(client)) {
- // The ScanClient passed in just holds the clientIf. We retrieve the real client,
- // which may have workSource set.
- client = mScanNative.getRegularScanClient(client.clientIf);
- if (client == null) return;
mScanNative.stopRegularScan(client);
@@ -270,7 +266,11 @@ public class ScanManager {
// Update BatteryStats with this workload.
try {
- mBatteryStats.noteBleScanStopped(client.workSource);
+ // The ScanClient passed in just holds the clientIf. We retrieve the real client,
+ // which may have workSource set.
+ ScanClient workClient = mScanNative.getRegularScanClient(client.clientIf);
+ if (workClient != null)
+ mBatteryStats.noteBleScanStopped(workClient.workSource);
} catch (RemoteException e) {
/* ignore */
}