Commit 073180f
committed
android: a refused connect is not proof the microphone is fine
micOk was set from `e !is MicUnavailableException` on every failed streaming
attempt, so ANY non-mic failure wrote micOk=true. The order is what makes that
wrong: the socket connects BEFORE the mic opens, so while the household is
paused — listener closed — every attempt fails on the connect, and a phone whose
microphone was genuinely dead kept reporting a healthy one.
That is not a hypothesis about the OnePlus's nine silent hours on 2026-09-06; it
is the mechanism. The app retried every two seconds, could not open AudioRecord,
and #887's check — built precisely to catch a dead mic — called it healthy
throughout, which is worse than having no check.
⚠ #1468 recorded this as "micOk is evidently derived from permission state
rather than from whether AudioRecord actually opened". That was wrong and the
truth is narrower: it IS derived from the open. A non-mic failure was clearing
it afterwards.
The rule is now `if (failure is MicUnavailableException) false else previous` —
a failure that never reached the microphone reports nothing about it, in either
direction — and `true` is only written where the mic actually opened, which the
success path already did. It moved out of StreamService into MicState with
MicUnavailableException, because a rule nothing can reach is a rule nothing can
test, and there was no test for this transition at all.
Four now, and two of them fail against the old rule: a mic failure must survive
a hundred later refused connects, and a network failure must not invent a mic
failure either. Checked by restoring the old expression and watching exactly
those two go red.
⚠ THIS DOES NOT FIX THE PHONES. It fixes the app; the phones run what is
installed on them.1 parent 628ad2d commit 073180f
3 files changed
Lines changed: 73 additions & 6 deletions
File tree
- android/app/src
- main/kotlin/org/recall/mic
- test/kotlin/org/recall/mic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
11 | 37 | | |
12 | 38 | | |
13 | 39 | | |
| |||
Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | 353 | | |
359 | 354 | | |
360 | 355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments