Repair Android route settlement, failed recovery and AAudio startup contracts
android-ci / android-arm64 (push) Successful in 20m13s
android-ci / android-arm64 (push) Successful in 20m13s
This commit is contained in:
1 parent
e619f66d59
commit
4664be0818
22 files changed
+775
-70
No files matched your search
@@ -750,5 +750,133 @@ held-inhibitor invariants; (3) reconcile manager permit changes for same owner a
|
||||
drive actual command/event consumers with controlled startup/ACK/callback barriers and connected
|
||||
snapshot ordering. No queue-limit increase, blind retry or stale-audio bypass as a substitute.
|
||||
|
||||
### Audit remediation verification — 8f74404 / run4920
|
||||
|
||||
Owner authorized all audit fixes. Live PCM service now delegates slow thread-affine CPAL construction,
|
||||
play/drop, DSP reconstruction and notification decoding to `native/src/media/audio/lifecycle.rs`.
|
||||
`engine.rs::Worker::lifecycle` continues normal queue/reference/capture/mix servicing while awaiting
|
||||
bounded completion. StreamOwner never crosses threads; DeviceLease revokes immediately and retires on
|
||||
the lifecycle owner. Durable output authorization is separate from temporary playback activity;
|
||||
superseded reset cannot latch RX off and later explicit stops remain authoritative.
|
||||
|
||||
Runtime retains negative PushToMute inhibitors, revokes before waiting on config lock, reconciles the
|
||||
actual owner after batch changes and consumes same-owner acknowledged permit replacements without
|
||||
ticker set_input/retries. Manager publishes capture revision/acknowledged config; current_capture_permit
|
||||
checks live core epoch. Private reservations fence stale Finish and newer output intent; failure status
|
||||
is updated. Voice projection and toggle share effective microphone readiness. Runtime ignores obsolete
|
||||
connecting observers before/after awaits; manager publishes before observer dispatch. Android reads OS
|
||||
grant at construction and queued permission handling, and suppresses duplicate AppOps notifications.
|
||||
|
||||
Linux CI4920 SUCCESS: actual native145, capture transitions18, lifecycle observer/UI2, manager7,
|
||||
DSP15, Android metadata4/timestamp3, core23 passed/1ignored. Full Android build/package passed.
|
||||
Unlike former mute tests, new production Worker::run regression keeps concurrent production callbacks
|
||||
running across a blocked capture-start barrier for multiple reference-ring capacities. Other regressions
|
||||
cover reset interleaving, mute waiting behind activation, delayed same-owner move, non-owner playback,
|
||||
idle/stale private finish and late connecting observers. Synthetic backend/reducer fixtures do not
|
||||
prove physical CPAL/server behavior; phone and current Windows runtime acceptance remain separate.
|
||||
First CI4917 failed guard-reference type coercion; fixed2716aa5. CI4918 passed native145 and17/18 runtime
|
||||
tests; removed an obsolete expected-error assertion for now-idempotent inactive private Stop in8f74404.
|
||||
No failed assertion was suppressed or test path narrowed. Additional mic gain not changed.
|
||||
|
||||
### Owner-confirmed Android voice — f403dd5 / run4931
|
||||
|
||||
After4920 the owner observed first TX working briefly, then target_changed; second unmute was stable.
|
||||
No retained fault record identified that occurrence. Source inspection found push_audio's boolean
|
||||
conflated individual frame expiry/future rejection and lost authorization; capture_failed then revoked
|
||||
the manager, potentially destroying an already-acknowledged replacement. f403dd5 introduces typed
|
||||
CaptureIngress outcomes, preserving strict core frame validation while retiring only the old worker
|
||||
capture on permit loss. The actual manager/core + Worker forwarding regression passed in CI4931.
|
||||
Native146, capture18, lifecycle2, manager7, DSP15, metadata4, timestamp3, core23 passed/1ignored;
|
||||
Android compile/package passed. APK SHA256c91deecac9ae5bc973a057faf94a94daec35bc50decbe30d5a799e8fadf942d9
|
||||
verified locally against receipts and installed with explicit owner authorization. Owner then confirmed
|
||||
«всее, урааа, все работает!» following the requested cold-entry/first-TX scenario. This is manual
|
||||
two-way Android voice acceptance, not proof of the exact former failure cause or the entire device matrix.
|
||||
|
||||
Record test was previously accepted on4911. Repeated mute/deafen, external route plug/unplug, current
|
||||
device-selector presentation, long calls, background/network recovery, Windows runtime regression and
|
||||
iOS acceptance remain separately unverified. UI work can proceed on this working voice baseline;
|
||||
do not infer authority to merge main, publish a release, change signing or start UI implementation
|
||||
from the owner's question about priorities. No additional microphone gain was applied.
|
||||
|
||||
### Read-only headset regression audit — e619f66 / APK4948, 2026-11-14
|
||||
|
||||
Scope: compare4ea413f (APK4943) with63861be+e619f66; capture selection, Android communication
|
||||
route acknowledgement, AAudio output policy/default resolution, Worker publication and tests.
|
||||
Installed4948 SHA25670d5bf26fd4148944f934de790e36e938dc40d7c912f5c9bcb321b7caec81341 verified.
|
||||
Owner reports regression: headset microphone unavailable and default RX silent until manual speakers.
|
||||
Screenshot captured immediately without taps. No source edits, builds, tests, microphone/server
|
||||
actions or route changes during this audit. Existing full graph is stale; no regeneration performed.
|
||||
|
||||
**Observed device evidence:** first retained input failure is `input_publish`, `DeviceLost`,
|
||||
`audio_device_missing`, before native CaptureCallback delivery. Host lookup/open/initial validation
|
||||
and play returned before this stage; it is not the absent-ID branch (engine.rs:1042-1083).
|
||||
AAudio maps Disconnected/Unavailable/NoService/InvalidHandle to the same error category
|
||||
(vendor/cpal-0.18.2/src/host/aaudio/convert.rs:52-62); exact backend code was not retained.
|
||||
Zero native counters do not rule out earlier AAudio callbacks withheld awaiting a timestamp.
|
||||
Java explicit Bluetooth communication selection was acknowledged; output opened with verified
|
||||
VOICE_COMMUNICATION/SPEECH, mono16kHz I16, then start_output returned audio_device_error.
|
||||
Another open reported stereo48kHz I16 then audio_device_busy after2051ms. Attribute/shape/route
|
||||
match is logged BEFORE play/publication, not proof of successful playback or audibility.
|
||||
Default clear was followed by an observed earpiece route and a fence/settings failure. Logs do not
|
||||
prove that system default always selected headphones. Endpoint ID (e.g. aaudio:2) is not device type.
|
||||
|
||||
**Source-supported findings:**
|
||||
|
||||
1. **P1: premature CLEAR acknowledgement.** VoiceService.java:161 calls clearCommunicationDevice
|
||||
and immediately finishPlayback(success). Later OS callback can fence the in-flight settings/native
|
||||
reconstruction (172-193). Retained ordering supports this race. `current_type` on the immediate
|
||||
ACK can itself be stale; it is not a fresh getter result. CLEAR needs bounded settled completion
|
||||
with one configuration/recovery owner, not treating request submission as settled physical routing.
|
||||
2. **P2: failed manual recovery invalidates its own event.** VoiceService.java:126-128 calls
|
||||
receiveOnly (93-96), then nativeVoicePlaybackFinished increments route revision without emitting
|
||||
recovery (native/src/platform/android.rs:502-508). The error return skips caller synchronization
|
||||
(settings_actions/audio.rs:191-192); event_handlers.rs:103-105 rejects the earlier revision.
|
||||
Failure must finalize revision before handing off recovery; success can remain caller-owned.
|
||||
3. **P2: resolved-default endpoint and PCM format diverge.** DeviceHost::select chooses format
|
||||
(devices.rs:202-204), then SelectedDevice::prepare_output changes device/ID but not format (92-100).
|
||||
Worker invokes those in that order (engine.rs:1108-1120). A default resolving to mono16kHz/I16
|
||||
can retain synthetic stereo48kHz/F32, unlike exact selection. Recompute compatible format after
|
||||
resolution, before conversion/open. This is proven structurally, not the proven cause of this
|
||||
phone's asynchronous DeviceLost or its start timeout.
|
||||
4. **P2: startup route ACK can overwrite lost focus.** VoiceService.java:123-124 completes startup
|
||||
without rechecking focused; nativeVoiceStarted calls CallAudioState::start, which sets focused=true
|
||||
(android.rs:460-462; android/call_audio.rs:12). Revalidate current focus/consent at completion.
|
||||
5. **Failure-state clarity:** output selection persists intent before platform application, as before
|
||||
this patch. New early UNAVAILABLE returns after revoke_capture but before synchronization
|
||||
(settings_actions/audio.rs:128,189-192; VoiceService.java:146). Desired selection, applied route
|
||||
and active stream can therefore differ. Do not silently roll back exact preferences or imply that
|
||||
preserved selection means active hardware; clearly report the unsupported/unavailable combination.
|
||||
|
||||
**Bluetooth contract gap [INFERENCE]:** removing automatic priority selection also removed automatic
|
||||
SCO activation, while capture selection deliberately does not request any communication output.
|
||||
Android setCommunicationDevice selects a sink and automatically pairs the source. Independent UI
|
||||
selectors cannot guarantee independent physical Bluetooth input/output. Opening an enumerated SCO
|
||||
input while the conversation route stays on the phone is consistent with the observed backend loss,
|
||||
but raw backend cause and exact physical pairing remain unknown. Do not fix by restoring automatic
|
||||
headset priority, name-based remapping or removing exact-route/privacy validation. Reconcile the
|
||||
explicit user pair against supported transport, or explain the unsupported pair before opening it.
|
||||
Platform reference: https://developer.android.com/reference/android/media/AudioManager#setCommunicationDevice(android.media.AudioDeviceInfo)
|
||||
|
||||
**Diagnostics/tests:** output fence publication replaces a latched fault with audio_device_error
|
||||
(engine.rs:108-112), while capture preserves its category. AAudio play discards the state returned by
|
||||
wait_for_state_change (mod.rs:940-953); Timeout/WouldBlock both become device_busy. These are existing
|
||||
blind spots exposed by this change, not proof that another app owns the device. Preserve bounded
|
||||
backend enum/start phase and distinguish stream-open, Started, publication and actual callbacks.
|
||||
The five new Worker fixtures inject OpenedOutput before host/JNI/open (engine.rs:1102-1107;
|
||||
engine_tests.rs:387-503,1447-1490). Manual capture fixture injects capture and submits SelectInput
|
||||
directly (lifecycle_tests.rs:291-316); Java policy fixture does not execute VoiceService callbacks.
|
||||
Passed CI therefore misses CLEAR callback interleavings, failed-ACK revisions, focus loss during
|
||||
startup, endpoint-specific default format, and actual SCO duplex readiness. It remains valid for
|
||||
its synthetic ownership/privacy contracts, not headset acceptance. No new tests run during audit.
|
||||
|
||||
**Correction/proof order:** repair the four source defects as one scoped route-state correction;
|
||||
cover their actual asynchronous boundaries and reject invalid start states without relaxing privacy;
|
||||
then verify on the selected phone: exact headset pair, explicit phone pair, default, supported mixed
|
||||
pair (or clear unsupported result), failed switch recovery, mic mute and disconnect. No UI rewrite,
|
||||
desktop behavior change, broad refactor or automatic gain/route fallback is justified by this audit.
|
||||
Headset RX/TX acceptance remains FAILED; exact raw backend cause remains UNKNOWN.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -743,6 +743,45 @@ to this pre-UI scope. No speculative microphone gain/audio refactor on accepted
|
||||
failed audio_closed before second open. Fixture destructuring discarded event receiver, so first
|
||||
Started event correctly stopped orphaned worker. Retain receiver for whole fixture; production
|
||||
shutdown semantics unchanged. APK stage was skipped; corrected tests require the next CI run.
|
||||
- Corrected e619f66d59c98400c77aa837bd39bf22308b7e88 run4948/job5544 SUCCESS: native audio164,
|
||||
capture18,lifecycle13,restart3,manual-action1,manager7,DSP15,catalog5,timestamp3,usage4,route-state7,
|
||||
core23+output2 passed/1ignored. All five output role/alias regression fixtures passed; ARM64 APK
|
||||
compile/package passed. Owner selected install-ready on the same disposable TECNO KJ7, including
|
||||
signature-mismatch replacement if needed; server/mic actions remain owner-operated. Download pending.
|
||||
- APK4948 ZIP and all six receipt hashes verified; APK SHA256
|
||||
70d5bf26fd4148944f934de790e36e938dc40d7c912f5c9bcb321b7caec81341. USB disconnected on initial
|
||||
update attempt; owner reconnected. Signature mismatch confirmed, authorized disposable uninstall
|
||||
and install both Success. Activity already foreground on launch request; installed APK hash matches.
|
||||
- Owner REJECTS4948 headset behavior: G435 capture now fails audio_device_missing; default playback
|
||||
reportedly silent until manual speaker choice. Immediate screenshot captured without inputs; no
|
||||
further phone manipulation, source fixes, tests or builds during requested detailed read-only audit.
|
||||
- Retained bounded logs identify first capture failure at input_publish with DeviceLost before native
|
||||
capture delivery, not exact-ID lookup. Java Bluetooth communication ACK succeeds, but following
|
||||
output start fails audio_device_error; another start fails audio_device_busy after2051ms. Default
|
||||
clear ACK precedes later observed earpiece route and another fence/settings failure. Do not call
|
||||
VOICE_COMMUNICATION attribute match or passed host fixtures a device routing success.
|
||||
- Detailed read-only audit recorded in assessment §Read-only headset regression audit — e619f66 /
|
||||
APK4948. Source defects: premature CLEAR ACK, failed-completion recovery event superseded by newer
|
||||
revision, resolved-default endpoint retaining generic PCM format, startup ACK restoring lost focus.
|
||||
Capture's first fault is asynchronous backend loss, not missing catalog ID; underlying raw AAudio
|
||||
reason remains unknown. Bluetooth source/sink coupling must be reconciled without automatic priority
|
||||
or silent substitutions. Test seams bypass the failing JNI/VoiceService/open boundaries. No app
|
||||
fixes or new build/install during audit; only bounded evidence and documentation updated.
|
||||
- Owner explicitly approved moving from audit to fixes: scoped CLEAR/ACK/recovery/focus correction,
|
||||
endpoint-resolved PCM format, strict AAudio Started-state validation and bounded backend diagnostics.
|
||||
No automatic headset priority or silent exact-device replacement. Parent preserves output-publication
|
||||
fault category and tests failed streams never publish active; CI/device results still pending.
|
||||
- Repairs implemented pending CI: production CLEAR settlement waits fresh route observations with
|
||||
bounded quiet/completion windows; explicit JNI accepted flag separates successful caller continuation
|
||||
from finalized failed-route recovery. Startup checks focus and authorization revision. Failure recovery
|
||||
preserves saved exact choices and last applied state without automatically remapping devices; later
|
||||
mute/focus loss still wins. Capture pair preflight runs on settings, recovery and shared StartInput.
|
||||
- Physical default output now recomputes capabilities/PCM; AAudio startup requires Started from both
|
||||
bounded wait and current state. Safe audio_backend enums identify open/callback/start phases without
|
||||
identifiers/PCM. Output publication preserves specific latched faults instead of generic device error.
|
||||
- Java production settlement fixture compiled and passed locally (delay, null/denied route, timeout,
|
||||
cancellation and repeated callbacks); async Rust authorization tests migrated from standalone rustc
|
||||
to native Cargo harness for Tokio. Native/Android compile and device behavior not yet verified.
|
||||
|
||||
|
||||
## First Android APK build
|
||||
|
||||
Reference in new issue
Block a user