Fix crash when allowing Apps temporarily

This commit is contained in:
Jonas L 2019-03-04 00:00:00 +00:00
parent 2bc7c637a8
commit f0a48232b0

View file

@ -16,6 +16,7 @@
package io.timelimit.android.ui.lock
import android.content.Intent
import android.database.sqlite.SQLiteConstraintException
import android.os.Bundle
import android.text.format.DateUtils
import android.view.LayoutInflater
@ -287,10 +288,17 @@ class LockFragment : Fragment() {
logic.platformIntegration.setSuspendedApps(listOf(packageName), false)
Threads.database.executeAndWait(Runnable {
try {
database.temporarilyAllowedApp().addTemporarilyAllowedAppSync(TemporarilyAllowedApp(
deviceId = deviceId,
packageName = packageName
))
} catch (ex: SQLiteConstraintException) {
// ignore this
//
// this happens when touching that option more than once very fast
// or if the device is under load
}
})
}
}