Unregister receiver before stopping the executor that is called from there
This commit is contained in:
parent
3393bcdf35
commit
6e0ff29e7b
|
@ -257,6 +257,11 @@ public class DownloadService extends Service {
|
||||||
reportQueue.clear();
|
reportQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unregisterReceiver(cancelDownloadReceiver);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
connectionMonitor.disable(getApplicationContext());
|
||||||
|
}
|
||||||
|
|
||||||
EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList()));
|
EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList()));
|
||||||
cancelNotificationUpdater();
|
cancelNotificationUpdater();
|
||||||
downloadHandleExecutor.shutdown();
|
downloadHandleExecutor.shutdown();
|
||||||
|
@ -266,10 +271,6 @@ public class DownloadService extends Service {
|
||||||
downloadPostFuture.cancel(true);
|
downloadPostFuture.cancel(true);
|
||||||
}
|
}
|
||||||
downloads.clear();
|
downloads.clear();
|
||||||
unregisterReceiver(cancelDownloadReceiver);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
connectionMonitor.disable(getApplicationContext());
|
|
||||||
}
|
|
||||||
|
|
||||||
// start auto download in case anything new has shown up
|
// start auto download in case anything new has shown up
|
||||||
DBTasks.autodownloadUndownloadedItems(getApplicationContext());
|
DBTasks.autodownloadUndownloadedItems(getApplicationContext());
|
||||||
|
|
Loading…
Reference in New Issue