Commit bae2b923 authored by MozLando's avatar MozLando
Browse files

Merge #4909



4909: Fixes #4908: Use notify instead of startForeground r=notwoods a=sblatz
Co-authored-by: default avatarSawyer Blatz <sdblatz@gmail.com>
parents 464f2b0c 2e07ea32
...@@ -91,9 +91,6 @@ abstract class AbstractFetchDownloadService : Service() { ...@@ -91,9 +91,6 @@ abstract class AbstractFetchDownloadService : Service() {
} }
ACTION_RESUME -> { ACTION_RESUME -> {
NotificationManagerCompat.from(context).cancel(
currentDownloadJobState.foregroundServiceId
)
currentDownloadJobState.status = DownloadJobStatus.ACTIVE currentDownloadJobState.status = DownloadJobStatus.ACTIVE
currentDownloadJobState.job = CoroutineScope(IO).launch { currentDownloadJobState.job = CoroutineScope(IO).launch {
...@@ -102,8 +99,11 @@ abstract class AbstractFetchDownloadService : Service() { ...@@ -102,8 +99,11 @@ abstract class AbstractFetchDownloadService : Service() {
} }
ACTION_CANCEL -> { ACTION_CANCEL -> {
NotificationManagerCompat.from(context).cancel(
currentDownloadJobState.foregroundServiceId
)
currentDownloadJobState.status = DownloadJobStatus.CANCELLED currentDownloadJobState.status = DownloadJobStatus.CANCELLED
stopForeground(true)
currentDownloadJobState.job?.cancel() currentDownloadJobState.job?.cancel()
} }
...@@ -219,8 +219,7 @@ abstract class AbstractFetchDownloadService : Service() { ...@@ -219,8 +219,7 @@ abstract class AbstractFetchDownloadService : Service() {
download download
) )
// We want to startForeground so that the system is less likely to kill our service under memory pressure. NotificationManagerCompat.from(context).notify(
startForeground(
downloadJobs[download.id]?.foregroundServiceId ?: 0, downloadJobs[download.id]?.foregroundServiceId ?: 0,
ongoingDownloadNotification ongoingDownloadNotification
) )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment