From ccf1c1c75f0f6e6d146a0c224064fee881fafffb Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 30 Sep 2026 19:11:33 -0400 Subject: [PATCH] docs(napplet): the 30 s background pause is an upper bound on Android 14+ The cached-app freezer suspends `:napplet` and its renderers about 10 s after the app leaves the screen (12 s measured on an API 36 emulator), so media and scripts stop well before BACKGROUND_PAUSE_MS. Say so where the constant is defined, instead of promising 30 s of playback. Co-Authored-By: Claude Opus 5.5 --- .../amethyst/napplethost/NappletHostContract.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletHostContract.kt b/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletHostContract.kt index 568350b7c3..b60aff9b20 100644 --- a/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletHostContract.kt +++ b/nappletHost/src/main/kotlin/com/vitorpamplona/amethyst/napplethost/NappletHostContract.kt @@ -32,6 +32,12 @@ object NappletHostContract { * disconnect 30 s after the UI stops (RelayProxyClientConnector's `WhileSubscribed(30000)`), so a quick * trip to another app (a 2FA code, a password manager) doesn't interrupt a page, while one left behind * stops running. Requests that act for the user are held from the first moment regardless. + * + * An upper bound, not a promise: on Android 14+ the cached-app freezer suspends `:napplet` (and its + * renderers) about 10 s after the app leaves the screen, since nothing keeps that process in the + * foreground. Measured on an API 36 emulator: frozen 12 s after Home, media stopped with it. So on those + * devices a page stops within seconds, and this pause lands (on the next unfreeze) on a page that + * already stopped. */ const val BACKGROUND_PAUSE_MS = 30_000L