fix(android): wrap sync HTTP tasks in per-call Tokio runtime

reqwest/hyper-util's GaiResolver calls tokio::runtime::Handle::current()
which panics with "no reactor running" when driven by Bevy's
AsyncComputeTaskPool (async-executor, not Tokio).  Fixed all three spawn
sites in sync_plugin.rs (start_pull, handle_manual_sync_request,
push_replay_on_win) and the push_on_exit fallback by wrapping each HTTP
future in tokio::runtime::Builder::new_current_thread().enable_all().

Also fixes a clippy type_complexity warning in hud_plugin.rs by
extracting HudScoreFont / HudMovesFont / HudTimeFont type aliases for
the update_hud_typography query parameters.

Closes P4 AVD JNI bridge test: keystore JNI verified working on
Android 14 x86_64 AVD (load_access_token returned NotFound correctly);
clipboard JNI compiled and linked, runtime test deferred to a real-device
session with a won game and active sync server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-11 14:55:20 -07:00
parent ae7c6c97f1
commit 2a206b994c
3 changed files with 72 additions and 24 deletions
+32 -5
View File
@@ -186,11 +186,38 @@ rewrites required.
`card_plugin.rs` is explicit child-only teardown (parent kept alive)
and is correct. No gameplay bugs attributed to these warnings over 2+
min AVD runtime.
- [ ] **AVD functional tests for JNI bridges.** Clipboard (`2c822ba`)
and Keystore (`f281425`) shipped but never tested on real device
or AVD. Requires hardware: connect Pixel 7 AVD (Android 14, x86_64),
install the signed APK, and exercise the stats share-link button
(clipboard) and the login flow (keystore).
- [x] **AVD functional tests for JNI bridges.** *Partially closed
2026-05-11.* Pixel 7 AVD (Android 14, x86_64) confirmed running;
APK installs and runs stable. Key findings:
**Keystore JNI — verified working.** Forced `SolitaireServerClient`
by writing a `solitaire_server` settings file, triggering
`android_keystore::load_access_token()` at startup via `start_pull`.
Logcat confirmed: `sync pull failed: authentication error: token
not found for user avd_test` — the JNI call to `AndroidKeyStore`
completed, correctly returned `NotFound`, and the sync system
handled the error gracefully. No panic, no crash from the JNI layer.
**Clipboard JNI — not yet exercised at runtime.** The
`android_clipboard::set_text()` path is gated behind
`Interaction::Pressed` on the share button AND requires a non-null
`share_url` (only present after a won game is uploaded to a sync
server). Both conditions are unreachable in a headless AVD session.
The code compiled and linked correctly on `x86_64-linux-android`.
**Side-finding fixed:** `reqwest`/`hyper-util`'s `GaiResolver`
calls `tokio::runtime::Handle::current()` which panics with "no
reactor running" when driven by Bevy's `AsyncComputeTaskPool`
(async-executor, not Tokio). Fixed in `sync_plugin.rs`: all three
`AsyncComputeTaskPool::spawn` sites and the `push_on_exit` fallback
now wrap HTTP futures in a temporary
`tokio::runtime::Builder::new_current_thread().enable_all()` runtime.
**Touch input limitation:** `adb shell input tap` does not deliver
touch events to Bevy/winit on Android 14 + android-activity 0.6.1
in headless AVD mode. Keyboard events (`KEYCODE_*`) work normally.
Full clipboard test requires a real device or a GUI-accessible AVD
session with a won game and active sync server.
---