Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Based on the current Android documentation for View.performAccessibilityAction, it has a parameter of type "int" named "action". However I believe this mapping might be incorrect.
In the documentation it notes that a default implementation will delegate ACTION_SCROLL_BACKWARD(https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html#ACTION_SCROLL_BACKWARD) and ACTION_SCROLL_FORWARD(https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html#ACTION_SCROLL_FORWARD) to the nested scrolling parents if nested scrolling is enabled on the view. This is clue #1 that this parameter of "int action" should be of C# type "Action" (https://developer.xamarin.com/api/type/Android.Views.Accessibility.Action/)
Instead the same method based on the docs expects an enum of type "GlobalAction"
The reason why this seems off is that the source code of this method in Android seems to specifically have a switch case on these "Action" items.
I believe the culprit is the method mapping here:
I believe that not only this method is wrong, but other methods as well such as
https://developer.android.com/reference/android/view/View.AccessibilityDelegate.html#performAccessibilityAction(android.view.View, int, android.os.Bundle)
https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeProvider.html#performAction(int, int, android.os.Bundle)
I believe the correct mappings here would be https://developer.xamarin.com/api/type/Android.Views.Accessibility.Action/ for these methods. Please correct me if I'm wrong or if this is intended behavior.
I believe this is the same scenario up to the current master of https://github.com/xamarin/xamarin-android
I agree with Jon Douglas - this is a broken API implementation; the current mapping in Xamarin.Android is incorrect. The int values of GlobalAction don't match the values expected by the Android APIs.
For example, AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD is 8192 and AccessbilityNodeInfo.ACTION_SCROLL_FORWARD is 4096. GlobalAction only has values in the range of 1 - 7.
This kind of mismatching enumification happens at any time due to lack of Android documentation at early phase or anything that *might* be passed via Intent where more than one enum types could apply to one single int.
The only alternative is to totally dump the idea of using enums (which I believe is the way to go).
https://github.com/xamarin/xamarin-android/pull/859 introduces some workarounds and fixes. Old incorrect members cannot be removed for compatiblity. We add method overloads that take the right enums, and introduce getter/setter methods with the right enum for the wrong property (whose type cannot be changed for comparibility).
The PR is merged.
While verifying the bug, I tried using AccessibilityNodeInfo.ActionScrollBackward.
As the intellisense tool tip shows that AccessibilityNodeInfo.ActionScrollBackward is obsolete & will be removed in future. I am using Android.Views.Accessibility.Action.ScrollBackward as mentioned in tool tip. Also did the same for rest constants/enums.
Expected values for comparison taken from-
I found the expected results.
ACTION_SCROLL_BACKWARD = Action.ScrollBackward = 8192
ACTION_SCROLL_FORWARD = Action.ScrollForward = 4096
ACTION_SELECT = Action.Select = 4
ACTION_SET_SELECTION = Action.SetSelection = 131072
ACTION_SET_TEXT = Action.SetText = 2097152
Following are the build details:
Microsoft Visual Studio Enterprise 2017
Version 15.5.0 [27109.1.d15rel]
Microsoft .NET Framework
Installed Version: Enterprise
Xamarin 126.96.36.1994 (a773aca)
Xamarin Designer 4.8.152 (5e0da2967)
Xamarin.Android SDK 188.8.131.52 (HEAD/f65f87747)
Xamarin.iOS and Xamarin.Mac SDK 184.108.40.206 (c4240f3)
Complete Build Details: