mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
A reception blackout in a capture is as easily the display going off as a broken scan, and nothing in a capture currently says which. The full snapshot is written on every screen, doze and power-save broadcast, plus once when the recording starts, so a single line format answers both "what is it now" and "what just changed". The receiver is registered before the first snapshot is taken: ACTION_SCREEN_OFF is not sticky, so a screen-off in between would appear as neither a transition nor a corrected state. The catch sits on the inner receiver flow rather than after flatMapLatest. Flow.catch completes the flow it is applied to, so a top-level catch would end the recording-flag collection on the first failure and every later recording in the process would carry no power state at all. Nothing here may throw: onReceive is an Android callback outside any flow, so a vendor PowerManager that throws would take the process down. Each field is guarded individually so a bad read costs one value rather than the line.