diff options
author | janardhana rao bokka <quic_jbokka@quicinc.com> | 2022-05-04 21:01:49 +0530 |
---|---|---|
committer | janardhana rao bokka <quic_jbokka@quicinc.com> | 2022-05-04 21:10:32 +0530 |
commit | c8d9d51e0711dc40888eda02a9fdce62968b6569 (patch) | |
tree | 9044abe75084a97262ff499da1dc18fd604f4766 | |
parent | 22c38ddb34533bcb9fed795ef94fb66959d6cd69 (diff) |
Handling Pending scanClients when DeathReceipt triggers
Issue:
1. Pending Scan Clients are not getting deregistered
from stack when death receipt of app triggers.
2. Due to this gatt_if in the stacks are not getting
cleared and it leads to all gatt_if's are busy.
Fix:
Handling pending scanClients also when death receipt
of app triggered.
Change-Id: I540d9eea26ea7cbc407502c8f22efa299193693b
-rw-r--r-- | src/com/android/bluetooth/gatt/GattService.java | 6 | ||||
-rw-r--r-- | src/com/android/bluetooth/gatt/ScanManager.java | 19 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java index 6131bdd93..d9c3bbc6b 100644 --- a/src/com/android/bluetooth/gatt/GattService.java +++ b/src/com/android/bluetooth/gatt/GattService.java @@ -525,6 +525,11 @@ public class GattService extends ProfileService { return client; } } + for (ScanClient client : mScanManager.getPendingScanQueue()) { + if (client.scannerId == clientIf) { + return client; + } + } return null; } } @@ -2487,6 +2492,7 @@ public class GattService extends ProfileService { app.recordScanStart(settings, filters, isFilteredScan, isCallbackScan, scannerId); } + mScanManager.addPendingScanToQueue(scanClient); mScanManager.startScan(scanClient); } diff --git a/src/com/android/bluetooth/gatt/ScanManager.java b/src/com/android/bluetooth/gatt/ScanManager.java index 39f804370..826d368da 100644 --- a/src/com/android/bluetooth/gatt/ScanManager.java +++ b/src/com/android/bluetooth/gatt/ScanManager.java @@ -107,6 +107,7 @@ public class ScanManager { private Set<ScanClient> mRegularScanClients; private Set<ScanClient> mBatchClients; private Set<ScanClient> mSuspendedScanClients; + private Set<ScanClient> mPendingScanClients; private HashMap<Integer, Integer> mPriorityMap = new HashMap<Integer, Integer>(); private CountDownLatch mLatch; @@ -144,6 +145,8 @@ public class ScanManager { mRegularScanClients = Collections.newSetFromMap(new ConcurrentHashMap<ScanClient, Boolean>()); mBatchClients = Collections.newSetFromMap(new ConcurrentHashMap<ScanClient, Boolean>()); + mPendingScanClients = + Collections.newSetFromMap(new ConcurrentHashMap<ScanClient, Boolean>()); mSuspendedScanClients = Collections.newSetFromMap(new ConcurrentHashMap<ScanClient, Boolean>()); mService = service; @@ -179,6 +182,7 @@ public class ScanManager { mRegularScanClients.clear(); mBatchClients.clear(); mSuspendedScanClients.clear(); + mPendingScanClients.clear(); mScanNative.cleanup(); if (mActivityManager != null) { @@ -234,6 +238,19 @@ public class ScanManager { } /** + * Returns the pending scan queue. + */ + Set<ScanClient> getPendingScanQueue() { + return mPendingScanClients; + } + + /** + * Adding the pending scan to the queue. + */ + void addPendingScanToQueue(ScanClient client) { + mPendingScanClients.add(client); + } + /** * Returns a set of full batch scan clients. */ Set<ScanClient> getFullBatchScanQueue() { @@ -385,6 +402,8 @@ public class ScanManager { return; } + if (mPendingScanClients.contains(client)) + mPendingScanClients.remove(client); // Begin scan operations. if (isBatchClient(client)) { mBatchClients.add(client); |