From db3ddf07eedbd82b7a446573fff2d5ed9595631f Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 16 Dec 2023 12:08:08 -0500 Subject: [PATCH] Set foreground service types for remaining jobs --- .../kanade/tachiyomi/data/backup/create/BackupCreateJob.kt | 7 +++++++ .../tachiyomi/data/backup/restore/BackupRestoreJob.kt | 7 +++++++ .../kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreateJob.kt index e4fcf6cd0..4ca6b056b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/create/BackupCreateJob.kt @@ -1,7 +1,9 @@ package eu.kanade.tachiyomi.data.backup.create import android.content.Context +import android.content.pm.ServiceInfo import android.net.Uri +import android.os.Build import androidx.core.net.toUri import androidx.work.BackoffPolicy import androidx.work.Constraints @@ -70,6 +72,11 @@ class BackupCreateJob(private val context: Context, workerParams: WorkerParamete return ForegroundInfo( Notifications.ID_BACKUP_PROGRESS, notifier.showBackupProgress().build(), + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC + } else { + 0 + }, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestoreJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestoreJob.kt index 507993d9c..9883eb023 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestoreJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestoreJob.kt @@ -1,7 +1,9 @@ package eu.kanade.tachiyomi.data.backup.restore import android.content.Context +import android.content.pm.ServiceInfo import android.net.Uri +import android.os.Build import androidx.core.net.toUri import androidx.work.CoroutineWorker import androidx.work.ExistingWorkPolicy @@ -54,6 +56,11 @@ class BackupRestoreJob(private val context: Context, workerParams: WorkerParamet return ForegroundInfo( Notifications.ID_RESTORE_PROGRESS, notifier.showRestoreProgress().build(), + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC + } else { + 0 + }, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt index a242485c4..073f2bb0d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateDownloadJob.kt @@ -1,6 +1,8 @@ package eu.kanade.tachiyomi.data.updater import android.content.Context +import android.content.pm.ServiceInfo +import android.os.Build import androidx.work.Constraints import androidx.work.CoroutineWorker import androidx.work.ExistingWorkPolicy @@ -55,6 +57,11 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar return ForegroundInfo( Notifications.ID_APP_UPDATER, notifier.onDownloadStarted().build(), + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC + } else { + 0 + }, ) }