# Android foreground-app automation condition — implementation notes > Status: implemented on `feature/android-foreground-app-automation`. Last updated 2026-06-02. ## What & why The desktop build has an **Application** automation rule (`ApplicationRule`): activate a scene when given apps are running / foreground / fullscreen. It was already wired end-to-end on Android (engine, storage, API, editor) but **silently never fired**, because the two Windows-only ctypes paths return empty off-Windows: 1. **Detection** — `PlatformDetector._get_topmost_process_sync()` (and the running/fullscreen variants) returned `(None, False)` / `set()` on Android. 2. **The app picker** — populated from `GET /api/v1/system/processes` → `get_running_processes()`, also empty on Android, so users couldn't even choose an app. This feature fills both holes using in-platform Android APIs and the established Kotlin↔Python bridge pattern. **Zero new Python or Gradle dependencies.** ## Design decision: one implicit "foreground" mode on Android Android exposes exactly one obtainable signal — the **current foreground app package**. The desktop rule's four match types (`running` / `topmost` / `fullscreen` / `topmost_fullscreen`) are either unobtainable (`running` — `getRunningTasks` is restricted) or identical (a foreground TV app effectively *is* fullscreen). So on Android: - The editor **hides the match-type selector** and the collector forces `match_type="topmost"`. - `_get_topmost_process_sync()` returns `(package, True)`; the running/fullscreen detectors return the foreground app as a best-effort single-element set so legacy rules still behave. This avoided touching the existing plain `