Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
ed5811af
Commit
ed5811af
authored
Nov 26, 2019
by
Sebastian Kaspari
Browse files
AbstractFetchDownloadService: Remove notifications when task gets removed.
parent
af942d90
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt
View file @
ed5811af
...
...
@@ -185,8 +185,22 @@ abstract class AbstractFetchDownloadService : Service() {
return
super
.
onStartCommand
(
intent
,
flags
,
startId
)
}
override
fun
onTaskRemoved
(
rootIntent
:
Intent
?)
{
// If the task gets removed (app gets swiped away in the task switcher) our process and this
// servies gets killed. In this situation we remove the notification since the download will
// stop and cannot be controlled via the notification anymore (until we persist enough data
// to resume downloads from a new process).
val
notificationManager
=
NotificationManagerCompat
.
from
(
this
)
downloadJobs
.
values
.
forEach
{
state
->
notificationManager
.
cancel
(
state
.
foregroundServiceId
)
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
downloadJobs
.
values
.
forEach
{
it
.
job
?.
cancel
()
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment