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
2e07ea32
Commit
2e07ea32
authored
Oct 31, 2019
by
Sawyer Blatz
Browse files
Fixes #4908: Use notify instead of startForeground
parent
6f38790d
Changes
1
Show whitespace changes
Inline
Side-by-side
components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt
View file @
2e07ea32
...
...
@@ -91,9 +91,6 @@ abstract class AbstractFetchDownloadService : Service() {
}
ACTION_RESUME
->
{
NotificationManagerCompat
.
from
(
context
).
cancel
(
currentDownloadJobState
.
foregroundServiceId
)
currentDownloadJobState
.
status
=
DownloadJobStatus
.
ACTIVE
currentDownloadJobState
.
job
=
CoroutineScope
(
IO
).
launch
{
...
...
@@ -102,8 +99,11 @@ abstract class AbstractFetchDownloadService : Service() {
}
ACTION_CANCEL
->
{
NotificationManagerCompat
.
from
(
context
).
cancel
(
currentDownloadJobState
.
foregroundServiceId
)
currentDownloadJobState
.
status
=
DownloadJobStatus
.
CANCELLED
stopForeground
(
true
)
currentDownloadJobState
.
job
?.
cancel
()
}
...
...
@@ -219,8 +219,7 @@ abstract class AbstractFetchDownloadService : Service() {
download
)
// We want to startForeground so that the system is less likely to kill our service under memory pressure.
startForeground
(
NotificationManagerCompat
.
from
(
context
).
notify
(
downloadJobs
[
download
.
id
]
?.
foregroundServiceId
?:
0
,
ongoingDownloadNotification
)
...
...
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