# Keep-top guard A/B on dual screens `KeepTopActivity` (#2763) covers every other display while a session is on top, so that display's home is not its top activity. On the Thor, lmkd kills the bottom home under memory pressure, Android relaunches it to the front (`wm_task_to_front`), the session loses the top spot, drops to adj 50 and is killed in lmkd's next pass. Android gives a translucent activity that is alone in its task an `ActivityRecordInputSink` that consumes every touch inside the task bounds, whatever the window's flags say (`ENABLE_TOUCH_OPAQUE_ACTIVITIES`, on for DroidDeck's target SDK; see `services/core/java/com/android/server/wm/ActivityRecordInputSink.java`). The guard's `FLAG_NOT_TOUCHABLE` therefore did nothing: with the dual-screen panel closed, the bottom screen took no touch until the session ended, and the guard also stayed over it after Home. The guard now takes touches itself. A touch removes it from that display. It comes back when the session is top-resumed again, or after 5 s if the session kept the top spot (one touch on the bottom screen, then back to the game). Stopping or entering PiP removes the guards. ## Tool `tools/memory_guard_ab.py` drives a rooted dual-screen device over adb (`su` required) with a build that has the debugging tools: ```sh python3 tools/memory_guard_ab.py --label main --apk main.apk states python3 tools/memory_guard_ab.py --label fix --apk fix.apk states python3 tools/memory_guard_ab.py --label fix pressure --stop-mb 650 --hold 30 --runs 3 python3 tools/memory_guard_ab.py --label fix summarize ~/.cache/droiddeck-memory-guard-ab/fix-stop650-1-events.txt ``` Results are JSON lines in `~/.cache/droiddeck-memory-guard-ab/