Start every launch with kiosk mode off while it is in testing
The saved kiosk setting is cleared on startup unless AppConfig.KIOSK_PERSISTED is set, so a device left locked is released on the next launch. Scanning the kiosk barcode still toggles lockdown for the current session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
babcd34c60
commit
4401519166
@ -29,6 +29,11 @@ object AppConfig {
|
||||
* mode only. Full lockdown needs the app set as device owner — see README. */
|
||||
const val KIOSK_BARCODE = "JOYKOO-KIOSK-8PRMVBA5WSL5"
|
||||
|
||||
/** Whether the kiosk on/off setting survives an app restart. Off while kiosk mode is
|
||||
* still being tested: every launch starts unlocked (clearing any leftover lockdown),
|
||||
* and KIOSK_BARCODE only toggles it until the app is closed. */
|
||||
const val KIOSK_PERSISTED = false
|
||||
|
||||
/** WebView renderer crashes allowed within RENDERER_CRASH_WINDOW_MS before the app
|
||||
* stops auto-reloading and shows the error screen instead. */
|
||||
const val RENDERER_CRASH_LIMIT = 3
|
||||
|
||||
@ -13,7 +13,8 @@ import android.util.Log
|
||||
|
||||
/**
|
||||
* Kiosk lockdown via Android Lock Task mode, toggled by scanning AppConfig.KIOSK_BARCODE.
|
||||
* The on/off setting is persisted and re-applied on every resume.
|
||||
* The on/off setting is re-applied on every resume, and kept across restarts only when
|
||||
* AppConfig.KIOSK_PERSISTED is set; otherwise each launch starts with kiosk off.
|
||||
*
|
||||
* - Device owner: true lockdown. Home/Recents and the notification shade are blocked,
|
||||
* only the power menu stays available, and the app becomes the persistent home
|
||||
@ -36,6 +37,10 @@ class KioskController(private val activity: Activity) {
|
||||
get() = prefs.getBoolean(KEY_ENABLED, false)
|
||||
private set(value) = prefs.edit().putBoolean(KEY_ENABLED, value).apply()
|
||||
|
||||
init {
|
||||
if (!AppConfig.KIOSK_PERSISTED) isEnabled = false
|
||||
}
|
||||
|
||||
private val isInLockTask: Boolean
|
||||
get() = am.lockTaskModeState != ActivityManager.LOCK_TASK_MODE_NONE
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user