73 lines
12 KiB
Markdown
73 lines
12 KiB
Markdown
# 0.7.4 / code22 cold-start candidate
|
||
|
||
Coord's real code21 WindowsUSB normal cold-start observation was `Displayed +31s949ms`, observed 32.086s, with 1823 + 38 = 1861 skipped frames. `am start -W` returned timeout around 10.385s; the process remained foreground/running and no fatal/ANR was captured. There were no precise app phase markers, so this does **not** measure how much of 31.949s belongs to one function. Source audit confirmed the full synchronous `AvatarPack.load()` ran before `setContent`: index/runtime parsing, SHA checks and 3185 PNG dimension checks. HELLO was asynchronous and did not gate composition.
|
||
|
||
## Implementation
|
||
|
||
`MainActivity` immediately composes a stable white-role shell with a 240×424 sourceframe0 poster and 48dp safe-inset gear. System splash has no fixed delay or required intro. Role preparation and connection status are independent, small bottom lines; each disappears on its own readiness and the ready home contains only the character and gear. Offline/error does not display endless connecting. Settings retains diagnostics and preparation retry.
|
||
|
||
The serial `avatar-validation` worker first verifies an exact tiny bootstrap manifest, poster and existing silent neutral body. This body-only loop has no TALK patches, expression or dance capability. It then strictly admits the complete frozen pack on that worker: index/runtime SHA/schema, own-frame/PTS/body bindings, 3185 PNG hashes/dimensions and body/edge/action bytes. Duplicate edge media already verified through its own runtime is reused; digest hex encoding avoids per-byte Formatter overhead. GL/codec decoding remains on renderer workers and only current/next graph resources are decoded, within the existing 8MB per-runtime / 32MB aggregate limits. No array of all 13 runtimes' bitmaps is created on main.
|
||
|
||
One `StartupAvatarView` prepares the full renderer hidden/held at actual neutral frame0. Handoff requires the bootstrap's actual frame0 and the full renderer's composed frame0 of the **same body SHA**. The bootstrap decoder releases before capability activation; late callbacks cannot reclaim its layer. Full playback retains code21's decoded source-PTS clock and code19's ACTION display owner. Background/disposal fences both renderers; settings does not key/recreate the host. A preparation failure keeps the basic role/poster and allows an explicit settings retry.
|
||
|
||
`StartupLoadCache` shares inflight/successful metadata by APK versionCode + lastUpdateTime + exact index SHA + asset root + validator version. It holds no Activity, bitmap, Surface, camera or GL object. Destroy removes listeners; failed work is not success-cached. Different lifecycle instances reconstruct their own render resources.
|
||
|
||
A private atomic, fsynced, bounded complete receipt applies **only to immutable APK assets** for that exact key. A new process still reads/hashes/parses all index/runtime metadata through strict production parsers; only previously completed media/PNG byte checks are reused. Version/pin/install/validator change, missing/corrupt/partial records revalidate. It never deserializes a trusted AvatarPack, applies to downloaded paths, or trusts a filename. Receipt-write failure leaves current verified admission valid and means a future process verifies again. First install remains a full verification; process cache and cross-process receipt are distinct.
|
||
|
||
## Capability update
|
||
|
||
Before full verification **and actual renderer handoff**, HELLO sends protocol1 + the exact pending reviewed SHA + empty action kinds. It does not advertise dance. Gateway authorizes pending readiness only against its independent exact reviewed registry on that authenticated socket. `client.capabilities.ready` can activate only the same authorized pin; legacy/unknown/different pins cannot upgrade, repeats are idempotent and old sockets are fenced. It changes neither turn, history, AudioRecord, drain nor after_action. Each LLM generation snapshots availability at request start, so readiness affects later requests rather than reinterpreting an in-flight answer. Offline dance controls also wait for the real handoff.
|
||
|
||
Gateway-only hash/busy/backup deployment succeeded; unit/environment relationships were verified unchanged. Backup: `/home/gorios-spark-2/lan-voice/.runtime/backups/voice-gateway-20261013-142340`. Version remains 0.8.0; Qwen/provider/server clock/TTS parameters and model/ASR/TTS/VAD services were not changed or restarted. Existing exact action registry/durations remain unchanged.
|
||
|
||
## Assets and reproducibility
|
||
|
||
Frozen index: `987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887`, 3222 runtime references, 5 bodies + 8 own-mouth bridges + 13 edges + 2 dances. White outfit and mouth1.1 bytes stay identical to code18/21. No new black-tulle assets enter this candidate. Bootstrap adds only a tiny manifest and poster under `avatar/startup-white-01/`, plus the same ignored PNG as an Android resource. No new body/video is generated.
|
||
|
||
After restoring the externally pinned private import, run `python3 scripts/prepare-startup-assets.py`; it validates the full pin and source body hash and reproduces the exact archived manifest/poster SHA from existing neutral sourceframe0 with ffmpeg/Pillow. `--verify-only` checks existing output without changing it. `manifests/startup-white-01.json` and the script are versioned; portrait PNGs/videos stay ignored. No paid/model/generation call was made for this stage. Coord subsequently superseded the SVG launch-art candidate: this version uses existing icon/system resources. New Pi PNG icon/Splash and any new visual short-loop file are not yet delivered and will be adapted separately; no raster image is vectorized and no unavailable loop blocks startup. The preparation loop here is the existing verified white neutral body, with no fixed waiting timer.
|
||
|
||
## Evidence and limits
|
||
|
||
Nine JVM entry points/UI contracts, existing 757 reported-clock and 103 native callback assertions, production renderer/capture/action regression cases, 200 offline GLES pixel cases, 32 packaging tests, and strict complete-pack parser/media gate pass. Gateway archive ran 101 tests: **100 passed, 1 existing Silero artifact-exclusion skip**. A finite canonical-source isolated WS route probe used 3 connections, with 0 LLM/ASR/TTS calls: pending exactpin upgrades, legacy/unknown remain unavailable, duplicate update preserves the turn. This is not a live phone conversation or inference benchmark.
|
||
|
||
Production background repository replay over actual APK bytes reports **0 main-thread asset reads**, cold 3185 patch reads, cross-process receipt 0 patch reads, same-process reload 0 reads. Concurrency/cancel/failure-retry/key/receipt corruption and actual host source0/target0/decoderrelease/lifecycle/failure-retry callbacks are tested with Android/codec/GL doubles. Host time is not phone performance. Instrumentation compiles but has not run on a device. Code21 phone playback success is inherited evidence, not code22 GPU handoff or performance certification. Music listening/full dynamic naturalness remain unmeasured.
|
||
|
||
## Coord device measurement
|
||
|
||
Normal launcher with already granted MIC/CAM can automatically connect and start capture in foreground after the first draw. Offline preview never constructs VoiceSession/camera or captures either sensor. This agent does not install or launch the phone.
|
||
|
||
On the existing authorized WindowsADB serial `0123456789ABCDEF`, measure the **same normal launcher conditions** as code21, without clearing app data or changing networking:
|
||
|
||
```text
|
||
adb -s 0123456789ABCDEF shell am force-stop com.gorios.lanvoice
|
||
adb -s 0123456789ABCDEF shell am start -W -n com.gorios.lanvoice/.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
|
||
```
|
||
|
||
Sensor-free control entry:
|
||
|
||
```text
|
||
adb -s 0123456789ABCDEF shell am start -W -n com.gorios.lanvoice/.MainActivity --ez avatar_offline_preview true
|
||
```
|
||
|
||
Capture only fixed startup markers via `adb ... logcat -v monotonic -s LanVoiceStartup:I *:S`, plus separately filtered System `Displayed com.gorios.lanvoice` / Choreographer skip metadata. Do not save general chat, camera/audio or raw protocol logs. Compare first post-update process (receipt_miss), a force-stopped second process (receipt_hit), and settings open/close in one process (stable host). Do not clear receipt/data to manufacture repeated cold misses; version/install-key changes already revalidate.
|
||
|
||
Marker fields: `run`, finite `phase`, `mono_ms`, `elapsed_ms`, `duration_ms` (-1 means an event endpoint; subtract matching monotonic endpoints). Phases include on_create, shell_set_content, first_draw, poster_ready, basic_verify, first_idle_frame, index_parse, runtimes_verify, media_verify, cache_hit/miss, receipt_hit/miss/write, full_ready/failed, full_first_gl, handoff, health_start/http, ws_open, auth, hello, cap_ready, camera_model/bind/ready. `camera_ready` is the first analysis image arrival; it is not proof of a recognized face. These metadata enter the bounded500 diagnostic ring without frame-level churn.
|
||
|
||
Suggested coord JSON: versionCode/pinPrefix/mode, amStartStatus/waitMs, displayedMs, skippedFrames, cacheClass, startupPhases[{run,phase,monoMs,elapsedMs,durationMs}], roleReady/connectionReady/actionNegotiation, errors as fixed enums, devicePerformance=`measured` or `not_run`. Report missing markers as missing, not as zero-duration/unexecuted phases. Actual performance improvement must be stated only after this same-phone comparison.
|
||
|
||
## Published candidate
|
||
|
||
Published `0.7.4 / code22`, package `com.gorios.lanvoice`, arm64, min26 / target34, using the existing icon (no SVG import, no pending PNG artwork).
|
||
|
||
- APK: http://192.168.31.124:8080/lan-voice-v074-startup-fix-code22-arm64-debug.apk
|
||
- SHA256: `c39457c2ff0799779b6bcaecb713c13a6d52bbd90dea4634c7216ed8929e1131`; HTTP APK and `.apk.sha256` bytes independently matched.
|
||
- Debug certificate SHA256: `b9608336bc1ed1de3269bb4594f9fe718daaa5439511c5187aa385d2b799dcf1`.
|
||
- Compiled pin remains `987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887`; startup and repaired source-PTS clock flags are true.
|
||
- Final APK comparison: all 3816 existing `assets/avatar/` files equal code21 byte-for-byte, including all 3222 frozen runtime references. Only two tiny bootstrap asset files were added. Code18/21 and older published packages remain available.
|
||
|
||
Fresh final-source regression passed all nine JVM/UI entries and 32 package tests. Final Gradle assembled the APK and compiled Android instrumentation; instrumentation was not run. Actual final APK production loader/media callback replay passed (including legal idle returns after new turns, independent happy/sad mouths, full action layer/audio release/return). The real repository over final APK bytes passed two isolated JVM processes: cold 3185 patch reads, receipt reload zero patch reads, both zero main-thread asset reads; same-process full reload zero asset reads. These use Android/codec/GL doubles and do not prove phone rendering or elapsed startup time.
|
||
|
||
The deployed canonical gateway was read-only rechecked after build: all 37 archived source/registry hashes match. Only the previously described gateway capability change was deployed/restarted once in this stage; the APK publisher does not deploy a server. Gateway remains 0.8.0 with unchanged environment, provider/time/TTS parameters and other services. 100 gateway tests passed, with the one explicit pre-existing excluded-Silero-model skip. The isolated finite WS probe used three connections and no inference.
|
||
|
||
No code22 phone install, launch, capture, screenshot, GPU test or performance measurement was performed here. Coord can now compare normal first-draw/system Displayed and the monotonic startup stages to the code21 31.949s baseline on the same phone. Normal startup with already granted MIC/CAM can auto-start foreground capture; use the documented offline extra for a sensor-free control. Preparation is a verified existing neutral loop, not a fixed-duration intro. The next PNG icon/Splash remains a separate integration after actual transfer, with a fresh artifact version if code22 has already shipped.
|