AndroidX icon indicating copy to clipboard operation
AndroidX copied to clipboard

AccessibilityNodeInfoCompat.Checked data type changed from bool to int with 1.17.0

Open BobbyCannon opened this issue 4 months ago • 3 comments

Android framework version

net9.0-android

Affected platform version

vs2026

Description

We found an issue when upgrading to Xamarin.AndroidX.Core 1.17.0.

The problem is AccessibilityNodeInfoCompat.Checked changed from a bool (v1.16.0.3) to an int (1.17.0).

 IToggleProvider provider = GetProvider();

 if (nodeInfo.Checked.GetType() == typeof(int))
 {
     // Needed for core 1.17+
     //<PackageReference Include="Xamarin.AndroidX.Core" Version="1.17.0" />

     nodeInfo.Checked = (int)? //what to do here?
 }
 else if (nodeInfo.Checked.GetType() == typeof(bool))
 {
     // Works for core < 1.17
     nodeInfo.Checked = provider.ToggleState == ToggleState.On;
 }

Is this expected?

Steps to Reproduce

Upgrade package to the latest 1.17 version.

Did you find any workaround?

No response

Relevant log output


BobbyCannon avatar Nov 03 '25 21:11 BobbyCannon

Did Google just change the underlying behavior?

  • https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java;l=3115-3124?q=AccessibilityNodeInfoCompat

You could maybe find their git history and see if that changed recently.

jonathanpeppers avatar Nov 03 '25 21:11 jonathanpeppers

Oh yeah, no doubt they did. I was just wondering if something should be done or is Xamarin.AndroidX.Core just a pass through proxy library?

BobbyCannon avatar Nov 03 '25 22:11 BobbyCannon

All of the packages here are just C# bindings for the Java/Kotlin implementation.

They only thing we could have done here, is bound this API in C# as a bool or int, but that feels significantly worse? You'd get InvalidCastException and couldn't use the API.

jonathanpeppers avatar Nov 05 '25 14:11 jonathanpeppers