core/foreground_check library
Classes
- LifecycleQueryResult
- Outcome of queryLifecycleState.
- LifecycleReported
-
fdb_helper reported an
AppLifecycleState.name(null if the engine has not reported one yet). -
The lifecycle could not be determined for a benign reason: no session,
no fdb_helper, an older fdb_helper without
ext.fdb.lifecycle, app died, or any other non-timeout failure. Callers stay silent. - LifecycleVmNotResponding
- The query timed out while the app PID is alive: the VM is unresponsive.
Constants
- lifecycleQueryTimeout → const Duration
- Upper bound for queryLifecycleState so a hung VM never stalls a command.
- vmNotRespondingWarning → const String
- Warning emitted when the lifecycle query times out while the app PID is alive — the VM is unresponsive, most likely because the OS suspended the backgrounded app.
Functions
-
classifyLifecycleQueryError(
Object error, {required bool appAlive}) → LifecycleQueryResult - Classifies a failure of the lifecycle query. Only a timeout (or an explicit VmNotRespondingException) with the app still alive counts as "not responding"; everything else is LifecycleUnavailable.
-
foregroundWarning(
String? lifecycleState) → String? -
Returns a
WARNING: ...line whenlifecycleState(anAppLifecycleState.namereported by fdb_helper) means the app is not the visible foreground app, or null when it is (resumed) or unknown (null, e.g. an older fdb_helper that does not report lifecycle). -
lifecycleQueryWarning(
LifecycleQueryResult result) → String? - Maps a LifecycleQueryResult to the warning line to emit, or null.
-
queryLifecycleState(
{Duration timeout = lifecycleQueryTimeout}) → Future< LifecycleQueryResult> -
Best-effort query of the app's lifecycle state via
ext.fdb.lifecycle.