Repository navigation
fix(android): restore UI after task removal and clarify rejected pairings - #4
Merged
Merged
Conversation
…ings - Recreate the main webview window when Android starts a new activity in a process the foreground service kept alive; Tauri drops the window with the destroyed activity, which left the reopened app blank. - Track the newest live activity for intents, permission prompts, and the APK installer instead of the destroyed first activity. - Re-read the agent status after the foreground service starts observing it so the notification cannot stay on a stale "Connecting" state. - Add a credential_not_found connection state so a server that no longer knows the device is explained instead of shown as a generic failure. - Offer "Forget connection" on the pairing recovery screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
twlite
added a commit
that referenced
this pull request
Nov 30, 2026
Removing OPPA from Recents while the foreground agent runs destroys the activity but keeps the process and agent alive. Android may destroy the replaced activity only after its successor was created, and PR #4's restore keyed on `get_webview_window("main")` existing, so physical devices could reopen to a blank screen. Root causes: - the stale activity's window still existed when the new activity appeared, so no window was created; its late destroy then removed it; - Wry keys IPC and asset handlers by webview label, so a late destroy of the old "main" web view removed the new one's handlers; - Tauri's process-wide plugin onDestroy reported "activity destroyed" for the stale activity and detached native calls for the live one; - Wry falls back to activity id 0 for launch intents with extras. Fix: - Kotlin activity registry: process-unique Wry ids, generation-tagged activityCreated/activityDestroyed events with a live count, replay on channel attach, and intents and permission prompts on the live activity; - `ui_lifecycle.rs`: a tested state machine that gives each activity generation its own window, ignores duplicate and stale events, keeps the window across configuration changes, waits for the frontend's `report_interface_ready`, and replaces a window that never reports ready (at most three attempts), with concise logcat diagnostics; - vendored tao 0.35.3 and wry 0.55.1 with documented fixes for a lost event-loop wake-up that left new web views uncreated, a main-thread self-deadlock (ANR) and unwrap panics in Wry's main pipe, and IPC rejected as `about:blank` during recreation. Verified on Android 13 (release) and Android 15 (debug) emulators: 25-40 consecutive recreations with late destroys, notification reopen, config changes, lock, stop, force-stop and background-disabled flows. The process, agent identity and gateway session stay unchanged and every job prints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two Android issues found while the foreground agent was running, plus a small UX addition.
Blank screen after closing from Recents
When the task is swiped away, the foreground service keeps the process alive, but Tauri (2.11 / tao 0.35) drops the
mainwindow along with the destroyed activity. Setup never runs again, so the reopened activity stayed blank.MainActivity.onCreatenotifies the plugin (OppaActivityHost.onActivityCreated), and the mobile event loop recreates themainwindow when it's missing (restore_main_window).AgentBridge.activity) for intents, notification permission prompts, and the APK installer, instead of Tauri's stale first activity.Notification stuck on "Connecting…"
The agent could rewrite the status file between the service's first read and the moment
FileObserverstarted. The service now re-reads the file once after it starts watching.Rejected pairings looked like "unpaired"
A gateway rejection of
credential_not_found(for example, the in-memory example server restarted) was shown as a generic "Authentication failed".credential_not_foundconnection state with an explanatory message on the setup screen.Local credentials were verified to persist across notification Stop, force-stop, and reinstall; the server accepted the same agent ID each time.
Testing
cargo test -p oppa(adds arejection_statemapping test),cargo clippy -p oppa --all-targets -D warnings,pnpm --filter oppa typecheck,pnpm format:check🤖 Generated with Claude Code