Building StareBrain, Part 16: The Overlay UI That Stays Out of the Way
Every part of this series so far has been invisible to the user β task execution, obstruction detection, replanning, context building. Today we surface it.
StareBrain runs as an overlay: a persistent UI layer that floats above whatever app the user is in. It has to show task progress without blocking the screen, surface confirmation prompts without breaking flow, and collapse to almost nothing when it's not needed.
Here's how we built it.
The Window
Android overlays use TYPE_APPLICATION_OVERLAY (requires SYSTEM_ALERT_WINDOW permission). The window is added via WindowManager , not an Activity β it lives outside the normal view hierarchy.
class OverlayManager ( private val context : Context ) {
private val windowManager = context . getSystemService ( WindowManager :: class . java ) private var overlayView : OverlayView ? = null
fun show () { if ( overlayView != null ) return val params = WindowManager .β¦