mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-06 03:50:23 +02:00
Make emergency calls during annoy easier
This commit is contained in:
parent
d9a5f31d5a
commit
28cd3e1380
3 changed files with 9 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* TimeLimit Copyright <C> 2019 Jonas Lochmann
|
||||
* TimeLimit Copyright <C> 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -58,6 +58,8 @@ object AndroidIntegrationApps {
|
|||
"com.android.phone"
|
||||
)
|
||||
|
||||
val appsToIncludeInLockTasks = appsToNotSuspend + setOf("com.android.dialer")
|
||||
|
||||
private val ignoredActivities = setOf<String>(
|
||||
"com.android.settings:com.android.settings.enterprise.ActionDisabledByAdminDialog",
|
||||
"com.android.settings:com.android.settings.FallbackHome",
|
||||
|
|
|
@ -989,8 +989,8 @@ class BackgroundTaskLogic(val appLogic: AppLogic) {
|
|||
shouldAnnoyNow.waitUntilValueMatches { it == true }
|
||||
appLogic.platformIntegration.showAnnoyScreen()
|
||||
|
||||
// bring into foreground all five seconds
|
||||
withTimeoutOrNull(5000L) { shouldAnnoyNow.waitUntilValueMatches { it == false } }
|
||||
// bring into foreground after some time
|
||||
withTimeoutOrNull(300 * 1000L) { shouldAnnoyNow.waitUntilValueMatches { it == false } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import io.timelimit.android.R
|
|||
import io.timelimit.android.data.model.UserType
|
||||
import io.timelimit.android.databinding.AnnoyActivityBinding
|
||||
import io.timelimit.android.extensions.showSafe
|
||||
import io.timelimit.android.integration.platform.android.AndroidIntegrationApps
|
||||
import io.timelimit.android.livedata.map
|
||||
import io.timelimit.android.logic.DefaultAppLogic
|
||||
import io.timelimit.android.ui.backdoor.BackdoorDialogFragment
|
||||
|
@ -62,7 +63,9 @@ class AnnoyActivity : AppCompatActivity(), ActivityViewModelHolder {
|
|||
setContentView(binding.root)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (logic.platformIntegration.setLockTaskPackages(listOf(packageName))) {
|
||||
val lockTaskPackages = AndroidIntegrationApps.appsToIncludeInLockTasks + setOf(packageName)
|
||||
|
||||
if (logic.platformIntegration.setLockTaskPackages(lockTaskPackages.toList())) {
|
||||
startLockTask()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue