New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 7 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 5
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug-Regression



Sign in to add a comment
link

Issue 906347: Gamepad not working in WebChromeClient

Reported by westb...@gmail.com, Nov 17

Issue description

Steps to reproduce the problem:
Gamepads work on Chrome running on Android TV but when in my android app which is a web view using WebChromeClient no gamepads are detected.

What is the expected behavior?
Using the WebView and WebChromeClient I would expect gamepad support to be enabled.

What went wrong?
No gamepads are detetected in javascript when using the webview.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 70.0.3538.102  Channel: stable
OS Version: TV
Flash Version:
 

Comment 1 by chelamcherla@chromium.org, Nov 19

Cc: chelamcherla@chromium.org
Labels: Needs-triage-Mobile Triaged-Mobile Needs-Feedback
@westbrma: Could you please provide sample app or test URL on which this issue is seen. If possible please provide screencast/screenshot of error you are seeing. This would help in further triaging of the issue.

Thanks!

Comment 2 by westb...@gmail.com, Nov 19

This is my code inside the Activity class: 

WebView webView = findViewById(R.id.myWebView);
WebChromeClient client = new WebChromeClient();
webView.setWebChromeClient(client);
webView.getSettings().setJavaScriptEnabled(true);

This is the javascript gameloop code from my site:

function gameLoop(){
   let gamepads = navigator.getGamepads();
   requestAnimationFrame(gameLoop);
}

gameLoop();

gamepads is always an array of 4 nulls, no errors just that no gamepads are detected even after mashing buttons on the gamepad.

When I run the same site using chrome on the same device gamepads[0] has a object set.

Comment 3 by sheriffbot@chromium.org, Nov 19

Project Member
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 4 by chelamcherla@chromium.org, Nov 20

Labels: Needs-Feedback
@westbrma: Please provide above code in form of app/html file. This would be easier for TE to check.

Thanks!

Comment 5 by reillyg@chromium.org, Nov 21

Cc: mattreynolds@chromium.org
mattreynolds@ is the Gamepad API supposed to work in a WebView?

Comment 6 by westb...@gmail.com, Nov 21

I guess I assumed it should since it works in Chrome

Comment 7 by sheriffbot@chromium.org, Nov 21

Project Member
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 8 by dmboh...@gmail.com, Nov 27

Hey guys, gamepad api is totally broken on Android devices since chrome 70. It was worked before, but now navigator.getGamepads() returns empty list.
To check gamepad you can use this website
http://html5gamepad.com

Comment 9 by chelamcherla@chromium.org, Nov 28

 Issue 909041  has been merged into this issue.

Comment 10 by chelamcherla@chromium.org, Nov 28

Labels: -Type-Bug -Pri-2 ReleaseBlock-Stable RegressedIn-70 Target-70 Target-71 Target-72 FoundIn-72 M-70 FoundIn-71 FoundIn-70 hasbisect Pri-1 Type-Bug-Regression
Owner: jinsuk...@chromium.org
Status: Assigned (was: Unconfirmed)
Tested the issue in Android and able to reproduce the issue. 

Steps Followed:
1. Navigated to http://html5gamepad.com
2. Connected Gamepad using cable, Pressed some buttons and not seeing any display info

Chrome versions tested:
70.0.3538.110, 72.0.3623.2[latest canary]

OS:
Android 9.0.0

Android Devices:
Pixel 2 XL

Good Build - 70.0.3503.0
Bad Build - 70.0.3504.0 

Unable to provide per-revision bisect as we do not have required hardware to connect gamepad and perform bisect simultaneously, hence providing manual cl.

CL: https://chromium.googlesource.com/chromium/src/+log/70.0.3503.0..70.0.3504.0?pretty=fuller&n=10000

Suspecting https://chromium.googlesource.com/chromium/src/+/3ccb3a896b8cc61114a33c203bec28a93cfad8e6 from the changelog.

@ jinsukkim: Could you please look into the issue, pardon me if it has nothing to do with your changes and if possible please assign it to owner concerned. Adding RB-Stable for M-70, Please remove if this not the case. 

Thanks!

Comment 11 by pnangunoori@chromium.org, Nov 29

Friendly ping to look into this issue and to provide further update on this issue as it has been marked as a stable blocker.

Thanks!

Comment 12 by jinsuk...@chromium.org, Nov 29

I can take a look once I get a gamepad controller.

Comment 13 by benmason@chromium.org, Nov 30

This will not block the M71 release.

Comment 14 by jinsuk...@chromium.org, Dec 1

Status: Started (was: Assigned)

Comment 15 by pnangunoori@google.com, Dec 3

Friendly ping for an update on this issue as it is marked as stable blocker & stable release is coming soon.
Thanks!

Comment 16 by bugdroid1@chromium.org, Dec 3

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/00ebecafc6766ac90c9d50ecf8c28a1441a053d3

commit 00ebecafc6766ac90c9d50ecf8c28a1441a053d3
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Mon Dec 03 21:50:49 2018

Android: Fix a bug not supporting gamepad

https://crrev.com/c/1135874 left out checking gamepad events
by mistake. This CL fixes it by adding the check against
GenericMotionEvent in the content ui event handler.

Tested on https://html5gamepad.com with a USB gamepad.

Bug:  906347 
Change-Id: I2bd0890f2533e70a772dbb0b005d69bf086d1595
Reviewed-on: https://chromium-review.googlesource.com/c/1356727
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613268}
[modify] https://crrev.com/00ebecafc6766ac90c9d50ecf8c28a1441a053d3/content/public/android/java/src/org/chromium/content/browser/ContentUiEventHandler.java
[modify] https://crrev.com/00ebecafc6766ac90c9d50ecf8c28a1441a053d3/content/public/android/java/src/org/chromium/content/browser/Gamepad.java

Comment 17 by jinsuk...@chromium.org, Dec 3

Labels: Merge-Request-72

Comment 18 by manoranjanr@google.com, Dec 4

Cc: -chelamcherla@chromium.org sindhu.chelamcherla@chromium.org benmason@chromium.org

Comment 19 by sheriffbot@chromium.org, Dec 4

Project Member
Labels: -Merge-Request-72 Hotlist-Merge-Approved Merge-Approved-72
Your change meets the bar and is auto-approved for M72. Please go ahead and merge the CL to branch 3626 manually. Please contact milestone owner if you have questions.
Owners: govind@(Android), kariahda@(iOS), djmm@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 20 by gov...@chromium.org, Dec 4

Pls merge your change to M72 branch 3626 ASAP so we can pick it up for tomororw's dev release. Thank you.

Comment 21 by bugdroid1@chromium.org, Dec 5

Project Member
Labels: -merge-approved-72 merge-merged-3626
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fd35126e1ea5bc0cae31cdde86a2d779fd438646

commit fd35126e1ea5bc0cae31cdde86a2d779fd438646
Author: Jinsuk Kim <jinsukkim@chromium.org>
Date: Wed Dec 05 00:58:59 2018

Android: Fix a bug not supporting gamepad

https://crrev.com/c/1135874 left out checking gamepad events
by mistake. This CL fixes it by adding the check against
GenericMotionEvent in the content ui event handler.

Tested on https://html5gamepad.com with a USB gamepad.

TBR=boliu@chromium.org

Bug:  906347 
Change-Id: I2bd0890f2533e70a772dbb0b005d69bf086d1595
Reviewed-on: https://chromium-review.googlesource.com/c/1356727
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#613268}(cherry picked from commit 00ebecafc6766ac90c9d50ecf8c28a1441a053d3)
Reviewed-on: https://chromium-review.googlesource.com/c/1361750
Reviewed-by: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/branch-heads/3626@{#58}
Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}
[modify] https://crrev.com/fd35126e1ea5bc0cae31cdde86a2d779fd438646/content/public/android/java/src/org/chromium/content/browser/ContentUiEventHandler.java
[modify] https://crrev.com/fd35126e1ea5bc0cae31cdde86a2d779fd438646/content/public/android/java/src/org/chromium/content/browser/Gamepad.java

Comment 22 by jinsuk...@chromium.org, Dec 5

Status: Fixed (was: Started)

Comment 23 by chelamcherla@chromium.org, Dec 19

Cc: chelamcherla@chromium.org
 Issue 916104  has been merged into this issue.
Has this gone out to users yet? What version will it be available in? Sorry if this is obvious, but I'm new to the chromium project, and this bug tracker tool.

Comment 25 by cr-audit...@appspot.gserviceaccount.com, Dec 19

Project Member
Labels: Merge-Merged-72-3626
The following revision refers to this bug: 
https://chromium.googlesource.com/chromium/src.git/+/fd35126e1ea5bc0cae31cdde86a2d779fd438646

Commit: fd35126e1ea5bc0cae31cdde86a2d779fd438646
Author: jinsukkim@chromium.org
Commiter: jinsukkim@chromium.org
Date: 2018-12-05 00:58:59 +0000 UTC

Android: Fix a bug not supporting gamepad

https://crrev.com/c/1135874 left out checking gamepad events
by mistake. This CL fixes it by adding the check against
GenericMotionEvent in the content ui event handler.

Tested on https://html5gamepad.com with a USB gamepad.

TBR=boliu@chromium.org

Bug:  906347 
Change-Id: I2bd0890f2533e70a772dbb0b005d69bf086d1595
Reviewed-on: https://chromium-review.googlesource.com/c/1356727
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#613268}(cherry picked from commit 00ebecafc6766ac90c9d50ecf8c28a1441a053d3)
Reviewed-on: https://chromium-review.googlesource.com/c/1361750
Reviewed-by: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/branch-heads/3626@{#58}
Cr-Branched-From: d897fb137fbaaa9355c0c93124cc048824eb1e65-refs/heads/master@{#612437}

Comment 26 by chelamcherla@chromium.org, Dec 31

 Issue 918241  has been merged into this issue.

Sign in to add a comment