mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 09:49:25 +02:00
Fix crash when allowing Apps temporarily
This commit is contained in:
parent
2bc7c637a8
commit
f0a48232b0
1 changed files with 12 additions and 4 deletions
|
@ -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 {
|
||||
database.temporarilyAllowedApp().addTemporarilyAllowedAppSync(TemporarilyAllowedApp(
|
||||
deviceId = deviceId,
|
||||
packageName = packageName
|
||||
))
|
||||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue