Skip to content

Commit 12d47bc

Browse files
eriedclaude
andcommitted
fix(hud): keep phone WiFi lock asserted across the dial loop
Companion to the HUD WiFi-lock fix. Researched the failure (AOSP "Wi-Fi low-latency mode" docs): without a WiFi lock the radio enters power-save / doze when idle, so interactive packets (WS pongs, TCP SYNs) are dropped and the device goes unreachable even while the CPU/app stay alive. A low-latency lock disables power-save but is ONLY active while the app is foreground + screen-on -- which the HUD always is (FLAG_KEEP_SCREEN_ON), so LOW_LATENCY is correct there (commit f550101). The phone may be screen-off in a mount, so it keeps the HIGH_PERF lock (no screen-on requirement); this just re-asserts that lock every dial-loop tick so an OS reclaim / network hop can't silently leave the phone radio in power-save. Both modules compile. Field-test only (no emulator radio power-save). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GADLyChheAoMX9dQbRgRnH
1 parent f550101 commit 12d47bc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • app/src/main/java/com/eried/eucplanet/service/hud

app/src/main/java/com/eried/eucplanet/service/hud/HudServer.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,11 @@ class HudServer @Inject constructor(
423423
var attempt = 0
424424
val sprintStartedAtMs = System.currentTimeMillis()
425425
while (true) {
426+
// Re-assert the WiFi lock every tick: it's only acquired once at
427+
// enable, but the OS can reclaim it (or it can lapse on a network
428+
// hop). Idempotent -- keeps the radio out of power-save for the
429+
// whole session, not just the instant the link came up.
430+
acquireWifiPerfLock()
426431
val s = runCatching { settingsRepository.get() }.getOrNull()
427432
val override = HudDebug.read("debug.eucplanet.hud.peer")?.takeIf { it.isNotBlank() }
428433
val autoDiscover = s?.hudAutoDiscover ?: true

0 commit comments

Comments
 (0)