Fix leaked NotificationProcessor in ScanJobsScheduler when scheduling and canceling scheduling
@@ -96,6 +96,10 @@ public class ScanJobScheduler {
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.cancel(ScanJob.getImmediateScanJobId(context));
jobScheduler.cancel(ScanJob.getPeriodicScanJobId(context));
+
+ if (mBeaconNotificationProcessor != null) {
+ mBeaconNotificationProcessor.unregister();
+ }
}
// This method appears to be never used, because it is only used by Android O APIs, which
