Skip to content

Commit 7290310

Browse files
committed
Use cancelSync directly in migration
1 parent 6582053 commit 7290310

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

app/src/main/kotlin/at/bitfire/davdroid/settings/migration/AccountSettingsMigration21.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ package at.bitfire.davdroid.settings.migration
66

77
import android.accounts.Account
88
import android.accounts.AccountManager
9+
import android.content.ContentResolver
910
import android.content.Context
1011
import android.os.Build
1112
import at.bitfire.davdroid.R
12-
import at.bitfire.davdroid.sync.adapter.SyncFrameworkIntegration
1313
import dagger.Binds
1414
import dagger.Module
1515
import dagger.hilt.InstallIn
@@ -32,7 +32,6 @@ import javax.inject.Inject
3232
*/
3333
class AccountSettingsMigration21 @Inject constructor(
3434
@ApplicationContext private val context: Context,
35-
private val syncFrameworkIntegration: SyncFrameworkIntegration,
3635
private val logger: Logger
3736
): AccountSettingsMigration {
3837

@@ -58,7 +57,7 @@ class AccountSettingsMigration21 @Inject constructor(
5857
private fun cancelSyncs(accountType: String) {
5958
accountManager.getAccountsByType(accountType).forEach { account ->
6059
logger.info("Android 14+: Canceling all (possibly forever pending) syncs for $account")
61-
syncFrameworkIntegration.cancelSync(account, null)
60+
ContentResolver.cancelSync(account, null)
6261
}
6362
}
6463

app/src/main/kotlin/at/bitfire/davdroid/sync/adapter/SyncFrameworkIntegration.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,6 @@ class SyncFrameworkIntegration @Inject constructor(
120120
ContentResolver.cancelSync(syncRequest)
121121
}
122122

123-
/**
124-
* Cancels all Sync Adapter Framework syncs (system wide) for given account and
125-
* authority. If authority is null, all syncs for the given account
126-
* regardless of authority are canceled.
127-
*
128-
* @param account The account for which syncs should be canceled.
129-
* @param authority Null or the authority for which syncs should be canceled.
130-
*/
131-
fun cancelSync(account: Account, authority: String?) =
132-
ContentResolver.cancelSync(account, authority)
133-
134123
/**
135124
* Enables/disables sync adapter automatic sync (content triggered sync) for the given
136125
* account and authority. Does *not* call [ContentResolver.setIsSyncable].

0 commit comments

Comments
 (0)