Remove now unnecessary code to check if exact alarms can be scheduled
This commit is contained in:
parent
73ae228f70
commit
423f7553a7
7 changed files with 1 additions and 26 deletions
|
@ -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)
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -156,10 +156,6 @@ class MockSystemAlarmManager(startTime: Long) : SystemAlarmManager {
|
|||
var callback: Callback? = null
|
||||
val alarmTimes = mutableListOf<Long>()
|
||||
|
||||
override fun canScheduleExactAlarms(): Boolean {
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
|
||||
override fun setAlarm(triggerTime: Long, callback: () -> Unit) {
|
||||
this.triggerTime = triggerTime
|
||||
this.callback = callback
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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<TestIdleRefreshTimer>()
|
||||
|
||||
override fun canScheduleTimers(): Boolean {
|
||||
return areTimersSupported
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun startTimer(timeout: Long, callback: () -> Unit): TestIdleRefreshTimer {
|
||||
return TestIdleRefreshTimer(timeout, callback).also { timer -> timers.add(timer) }
|
||||
|
|
Loading…
Reference in a new issue