Closed Bug 1982949 Opened 1 year ago Closed 1 year ago

layout/base/tests/test_interactive_widget.html fails on new android 14 emulator

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

(Reporter: jmaher, Assigned: hiro)

References

Details

Attachments

(2 files)

on this try push, there are many failures, but it appears that in all instances layout/base/tests/test_interactive_widget.html is failing with test timed out (as per this log)

I am planning on skipping this test on android 14 in bug 1982943.

Flags: needinfo?(hikezoe.birchill)
See Also: → 1831649
Severity: -- → S3
Priority: -- → P3

I am testing on Android 16 so things might be different from on Android 14 though, what I've found so far is that the software keyboard doesn't appear by default even on Chrome. We have to change the Gboard (the default keyboard app on Android) setting, we need to turn on "Show on-screen keyboard" in "Write in test fields".

With the change, I can see the software keyboard on GeckoView example. But still the software keyboard seems not to appear on GeckoView test runner.

is there a way to set this keyboard so we can test in CI? maybe some adb command to set a prop ?

I am afraid I don't know. That's said, it's probably unrelated the failure on Android 14. I've also setup Android 14 emulator, by default the keyboard appears on GeckoView example.

Also I've found a reason why the keyboard doesn't appear on the test runner. While running the test on Android 14, I've got

InputMethodManager: Ignoring showSoftInput() as view=org.mozilla.geckoview.GeckoView{7bf8fc1 VFE...... ........ 0,0-1080,2137} is not serve

So apparently GeckoView tried to show the keyboard but it failed. It looks like the failure reason is that GeckoView's view doesn't have the focus.

I have a workaround to take the focus and it seems to work.

https://treeherder.mozilla.org/jobs?repo=try&revision=0539cadc3cfea351008e3bd8c8012f9f456adcfb

Flags: needinfo?(hikezoe.birchill)

While running test_interactive_widget.html on Android 14
"InputMethodManager: Ignoring showSoftInput() as
view=org.mozilla.geckoview.GeckoView{7bf8fc1 VFE...... ........ 0,0-1080,2137}
is not served." appears in adb log. The message is output in
InputMethodManager.showSoftInput when the
hasServedByInputMethodLocked(view) check fails [1]. The check was
introduced in this commit [2]. As the commit message implies, when the
test fails GeckoView doesn't have focus.

On the other hand, even on GeckoView test runner, showShoftInput call
doesn't fail if the function is invoked via real touch events such as
tapping an input element by user.

Actually the test uses synthesizeNativeTouchPoint which aims to send a given
event directly to our PanZoomController.onTouchEvent function [3], it's
slightly different from touch events by users. I.e.
the events generated by synthesizeNativeTouchPoint don't run through the
path where OS level events run.

A natural question here is that "is there any API to synthesize OS level
events?". Indeed UI Automator uses InputManager.injectInputEvent API [4]
to send an OS level event, but the API seems to be hidden given that there's
no description in the InputManager reference [5]. Thus using the API is not
realistic for us.

So, we'd rather just try to obtain the focus when we synthesize an
ACTION_POINTER_DOWN event.

[1] https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/view/inputmethod/InputMethodManager.java;l=2451-2456;drc=0df41fe0de672fc9d30ec2db1cd09faecbb0fe0e?hl=ja
[2] https://cs.android.com/android/_/android/platform/frameworks/base/+/970d9d2e0c979cf9a0ff0a79ef49044ed1363d4f?hl=ja
[3] https://searchfox.org/firefox-main/rev/ee102e926521b3e460293b0aea6b54b1a03f6f74/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java#926
[4] https://android.googlesource.com/platform/frameworks/base.git/+/master/core/java/android/app/UiAutomationConnection.java#164
[5] https://developer.android.com/reference/android/hardware/input/InputManager

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED
Pushed by hikezoe.birchill@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/83884a26b287 https://hg.mozilla.org/integration/autoland/rev/2967ffa4b18e Forcibly request focus on ACTION_POINTER_DOWN. r=geckoview-reviewers,layout-reviewers,emilio,m_kato
Pushed by chorotan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d56d4ccc0ee8 https://hg.mozilla.org/integration/autoland/rev/a42b5fa4db30 Revert "Bug 1982949 - Forcibly request focus on ACTION_POINTER_DOWN. r=geckoview-reviewers,layout-reviewers,emilio,m_kato" for causing mochitest failures on test_interactive_widget.html

Backed out for causing mochitest failures on test_interactive_widget.html

Backout link

Push with failures

Failure log

Flags: needinfo?(hikezoe.birchill)

Looks like the failure happens only on X-orig run.

Geez, the test works fine on my local Android 34 emulator with --enable-xorigin-tests.

It looks like on recent-ish versions of Android we never receive
MozAfterEvent after the software keyboard appeared, in other words on
older versions of Android we receive a MozAfterEvent there for some
reasons even on overlays-content mode. This is quite odd since there's
no need to paint, thus we can drop promiseAfterPaint calls.

Also we wait for focus() in each test case so we don't need to wait
for any MozAfterEvent.

Flags: needinfo?(hikezoe.birchill)
Pushed by hikezoe.birchill@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a8696f5bab81 https://hg.mozilla.org/integration/autoland/rev/e32697b4ecd5 Drop `await promiseAfterPaint()`s in test_interactive_widget.html. r=layout-reviewers,emilio https://github.com/mozilla-firefox/firefox/commit/ce57b1689260 https://hg.mozilla.org/integration/autoland/rev/4e411fec288d Forcibly request focus on ACTION_POINTER_DOWN. r=geckoview-reviewers,layout-reviewers,emilio,m_kato
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
QA Whiteboard: [qa-triage-done-c145/b144]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: