NoSuchMethodException in AccessibilityTest.getChildId on Android API 28
Categories
(GeckoView :: General, defect, P3)
Tracking
(firefox-esr60 wontfix, firefox65 wontfix, firefox66 wontfix, firefox67 wontfix, firefox110 wontfix, firefox111 wontfix, firefox112 fixed)
People
(Reporter: mbrubeck, Assigned: m_kato)
References
(Blocks 2 open bugs, )
Details
(Whiteboard: [sci-exclude])
Attachments
(1 file)
Running the geckoview-junit AccessibilityTest on an emulator with Android 9.0 ("P", api level 28) causes most tests to fail with the following exception:
java.lang.NoSuchMethodException: getChildNodeIds []
at java.lang.Class.getMethod(Class.java:2068)
at java.lang.Class.getMethod(Class.java:1690)
at org.mozilla.geckoview.test.AccessibilityTest.getChildId(AccessibilityTest.kt:88)
Updated•5 years ago
|
Comment 1•5 years ago
|
||
The method is still there in API 28. Matt said it might be that Android 9 somehow restricts access to @hide public methods?
Comment 2•5 years ago
|
||
Running this on the target device makes the test pass: adb shell settings put global hidden_api_policy_p_apps 1
.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 3•5 years ago
|
||
I'm going to unassign myself from this. Looks like the adb shell command above will make this work locally on API 28+ emulators. If we ever start using that API or higher in CI, we may need to put this in some harness script, or revisit.
I hesitate to @SdkSuppress it. I'll leave this up to the geckoview team.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•3 years ago
|
Comment 4•2 years ago
|
||
(In reply to Eitan Isaacson [:eeejay] from comment #3)
I'm going to unassign myself from this. Looks like the adb shell command above will make this work locally on API 28+ emulators. If we ever start using that API or higher in CI, we may need to put this in some harness script, or revisit.
I hesitate to @SdkSuppress it. I'll leave this up to the geckoview team.
so I've been thinking about this again, because I want to start running our tests on higher API levels.
I'm a little bit worried about enabling hidden APIs in our tests because it might make us miss legitimate bugs where we're using an hidden API by mistake.
Eitan, is there any way we can use a public API for these tests instead?
Comment 5•2 years ago
|
||
Mostly for myself, how to enable hidden APIs is documented at https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces#how_can_i_enable_access_to_non-sdk_interfaces
Comment 6•2 years ago
|
||
We would need to elevate the access to SessionAccessibility
and have some special methods there for testing purposes only. I don't love that. What I like about our current setup is that it is a black box test that has the same access as an accessibility service has. I haven't looked into this issue in years, and I wonder if there is another solution to this that we didn't have back them.
Comment 7•2 years ago
|
||
This doc suggests that maybe we could get the same kind of coverage with something like Espresso? Would mean rewriting a lot of this..
https://developer.android.com/guide/topics/ui/accessibility/testing#espresso
Comment 8•2 years ago
|
||
We could potentially split out the Accessibility tests in its own job that is allowed to access hidden Android APIs.
Updated•2 years ago
|
Updated•1 year ago
|
Assignee | ||
Comment 10•1 year ago
|
||
Assignee | ||
Comment 11•1 year ago
|
||
When getting virtual ID of a11y tree, we use internal method via
reflection. But AccessibilityNodeInfo.getChildId
is hidden now.
As workaround, since mChildNodeIds
is still @UnsupportedAppUsage
,
we can use it to get child node id.
This has another fix. Clipboard access requires foreground on Android 10+.
So we have to set window foucs when using clipboard.
Also, AccessibilityTest
won't work on Android 12 since more methods
seem to be hidden from Android 12.
(by @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R)
).
Updated•1 year ago
|
Comment 12•1 year ago
|
||
Pushed by m_kato@ga2.so-net.ne.jp: https://hg.mozilla.org/integration/autoland/rev/2d4e1b0eff7d Pass AccessibilityTest on Android 11 or early. r=eeejay,geckoview-reviewers,owlish
Comment 13•1 year ago
|
||
bugherder |
Comment 14•1 year ago
•
|
||
No need to uplift this test fix to Beta 111.
Description
•