diff options
| author | Jakub Pawlowski <jpawlowski@google.com> | 2020-11-16 15:54:00 +0100 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2021-02-06 22:55:21 -0500 |
| commit | 81b7697aeed2360e7b6e7d9626ad1465aa04e493 (patch) | |
| tree | 425b1ac7652a7e3eaad0226fb613ff81f39ca204 /src/com | |
| parent | b236fd262458d79af76c787ef7feb118cb336fb8 (diff) | |
Use same checks as for regular scan results
Bug: 172670415
Test: compilation
Merged-In: I4274026943ce64a51a30c3fbf6cc85eec853ad4f
Change-Id: I4274026943ce64a51a30c3fbf6cc85eec853ad4f
(cherry picked from commit f47a016eecb7e0e534b77219182607f4a7fd832c)
Diffstat (limited to 'src/com')
| -rw-r--r-- | src/com/android/bluetooth/gatt/GattService.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java index 5f2b42e7..032780da 100644 --- a/src/com/android/bluetooth/gatt/GattService.java +++ b/src/com/android/bluetooth/gatt/GattService.java @@ -1551,6 +1551,15 @@ public class GattService extends ProfileService { mScanManager.callbackDone(clientIf, status); } + ScanClient findBatchScanClientById(int scannerId) { + for (ScanClient client : mScanManager.getBatchScanQueue()) { + if (client.scannerId == scannerId) { + return client; + } + } + return null; + } + void onBatchScanReports(int status, int scannerId, int reportType, int numRecords, byte[] recordData) throws RemoteException { if (DBG) { @@ -1565,6 +1574,17 @@ public class GattService extends ProfileService { if (app == null) { return; } + + ScanClient client = findBatchScanClientById(scannerId); + if (client == null) { + return; + } + + // Do not report if location mode is OFF or the client has no location permission + if (!hasScanResultPermission(client)) { + return; + } + if (app.callback != null) { app.callback.onBatchScanResults(new ArrayList<ScanResult>(results)); } else { @@ -1606,6 +1626,12 @@ public class GattService extends ProfileService { if (app == null) { return; } + + // Do not report if location mode is OFF or the client has no location permission + if (!hasScanResultPermission(client)) { + return; + } + if (client.filters == null || client.filters.isEmpty()) { sendBatchScanResults(app, client, new ArrayList<ScanResult>(allResults)); // TODO: Question to reviewer: Shouldn't there be a return here? |
