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

Issue 906347 link

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

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:
 
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!
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.
Project Member

Comment 3 by sheriffbot@chromium.org, Nov 19

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
Labels: Needs-Feedback
@westbrma: Please provide above code in form of app/html file. This would be easier for TE to check.

Thanks!
Cc: mattreynolds@chromium.org
mattreynolds@ is the Gamepad API supposed to work in a WebView?
I guess I assumed it should since it works in Chrome
Project Member

Comment 7 by sheriffbot@chromium.org, Nov 21

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
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
 Issue 909041  has been merged into this issue.
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!
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!
I can take a look once I get a gamepad controller.
This will not block the M71 release.
Status: Started (was: Assigned)
Friendly ping for an update on this issue as it is marked as stable blocker & stable release is coming soon.
Thanks!
Project Member

Comment 16 by bugdroid1@chromium.org, Dec 3

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

Labels: Merge-Request-72
Cc: -chelamcherla@chromium.org sindhu.chelamcherla@chromium.org benmason@chromium.org
Project Member

Comment 19 by sheriffbot@chromium.org, Dec 4

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
Pls merge your change to M72 branch 3626 ASAP so we can pick it up for tomororw's dev release. Thank you.
Project Member

Comment 21 by bugdroid1@chromium.org, Dec 5

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

Status: Fixed (was: Started)
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.
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}
 Issue 918241  has been merged into this issue.

Sign in to add a comment