Skip to content

fix(android): use whichever activity in plugin manager - #15798

Merged
Legend-Master merged 3 commits into
tauri-apps:devfrom
Legend-Master:use-whichever-activity-plugin-manager
Aug 3, 2026
Merged

Legend-Master merged 3 commits into
tauri-apps:devfrom
Legend-Master:use-whichever-activity-plugin-manager

Conversation

@Legend-Master

@Legend-Master Legend-Master commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Fix #15506

@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Package Changes Through 2673ed6

There are 14 changes which include tauri with minor, tauri-cli with minor, @tauri-apps/cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-bundler with minor, tauri-build with minor, tauri-macos-sign with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-driver with minor, @tauri-apps/api with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.11.1 2.12.0
tauri-utils 2.9.3 2.10.0
tauri-macos-sign 2.3.4 2.4.0
tauri-bundler 2.9.4 2.10.0
tauri-runtime 2.11.3 2.12.0
tauri-runtime-wry 2.11.4 2.12.0
tauri-codegen 2.6.3 2.7.0
tauri-macros 2.6.3 2.7.0
tauri-plugin 2.6.3 2.7.0
tauri-build 2.6.3 2.7.0
tauri 2.11.5 2.12.0
@tauri-apps/cli 2.11.4 2.12.0
tauri-cli 2.11.4 2.12.0
tauri-driver 2.0.6 2.1.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master
Legend-Master force-pushed the use-whichever-activity-plugin-manager branch from d0f44c4 to 14e5189 Compare August 3, 2026 03:52
@Legend-Master
Legend-Master marked this pull request as ready for review August 3, 2026 06:12
@Legend-Master
Legend-Master requested a review from a team as a code owner August 3, 2026 06:12
}

activities.remove(activity)
val nextActivity = activities.firstOrNull()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this potentially the wrong order?

like if i go act 1 > 2 > 3, navigate back to 1 this could give me act 1 instead of 2, no?
assuming act 2 is kept alive after going to act 3 which i'm not sure it is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah with the onCreate changes this may not matter because the result handler is likely still on act 1 anyway?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our entire Android plugin system seems to built on the assumption of a single activity so this is really just a fix for that use case. The multi-activity setup is too broken to fit in that there're really not much can be done here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh ok

@Legend-Master
Legend-Master merged commit 020919a into tauri-apps:dev Aug 3, 2026
30 of 32 checks passed
@Legend-Master
Legend-Master deleted the use-whichever-activity-plugin-manager branch August 3, 2026 08:46
okhsunrog added a commit to okhsunrog/floppa-vpn that referenced this pull request Aug 30, 2026
Installing an APK over the running app crashed it. Android momentarily
leaves the new activity resumed while the old one is destroyed, and
Tauri's plugin manager answers that by handing its activity result
launchers to the surviving activity — which `registerForActivityResult`
refuses, because it may only be called before its owner reaches STARTED:

    IllegalStateException: LifecycleOwner MainActivity is attempting to
    register while current state is RESUMED
      at app.tauri.plugin.PluginManager.onDestroy

The tunnel survives it — that lives in `:vpn` — but the window dies and
has to be started again, which is a poor way to meet an update.

It is a regression in the `dev` branch we already pin for tao 0.36, from
tauri-apps/tauri#15798, and released 2.11.5 has no such code path. Rather
than pin back past the tao fix the tray needs, the fix is one commit on a
fork: each activity registers its own launchers while it is being created,
the one moment registering is allowed. Reported as tauri-apps/tauri#15948,
submitted as #15949 — when it lands, the patch goes back to upstream.

Verified on a Pixel 8 Pro: six consecutive installs over the running app,
no crash, against a build that crashed on every attempt before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Android requestPermissions crashes with unregistered ActivityResultLauncher

2 participants