diff options
author | Tobias Kaminsky <tobias@kaminsky.me> | 2021-07-06 13:26:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 13:26:57 +0300 |
commit | ffa5c494f8c27e22b0fea1a0a6f98ed90a6af32d (patch) | |
tree | 6f5b8c59d3b89f24c8f9cc7d97e08d7a8acd6429 | |
parent | b9b97913ce0269532b8c7de474eaf43c14fee143 (diff) | |
parent | 0405b735b98ea503f8a78f495b0975bb7f82cc29 (diff) |
Merge pull request #8666 from nextcloud/backport/8630/stable-3.17rc-3.17.0-01
[stable-3.17] move service dismissal to handler to prevent race-condition
-rw-r--r-- | src/main/java/com/owncloud/android/files/services/FileDownloader.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/com/owncloud/android/files/services/FileDownloader.java b/src/main/java/com/owncloud/android/files/services/FileDownloader.java index 1600481f19..cccd75af44 100644 --- a/src/main/java/com/owncloud/android/files/services/FileDownloader.java +++ b/src/main/java/com/owncloud/android/files/services/FileDownloader.java @@ -182,7 +182,6 @@ public class FileDownloader extends Service // remove AccountsUpdatedListener AccountManager am = AccountManager.get(getApplicationContext()); am.removeOnAccountsUpdatedListener(this); - super.onDestroy(); } @@ -423,18 +422,16 @@ public class FileDownloader extends Service } } mService.mStartedDownload=false; - (new Handler()).postDelayed(new Runnable(){ - public void run() { - if(!mService.mStartedDownload){ - mService.mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker); - } - }}, 2000); - - Log_OC.d(TAG, "Stopping after command with id " + msg.arg1); - mService.mNotificationManager.cancel(FOREGROUND_SERVICE_ID); - mService.stopForeground(true); - mService.stopSelf(msg.arg1); + (new Handler()).postDelayed(() -> { + if(!mService.mStartedDownload){ + mService.mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker); + } + Log_OC.d(TAG, "Stopping after command with id " + msg.arg1); + mService.mNotificationManager.cancel(FOREGROUND_SERVICE_ID); + mService.stopForeground(true); + mService.stopSelf(msg.arg1); + }, 2000); } } |