diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cc485f7a..80fd2bcb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ + @@ -43,8 +44,18 @@ - - + + + + + + diff --git a/app/src/main/java/org/lineageos/updater/ExportUpdateService.java b/app/src/main/java/org/lineageos/updater/ExportUpdateService.java index 1c72ad20..4403d7f2 100644 --- a/app/src/main/java/org/lineageos/updater/ExportUpdateService.java +++ b/app/src/main/java/org/lineageos/updater/ExportUpdateService.java @@ -20,6 +20,7 @@ import android.app.NotificationManager; import android.app.Service; import android.content.ContentResolver; import android.content.Intent; +import android.content.pm.ServiceInfo; import android.net.Uri; import android.os.IBinder; import android.os.SystemClock; @@ -156,7 +157,8 @@ public class ExportUpdateService extends Service { } }; - startForeground(NOTIFICATION_ID, notificationBuilder.build()); + startForeground(NOTIFICATION_ID, notificationBuilder.build(), + ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE); notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); Runnable runnableComplete = () -> { diff --git a/app/src/main/java/org/lineageos/updater/controller/UpdaterService.java b/app/src/main/java/org/lineageos/updater/controller/UpdaterService.java index c279679a..e1e0c998 100644 --- a/app/src/main/java/org/lineageos/updater/controller/UpdaterService.java +++ b/app/src/main/java/org/lineageos/updater/controller/UpdaterService.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.content.pm.ServiceInfo; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; @@ -275,7 +276,8 @@ public class UpdaterService extends Service { mNotificationBuilder.setTicker(text); mNotificationBuilder.setOngoing(true); mNotificationBuilder.setAutoCancel(false); - startForeground(NOTIFICATION_ID, mNotificationBuilder.build()); + startForeground(NOTIFICATION_ID, mNotificationBuilder.build(), + ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); break; } @@ -390,7 +392,8 @@ public class UpdaterService extends Service { mNotificationBuilder.setTicker(text); mNotificationBuilder.setOngoing(true); mNotificationBuilder.setAutoCancel(false); - startForeground(NOTIFICATION_ID, mNotificationBuilder.build()); + startForeground(NOTIFICATION_ID, mNotificationBuilder.build(), + ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); break; }