diff --git a/app/src/main/java/at/bitfire/davdroid/settings/AccountSettings.kt b/app/src/main/java/at/bitfire/davdroid/settings/AccountSettings.kt index 120b9523b60751e25826fff1f03481550506329f..e84c119c40675a9374a133d812a1df23fddc719c 100644 --- a/app/src/main/java/at/bitfire/davdroid/settings/AccountSettings.kt +++ b/app/src/main/java/at/bitfire/davdroid/settings/AccountSettings.kt @@ -223,7 +223,7 @@ class AccountSettings( context.getString(R.string.account_type), context.getString(R.string.google_account_type), context.getString(R.string.eelo_account_type) -> account = argAccount else -> - throw IllegalArgumentException("Account type not supported") + throw IllegalArgumentException("Account type not supported. AccountType: ${argAccount.type}") } // synchronize because account migration must only be run one time diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncUtils.kt b/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncUtils.kt index c9e9bc5abb6fa76389898738f8ecefab7ed86278..4b3278562109fd86ada6967424d54641e40a2ada 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncUtils.kt +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/SyncUtils.kt @@ -34,6 +34,7 @@ import dagger.hilt.EntryPoint import dagger.hilt.InstallIn import dagger.hilt.android.EntryPointAccessors import dagger.hilt.components.SingletonComponent +import java.util.logging.Level object SyncUtils { @@ -111,8 +112,18 @@ object SyncUtils { val isSyncable = ContentResolver.getIsSyncable(account, providerName.authority) // may be -1 (unknown state) val shallBeSyncable = hasCalDAV && providerName == currentProvider if ((shallBeSyncable && isSyncable != 1) || (!shallBeSyncable && isSyncable != 0)) { - // enable/disable sync - setSyncableFromSettings(context, account, providerName.authority, shallBeSyncable) + try { + // enable/disable sync + setSyncableFromSettings( + context, + account, + providerName.authority, + shallBeSyncable + ) + } catch (e: IllegalArgumentException) { + Logger.log.log(Level.WARNING, "Account type not supported", e) + continue + } // if sync has just been enabled: check whether additional permissions are required if (shallBeSyncable && !PermissionUtils.havePermissions(context, providerName.permissions)) @@ -138,6 +149,7 @@ object SyncUtils { settings.setSyncInterval(authority, interval) } catch (e: InvalidAccountException) { // account has already been removed + Logger.log.log(Level.WARNING, "Account is not present", e) } } else { Logger.log.info("Disabling $authority sync for $account")