Open the sign-in URL through an ACTION_VIEW Intent on Android

The previous commit made the missing launcher honest; this gives Android a real
one, so Login Flow v2 can complete on device.

Builds `new Intent(ACTION_VIEW, Uri.parse(url))` and hands it to
`startActivity` over JNI. The JavaVM and Activity come from ndk_context, which
android-activity's glue populates at startup — the same handle Slint's backend
uses, so there is no second VM to reconcile.

The login worker is a plain std::thread and therefore unknown to the JVM, where
any JNI call would abort the process. jni 0.22 scopes attachment to a closure
rather than returning a guard, so the whole Intent is built and dispatched
inside `attach_current_thread` and the thread detaches on the way out.

Names use `jni_str!` and signatures `jni_sig!`, both compile-time: a typo is a
build error rather than a NoSuchMethodError on the device. A pending Java
exception is checked and cleared before returning, since leaving one pending
makes the next JNI call fail somewhere unrelated; in practice it means
ActivityNotFoundException, i.e. no browser installed.

jni is pinned to 0.22 to match Slint's Android backend.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 22:35:38 +02:00
co-authored by Claude Opus 5
parent 0876977133
commit 8b7c1e7f10
3 changed files with 89 additions and 1 deletions
Generated
+2
View File
@@ -1469,7 +1469,9 @@ dependencies = [
"dr-sync-nextcloud",
"dr-thumbs",
"dr-types",
"jni 0.22.4",
"log",
"ndk-context",
"pollster",
"reqwest",
"rusqlite",