Files
SimpleRemoter/android/app/src/main/java/com/yama/client
yuanyuanxianganddeepseek-flash 340fb20518 Fix(android): correct lock/input state and recover screen capture
db148c4 asked KeyguardManager on every heartbeat; some TVs answer "locked"
while playing video, so hosts showed "Locked: HH:MM:SS" forever and the
foreground app never reached the server. Lock state is event-driven again:
SCREEN_OFF records the start, USER_PRESENT clears it, and on SCREEN_ON the
state clears when the device is TV-like or has no keyguard (devices without
a lock screen never send USER_PRESENT); a phone that reconnects while
locked is re-calibrated the same way. Keyguard is consulted only at those
event points, never per heartbeat.

Input strategy and TV heuristics are separate immutable values: isTV (D-pad
focus navigation vs touch injection) only looks at leanback, isTvLike (lock
and encoder heuristics) also accepts television/uiMode. They were once
merged and the TV lost remote control, then an assignment was dropped and
it silently defaulted to false; immutable lazy values make both impossible.
The resolved mode is logged as "input=dpad|touch tvLike=..." and mirrored
into the native ring when available.

Screen capture: on TVs the default encoder configuration is tried first.
After a sleep the existing VirtualDisplay stops composing while the
projection stays alive, so a 5s zero-frame stall rebuilds the encoder and
VirtualDisplay on the same projection (reusing the session's encoded size),
requests a fresh IDR and reports failure only after 13s; if the projection
is gone the native size is cleared so the next request re-authorizes. A
repeated onStartCommand no longer calls nativeInit again (the -1 answer
used to stopSelf and drop the host). Kotlin capture logs mirror into the
native ring and fall back to logcat.

Debug APK builds; device verification pending.

Co-Authored-By: deepseek-flash
2026-11-22 21:51:16 +01:00
..