summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-01-22 19:49:20 +0100
committerByteHamster <info@bytehamster.com>2022-01-22 19:49:20 +0100
commit6e0ff29e7b52f1138397ef62e75d331f33029f02 (patch)
tree13b9e609a8e8e1ba622064da8d0bb157206177bc
parent3393bcdf350f60d006ce0de61d769f513490db82 (diff)
downloadantennapod-6e0ff29e7b52f1138397ef62e75d331f33029f02.zip
Unregister receiver before stopping the executor that is called from there
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
index dd445258e..982800b1c 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
@@ -257,6 +257,11 @@ public class DownloadService extends Service {
reportQueue.clear();
}
+ unregisterReceiver(cancelDownloadReceiver);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ connectionMonitor.disable(getApplicationContext());
+ }
+
EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList()));
cancelNotificationUpdater();
downloadHandleExecutor.shutdown();
@@ -266,10 +271,6 @@ public class DownloadService extends Service {
downloadPostFuture.cancel(true);
}
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
DBTasks.autodownloadUndownloadedItems(getApplicationContext());