Skip to content

Commit

Permalink
fix: Use dataSync as foreground service type
Browse files Browse the repository at this point in the history
Change-Id: I333fd2a69d53b31bce70c760a3cffa5860bdf9b8
  • Loading branch information
XayahSuSuSu committed Nov 19, 2024
1 parent bb25ec7 commit 8576e66
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions source/core/service/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,47 @@

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<application>
<service
android:name=".packages.backup.BackupServiceLocalImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".packages.backup.BackupServiceCloudImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".packages.restore.RestoreServiceLocalImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".packages.restore.RestoreServiceCloudImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".medium.backup.BackupServiceLocalImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".medium.backup.BackupServiceCloudImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".medium.restore.RestoreServiceLocalImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />

<service
android:name=".medium.restore.RestoreServiceCloudImpl"
android:exported="false"
android:foregroundServiceType="specialUse" />
android:foregroundServiceType="dataSync" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
import android.os.Binder
import android.os.Build
import android.os.IBinder
Expand Down Expand Up @@ -36,7 +36,7 @@ import kotlinx.coroutines.sync.withLock
internal abstract class AbstractProcessingService : Service() {
override fun onBind(intent: Intent): IBinder {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(1, NotificationUtil.getForegroundNotification(applicationContext), FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
startForeground(1, NotificationUtil.getForegroundNotification(applicationContext), FOREGROUND_SERVICE_TYPE_DATA_SYNC)
} else {
startForeground(1, NotificationUtil.getForegroundNotification(applicationContext))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
import android.net.Uri
import android.os.Build
import android.provider.Settings
Expand Down Expand Up @@ -119,7 +119,7 @@ object NotificationUtil {
createChannelIfNecessary(context)
val notification = builder.setContentTitle(title).setContentText(content).setProgress(max, progress, indeterminate).setOngoing(ongoing)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
ForegroundInfo(progressNotificationId, notification.build(), FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
ForegroundInfo(progressNotificationId, notification.build(), FOREGROUND_SERVICE_TYPE_DATA_SYNC)
} else {
ForegroundInfo(progressNotificationId, notification.build())
}
Expand All @@ -135,7 +135,7 @@ object NotificationUtil {
createChannelIfNecessary(context)
val notification = builder.setContentTitle(title).setContentText(content).setOngoing(ongoing)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
ForegroundInfo(progressNotificationId, notification.build(), FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
ForegroundInfo(progressNotificationId, notification.build(), FOREGROUND_SERVICE_TYPE_DATA_SYNC)
} else {
ForegroundInfo(progressNotificationId, notification.build())
}
Expand Down

0 comments on commit 8576e66

Please sign in to comment.