Loading android/app/src/com/android/bluetooth/gatt/GattService.java +14 −2 Original line number Original line Diff line number Diff line Loading @@ -147,6 +147,14 @@ public class GattService extends ProfileService { } } } } private final PendingIntent.CancelListener mScanIntentCancelListener = new PendingIntent.CancelListener(){ public void onCancelled(PendingIntent intent) { Log.d(TAG, "scanning PendingIntent cancelled"); stopScan(intent); } }; /** /** * List of our registered scanners. * List of our registered scanners. */ */ Loading Loading @@ -515,7 +523,7 @@ public class GattService extends ProfileService { if (service == null) { if (service == null) { return; return; } } service.stopScan(intent, callingPackage); service.stopScan(intent); } } @Override @Override Loading Loading @@ -2174,6 +2182,9 @@ public class GattService extends ProfileService { } } ScannerMap.App app = mScannerMap.add(uuid, null, null, piInfo, this); ScannerMap.App app = mScannerMap.add(uuid, null, null, piInfo, this); pendingIntent.registerCancelListener(mScanIntentCancelListener); app.mUserHandle = UserHandle.of(UserHandle.getCallingUserId()); app.mUserHandle = UserHandle.of(UserHandle.getCallingUserId()); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); app.mEligibleForSanitizedExposureNotification = app.mEligibleForSanitizedExposureNotification = Loading Loading @@ -2250,7 +2261,7 @@ public class GattService extends ProfileService { mScanManager.stopScan(scannerId); mScanManager.stopScan(scannerId); } } void stopScan(PendingIntent intent, String callingPackage) { void stopScan(PendingIntent intent) { enforceAdminPermission(); enforceAdminPermission(); PendingIntentInfo pii = new PendingIntentInfo(); PendingIntentInfo pii = new PendingIntentInfo(); pii.intent = intent; pii.intent = intent; Loading @@ -2259,6 +2270,7 @@ public class GattService extends ProfileService { Log.d(TAG, "stopScan(PendingIntent): app found = " + app); Log.d(TAG, "stopScan(PendingIntent): app found = " + app); } } if (app != null) { if (app != null) { intent.unregisterCancelListener(mScanIntentCancelListener); final int scannerId = app.id; final int scannerId = app.id; stopScan(scannerId); stopScan(scannerId); // Also unregister the scanner // Also unregister the scanner Loading Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +14 −2 Original line number Original line Diff line number Diff line Loading @@ -147,6 +147,14 @@ public class GattService extends ProfileService { } } } } private final PendingIntent.CancelListener mScanIntentCancelListener = new PendingIntent.CancelListener(){ public void onCancelled(PendingIntent intent) { Log.d(TAG, "scanning PendingIntent cancelled"); stopScan(intent); } }; /** /** * List of our registered scanners. * List of our registered scanners. */ */ Loading Loading @@ -515,7 +523,7 @@ public class GattService extends ProfileService { if (service == null) { if (service == null) { return; return; } } service.stopScan(intent, callingPackage); service.stopScan(intent); } } @Override @Override Loading Loading @@ -2174,6 +2182,9 @@ public class GattService extends ProfileService { } } ScannerMap.App app = mScannerMap.add(uuid, null, null, piInfo, this); ScannerMap.App app = mScannerMap.add(uuid, null, null, piInfo, this); pendingIntent.registerCancelListener(mScanIntentCancelListener); app.mUserHandle = UserHandle.of(UserHandle.getCallingUserId()); app.mUserHandle = UserHandle.of(UserHandle.getCallingUserId()); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); app.mEligibleForSanitizedExposureNotification = app.mEligibleForSanitizedExposureNotification = Loading Loading @@ -2250,7 +2261,7 @@ public class GattService extends ProfileService { mScanManager.stopScan(scannerId); mScanManager.stopScan(scannerId); } } void stopScan(PendingIntent intent, String callingPackage) { void stopScan(PendingIntent intent) { enforceAdminPermission(); enforceAdminPermission(); PendingIntentInfo pii = new PendingIntentInfo(); PendingIntentInfo pii = new PendingIntentInfo(); pii.intent = intent; pii.intent = intent; Loading @@ -2259,6 +2270,7 @@ public class GattService extends ProfileService { Log.d(TAG, "stopScan(PendingIntent): app found = " + app); Log.d(TAG, "stopScan(PendingIntent): app found = " + app); } } if (app != null) { if (app != null) { intent.unregisterCancelListener(mScanIntentCancelListener); final int scannerId = app.id; final int scannerId = app.id; stopScan(scannerId); stopScan(scannerId); // Also unregister the scanner // Also unregister the scanner Loading