Skip to content

Commit

Permalink
change dataSync to specialUse for 6+ hour downloads on android 15
Browse files Browse the repository at this point in the history
  • Loading branch information
crackededed committed Sep 24, 2024
1 parent 19f9d4d commit 61e2291
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
minSdk = 16
targetSdk = 35
versionCode = 121
versionName = "2.35.0"
versionName = "2.36.0"
}

buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<application
Expand Down Expand Up @@ -72,7 +72,7 @@

<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="dataSync"
android:foregroundServiceType="specialUse"
tools:node="merge" />

<provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.app.PendingIntent
import android.content.ContentResolver
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
import android.content.pm.ServiceInfo
import android.os.Build
import android.util.Base64
import android.util.JsonReader
Expand Down Expand Up @@ -901,8 +901,8 @@ class StreamDownloadWorker @AssistedInject constructor(
}, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT))
addAction(android.R.drawable.ic_delete, ContextCompat.getString(context, R.string.stop), WorkManager.getInstance(context).createCancelPendingIntent(id))
}.build()
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ForegroundInfo(offlineVideo.id, notification, FOREGROUND_SERVICE_TYPE_DATA_SYNC)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
ForegroundInfo(offlineVideo.id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else {
ForegroundInfo(offlineVideo.id, notification)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.app.PendingIntent
import android.content.ContentResolver
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
import android.content.pm.ServiceInfo
import android.os.Build
import android.util.Base64
import android.util.JsonReader
Expand Down Expand Up @@ -1097,8 +1097,8 @@ class VideoDownloadWorker @AssistedInject constructor(
}, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT))
addAction(android.R.drawable.ic_delete, ContextCompat.getString(context, R.string.stop), WorkManager.getInstance(context).createCancelPendingIntent(id))
}.build()
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ForegroundInfo(offlineVideo.id, notification, FOREGROUND_SERVICE_TYPE_DATA_SYNC)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
ForegroundInfo(offlineVideo.id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else {
ForegroundInfo(offlineVideo.id, notification)
}
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ hilt-extension-compiler = "1.2.0"
hilt-work = "1.2.0"
kotlin = "2.0.20"
ksp = "2.0.20-1.0.25"
lifecycle = "2.8.5"
lifecycle = "2.8.6"
material = "1.12.0"
media3 = "1.4.1"
navigation = "2.8.0"
navigation = "2.8.1"
okhttp = "5.0.0-alpha.14"
okio = "3.9.1"
paging = "3.3.2"
preference = "1.2.1"
retrofit = "2.11.0"
room = "2.6.1"
serialization = "1.7.2"
serialization = "1.7.3"
swiperefreshlayout = "1.1.0"
webkit = "1.11.0"
work = "2.10.0-alpha03"
webkit = "1.12.0"
work = "2.10.0-alpha04"

[libraries]
apollo-runtime = { module = "com.apollographql.apollo3:apollo-runtime", version.ref = "apollo" }
Expand Down

0 comments on commit 61e2291

Please sign in to comment.