diff --git a/app/common/src/main/java/com/fsck/k9/backends/AndroidAlarmManager.kt b/app/common/src/main/java/com/fsck/k9/backends/AndroidAlarmManager.kt index bdc46e234..ca6de4ea5 100644 --- a/app/common/src/main/java/com/fsck/k9/backends/AndroidAlarmManager.kt +++ b/app/common/src/main/java/com/fsck/k9/backends/AndroidAlarmManager.kt @@ -60,10 +60,6 @@ class AndroidAlarmManager( ) } - override fun canScheduleExactAlarms(): Boolean { - return alarmManager.canScheduleExactAlarms() - } - override fun setAlarm(triggerTime: Long, callback: Callback) { this.callback.set(callback) alarmManager.scheduleAlarm(triggerTime, pendingIntent) diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/BackendIdleRefreshManager.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/BackendIdleRefreshManager.kt index 7e3ec87be..06f506585 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/BackendIdleRefreshManager.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/BackendIdleRefreshManager.kt @@ -19,10 +19,6 @@ class BackendIdleRefreshManager(private val alarmManager: SystemAlarmManager) : private var minTimeout = Long.MAX_VALUE private var minTimeoutTimestamp = 0L - override fun canScheduleTimers(): Boolean { - return alarmManager.canScheduleExactAlarms() - } - @Synchronized override fun startTimer(timeout: Long, callback: Callback): IdleRefreshTimer { require(timeout > MIN_TIMER_DELTA) { "Timeout needs to be greater than $MIN_TIMER_DELTA ms" } diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt index 37bb1cf75..f9f31ba38 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt @@ -50,11 +50,6 @@ internal class ImapBackendPusher( private var currentIdleRefreshMs = 15 * 60 * 1000L override fun start() { - if (!idleRefreshManager.canScheduleTimers()) { - Timber.v("Not starting ImapBackendPusher for %s because the app can't schedule timers", accountName) - return - } - coroutineScope.launch { pushConfigProvider.maxPushFoldersFlow.collect { maxPushFolders -> currentMaxPushFolders = maxPushFolders diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/SystemAlarmManager.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/SystemAlarmManager.kt index be6a25ed4..e2133cfd0 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/SystemAlarmManager.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/SystemAlarmManager.kt @@ -1,7 +1,6 @@ package com.fsck.k9.backend.imap interface SystemAlarmManager { - fun canScheduleExactAlarms(): Boolean fun setAlarm(triggerTime: Long, callback: () -> Unit) fun cancelAlarm() fun now(): Long diff --git a/backend/imap/src/test/java/com/fsck/k9/backend/imap/BackendIdleRefreshManagerTest.kt b/backend/imap/src/test/java/com/fsck/k9/backend/imap/BackendIdleRefreshManagerTest.kt index c63c03549..bcca71cbe 100644 --- a/backend/imap/src/test/java/com/fsck/k9/backend/imap/BackendIdleRefreshManagerTest.kt +++ b/backend/imap/src/test/java/com/fsck/k9/backend/imap/BackendIdleRefreshManagerTest.kt @@ -156,10 +156,6 @@ class MockSystemAlarmManager(startTime: Long) : SystemAlarmManager { var callback: Callback? = null val alarmTimes = mutableListOf() - override fun canScheduleExactAlarms(): Boolean { - throw UnsupportedOperationException("not implemented") - } - override fun setAlarm(triggerTime: Long, callback: () -> Unit) { this.triggerTime = triggerTime this.callback = callback diff --git a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/IdleRefreshManager.kt b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/IdleRefreshManager.kt index 694d4617f..124c95d98 100644 --- a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/IdleRefreshManager.kt +++ b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/IdleRefreshManager.kt @@ -1,7 +1,6 @@ package com.fsck.k9.mail.store.imap interface IdleRefreshManager { - fun canScheduleTimers(): Boolean fun startTimer(timeout: Long, callback: () -> Unit): IdleRefreshTimer fun resetTimers() } diff --git a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/TestIdleRefreshManager.kt b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/TestIdleRefreshManager.kt index 33c12d73c..ce764be2d 100644 --- a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/TestIdleRefreshManager.kt +++ b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/TestIdleRefreshManager.kt @@ -1,14 +1,8 @@ package com.fsck.k9.mail.store.imap -class TestIdleRefreshManager( - private val areTimersSupported: Boolean = true, -) : IdleRefreshManager { +class TestIdleRefreshManager : IdleRefreshManager { private val timers = mutableListOf() - override fun canScheduleTimers(): Boolean { - return areTimersSupported - } - @Synchronized override fun startTimer(timeout: Long, callback: () -> Unit): TestIdleRefreshTimer { return TestIdleRefreshTimer(timeout, callback).also { timer -> timers.add(timer) }