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
|
package io.timelimit.android.ui.lock
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.database.sqlite.SQLiteConstraintException
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -287,10 +288,17 @@ class LockFragment : Fragment() {
|
||||||
logic.platformIntegration.setSuspendedApps(listOf(packageName), false)
|
logic.platformIntegration.setSuspendedApps(listOf(packageName), false)
|
||||||
|
|
||||||
Threads.database.executeAndWait(Runnable {
|
Threads.database.executeAndWait(Runnable {
|
||||||
|
try {
|
||||||
database.temporarilyAllowedApp().addTemporarilyAllowedAppSync(TemporarilyAllowedApp(
|
database.temporarilyAllowedApp().addTemporarilyAllowedAppSync(TemporarilyAllowedApp(
|
||||||
deviceId = deviceId,
|
deviceId = deviceId,
|
||||||
packageName = packageName
|
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