Properly setup Service::onTimeout

This commit is contained in:
LooKeR 2024-12-21 16:38:06 +05:30
parent b5e7ed3801
commit 15d6e46ec2
No known key found for this signature in database
GPG Key ID: 6B59369FDB608FB9
3 changed files with 12 additions and 2 deletions

View File

@ -188,6 +188,12 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
}
}
override fun onTimeout(startId: Int) {
super.onTimeout(startId)
onDestroy()
stopSelf()
}
override fun onDestroy() {
super.onDestroy()
cancelTasks(null)

View File

@ -216,6 +216,12 @@ class SyncService : ConnectionService<SyncService.Binder>() {
}
}
override fun onTimeout(startId: Int) {
super.onTimeout(startId)
onDestroy()
stopSelf()
}
override fun onDestroy() {
super.onDestroy()
downloadConnection.unbind(this)

View File

@ -16,8 +16,6 @@ import com.looker.sync.fdroid.v2.model.Entry
import com.looker.sync.fdroid.v2.model.IndexV2
import com.looker.sync.fdroid.v2.model.IndexV2Diff
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json