Skip to content

fix(android): JNI-based setChecked to span AndroidX.Core 1.16/1.17 (backport #23262) - #23284

Merged
agneszitte merged 1 commit into
release/stable/6.5from
mergify/bp/release/stable/6.5/pr-23262
May 18, 2026
Merged

agneszitte merged 1 commit into
release/stable/6.5from
mergify/bp/release/stable/6.5/pr-23262

Conversation

@mergify

@mergify mergify Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #22999 by calling AccessibilityNodeInfoCompat.setChecked through JNI rather than the managed C# property.

Xamarin.AndroidX.Core 1.17.0 changed the setChecked binding from setChecked(boolean) to setChecked(int) (state constants). When Uno.UI is compiled against one binding version and the consuming app pulls in the other transitively (the reported case was Sentry.Bindings.Android ≥ 6.2.0 dragging in Core 1.17.0), the managed setter throws MissingMethodException at runtime.

Both binding versions wrap the same underlying Java method whose JNI signature simply changed from (Z)V to (I)V. The new AccessibilityNodeInfoCompatJni helper probes both signatures once on first use and dispatches to whichever the loaded binding exposes — no managed reflection, AOT/trim safe.

Alternative to #23097

This is a deliberately narrower path than the already-merged #23097, which solved the same crash by bumping Xamarin.AndroidX.AppCompat 1.7.0.7 → 1.7.1.3 and cascading newer Activity / Fragment / Lifecycle / SavedState / Collection bindings, plus raising SupportedOSPlatformVersion to 23. That cascade in turn forced uno.templates to either bump matching bindings on its side or ride the new minSdk 23 floor, and broke Microsoft.Maui.Controls 10.0.60's transitively-pinned older .Ktx packages (NU1605/NU1608).

The JNI helper here resolves #22999 without touching AppCompat, the surrounding AndroidX stack, the minimum Android API level, or Maui's binding pins. Branch is based on the commit immediately before #23097 merged, so the PR diff shows exactly the cost of the fix.

⚠️ The branch base is pre-#23097. Conflicts with current master are expected and need manual reconciliation if this approach is preferred over #23097.

Test plan

  • Build Uno.UI.Runtime.Skia.Android against an AndroidX.Core 1.16.x baseline (default in the branch's base commit) and confirm node.Checked callers compile and run.
  • In a SamplesApp Android head, add a transitive dependency that forces Xamarin.AndroidX.Core 1.17.0+ (e.g. Sentry.Bindings.Android 6.3.0).
  • Trigger an accessibility focus change on a ToggleButton / CheckBox so UnoExploreByTouchHelper.OnPopulateNodeForVirtualView runs.
  • Confirm no MissingMethodException is logged and TalkBack reports the checked state correctly under both Core 1.16.x and 1.17.x.
  • Repeat against a NativeAOT build to confirm the JNI path is trim/AOT-safe (no IL2026/IL3050 warnings, no runtime null at the cached method id).

🤖 Generated with Claude Code


This is an automatic backport of pull request #23262 done by Mergify.

@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia labels May 18, 2026
@agneszitte

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@agneszitte
agneszitte force-pushed the mergify/bp/release/stable/6.5/pr-23262 branch from 966f5bc to 8153174 Compare May 18, 2026 17:31
@agneszitte

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

AndroidX.Core 1.17.0 changed the AccessibilityNodeInfoCompat.setChecked
binding from setChecked(boolean) to setChecked(int) with state constants.
When Uno.UI is compiled against one binding version and the consuming
app pulls in the other (e.g. transitively via Sentry), the managed
setter throws MissingMethodException at runtime (fixes #22999).

This calls setChecked through JNI directly, probing both Java signatures
once and dispatching to whichever the loaded binding exposes. The C#
Checked property is no longer touched, so the fix stays neutral to the
AndroidX.Core version the final app ships - no AndroidX or
SupportedOSPlatformVersion bumps required.

Alternative path to #23097, which solved the same crash by bumping
AppCompat to 1.7.1.3 and cascading the AndroidX stack to minSdk 23.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
(cherry picked from commit e933487)
@unodevops

Copy link
Copy Markdown
Contributor

@agneszitte
agneszitte merged commit e4de0dc into release/stable/6.5 May 18, 2026
51 of 54 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.5/pr-23262 branch May 18, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants