Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Issue 165483003: Gamepad API for Android (Closed)

Created:
6 years, 10 months ago by kbalazs
Modified:
6 years, 9 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Gamepad API for Android This patch implements the platform part of gamepad API for Android and enables it. This is different from other platforms where low level polling based API's are used. On Android gamepad/joystick input is available via the generic event based input system and therefore this implementation is hooked to the input handling of ContentView. Most of the actual logic is implemented in java. Although a poller thread is not necessary for this implementation I kept using it for the native part merely to be able to share more code with desktop. The runtime cost of this code is between 0.1-0.3 milliseconds per frame. Support for more devices is remaining work. TEST=http://www.html5rocks.com/en/tutorials/doodles/gamepad/gamepad-tester/tester.html BUG=330094

Patch Set 1 #

Total comments: 3

Patch Set 2 : updated #

Total comments: 10

Patch Set 3 : incorporated comments #

Total comments: 85

Patch Set 4 : comments addressed #

Patch Set 5 : fix forgotten things #

Total comments: 10

Patch Set 6 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+826 lines, -3 lines) Patch
M android_webview/Android.mk View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M android_webview/all_webview.gyp View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/android/browser_jni_registrar.cc View 1 2 chunks +3 lines, -0 lines 0 comments Download
A content/browser/gamepad/canonical_axis_index_list.h View 1 2 1 chunk +14 lines, -0 lines 0 comments Download
A content/browser/gamepad/canonical_button_index_list.h View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
M content/browser/gamepad/gamepad_platform_data_fetcher.h View 2 chunks +6 lines, -0 lines 0 comments Download
A content/browser/gamepad/gamepad_platform_data_fetcher_android.h View 1 2 3 4 5 1 chunk +36 lines, -0 lines 0 comments Download
A content/browser/gamepad/gamepad_platform_data_fetcher_android.cc View 1 2 3 4 5 1 chunk +100 lines, -0 lines 0 comments Download
M content/browser/gamepad/gamepad_provider.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M content/browser/gamepad/gamepad_standard_mappings.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M content/child/runtime_features.cc View 1 1 chunk +0 lines, -2 lines 0 comments Download
M content/content.gyp View 1 2 3 2 chunks +17 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M content/content_jni.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java View 1 2 3 5 chunks +8 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java View 1 2 3 4 5 1 chunk +361 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/input/GamepadDataMapper.java View 1 2 3 1 chunk +205 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/input/WebGamepadData.java View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/input/gamepad_mapping/CanonicalAxisIndex.template View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/input/gamepad_mapping/CanonicalButtonIndex.template View 1 2 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 30 (0 generated)
bajones
Thanks for doing this, and sorry for the slow review. I've left a few minor ...
6 years, 9 months ago (2014-03-01 00:04:02 UTC) #1
kbalazs
Well, I uploaded it mostly for reference as https://codereview.chromium.org/133943002/ was already under review at the ...
6 years, 9 months ago (2014-03-02 01:19:58 UTC) #2
kbalazs
Updated according to api changes.
6 years, 9 months ago (2014-03-04 21:34:00 UTC) #3
bajones
Great, thanks! This update LGTM. I think I prefer the structure of this patch slightly ...
6 years, 9 months ago (2014-03-04 22:19:18 UTC) #4
kbalazs
@bulach, @darin: I'd like you to get owner approval for the appropriate parts
6 years, 9 months ago (2014-03-04 22:37:53 UTC) #5
bulach
thanks! +ted for the content view core changes.. I have a few comments below: https://codereview.chromium.org/165483003/diff/60001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc ...
6 years, 9 months ago (2014-03-05 12:34:38 UTC) #6
kbalazs
https://codereview.chromium.org/165483003/diff/60001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc File content/browser/gamepad/gamepad_platform_data_fetcher_android.cc (right): https://codereview.chromium.org/165483003/diff/60001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc#newcode82 content/browser/gamepad/gamepad_platform_data_fetcher_android.cc:82: jfloat* raw_axes = env->GetFloatArrayElements(axes, 0); On 2014/03/05 12:34:39, bulach ...
6 years, 9 months ago (2014-03-05 19:56:11 UTC) #7
kbalazs
Incorporated comments. For now I did not update C++ code to use generated enums. This ...
6 years, 9 months ago (2014-03-05 20:40:42 UTC) #8
jdduke (slow)
"The runtime cost of this code is between 0.1-0.3 milliseconds per frame." Can you talk ...
6 years, 9 months ago (2014-03-05 23:05:12 UTC) #9
bajones
On 2014/03/05 23:05:12, jdduke wrote: > "The runtime cost of this code is between 0.1-0.3 ...
6 years, 9 months ago (2014-03-05 23:14:07 UTC) #10
kbalazs
TL;DR: I got this "cost" from the trace event that I added in GetGamepadData. As ...
6 years, 9 months ago (2014-03-06 01:04:39 UTC) #11
Ted C
+jdduke as he's a better owner in general for inputy things, but here are my ...
6 years, 9 months ago (2014-03-07 20:18:08 UTC) #12
kbalazs
Thanks for the review. The most important thing that we need to agree on is ...
6 years, 9 months ago (2014-03-07 22:40:22 UTC) #13
jdduke (slow)
Thanks for the nice addition! A few comments. https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc File content/browser/gamepad/gamepad_platform_data_fetcher_android.cc (right): https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc#newcode34 content/browser/gamepad/gamepad_platform_data_fetcher_android.cc:34: using ...
6 years, 9 months ago (2014-03-07 23:16:39 UTC) #14
jdduke (slow)
https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc File content/browser/gamepad/gamepad_platform_data_fetcher_android.cc (right): https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc#newcode50 content/browser/gamepad/gamepad_platform_data_fetcher_android.cc:50: data_->length = WebGamepads::itemsLengthCap; On 2014/03/07 23:16:39, jdduke wrote: > ...
6 years, 9 months ago (2014-03-07 23:33:26 UTC) #15
Ted C
+boliu to keep me honest w/ my comments about webview. https://codereview.chromium.org/165483003/diff/80001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java (right): https://codereview.chromium.org/165483003/diff/80001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java#newcode55 ...
6 years, 9 months ago (2014-03-08 01:06:00 UTC) #16
Ted C
On 2014/03/08 01:06:00, Ted C wrote: > +boliu to keep me honest w/ my comments ...
6 years, 9 months ago (2014-03-08 01:13:14 UTC) #17
boliu
https://codereview.chromium.org/165483003/diff/80001/content/content.gyp File content/content.gyp (right): https://codereview.chromium.org/165483003/diff/80001/content/content.gyp#newcode504 content/content.gyp:504: 'target_name': 'content_gamepad_mapping', This will need changes in android_webview/all_webview.gyp and ...
6 years, 9 months ago (2014-03-10 18:27:03 UTC) #18
kbalazs
On 2014/03/07 23:33:26, jdduke wrote: > https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc > File content/browser/gamepad/gamepad_platform_data_fetcher_android.cc (right): > > https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc#newcode50 > ...
6 years, 9 months ago (2014-03-11 20:38:11 UTC) #19
kbalazs
https://codereview.chromium.org/165483003/diff/80001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java (right): https://codereview.chromium.org/165483003/diff/80001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java#newcode162 content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java:162: event.getAction() != KeyEvent.ACTION_UP) { On 2014/03/08 01:06:00, Ted C ...
6 years, 9 months ago (2014-03-11 20:38:33 UTC) #20
Ted C
Sadly, the chrome android style guide is a multi step affair. https://codereview.chromium.org/165483003/diff/80001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java (right): ...
6 years, 9 months ago (2014-03-11 20:42:46 UTC) #21
kbalazs
Updated, PTAL https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc File content/browser/gamepad/gamepad_platform_data_fetcher_android.cc (right): https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.cc#newcode34 content/browser/gamepad/gamepad_platform_data_fetcher_android.cc:34: using blink::WebGamepads; On 2014/03/07 23:16:39, jdduke wrote: ...
6 years, 9 months ago (2014-03-12 00:17:35 UTC) #22
boliu
https://codereview.chromium.org/165483003/diff/80001/content/content.gyp File content/content.gyp (right): https://codereview.chromium.org/165483003/diff/80001/content/content.gyp#newcode504 content/content.gyp:504: 'target_name': 'content_gamepad_mapping', On 2014/03/12 00:17:36, kbalazs wrote: > I ...
6 years, 9 months ago (2014-03-12 00:58:45 UTC) #23
jdduke (slow)
Thanks, definitely making progress. https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.h File content/browser/gamepad/gamepad_platform_data_fetcher_android.h (right): https://codereview.chromium.org/165483003/diff/80001/content/browser/gamepad/gamepad_platform_data_fetcher_android.h#newcode29 content/browser/gamepad/gamepad_platform_data_fetcher_android.h:29: void RefreshDevice(JNIEnv* env, On 2014/03/12 ...
6 years, 9 months ago (2014-03-12 01:06:17 UTC) #24
SaurabhK
Folks, I am quite surprised to see the reviewers moving over to this implementation. I ...
6 years, 9 months ago (2014-03-12 12:01:43 UTC) #25
bulach
Hi Saurab, Let us take a few steps back please, there's no reason to assume ...
6 years, 9 months ago (2014-03-12 14:21:29 UTC) #26
kbalazs
On 2014/03/12 14:21:29, bulach wrote: > Hi Saurab, > > Let us take a few ...
6 years, 9 months ago (2014-03-12 15:57:35 UTC) #27
bajones
On 2014/03/12 12:01:43, SaurabhK wrote: > Folks, I am quite surprised to see the reviewers ...
6 years, 9 months ago (2014-03-12 16:34:50 UTC) #28
kbalazs
Updated. https://codereview.chromium.org/165483003/diff/120001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java (right): https://codereview.chromium.org/165483003/diff/120001/content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java#newcode61 content/public/android/java/src/org/chromium/content/browser/input/GamepadAdapter.java:61: if (mInputManager != null) { On 2014/03/12 00:58:46, ...
6 years, 9 months ago (2014-03-12 23:33:49 UTC) #29
SaurabhK
6 years, 9 months ago (2014-03-13 06:44:24 UTC) #30
>> I don't want to add to much to this. This feature is important for us and we
>> wanted to proceed asap. The other patch was not updated for about 2 weeks and
>> @bajones reviewed both so I thought it's ok if I update mine. I will continue
>> updating it.

This patch is also important for NVIDIA and we also want this patch to land asap
that’s why we have open-sourced this much earlier.
There has never been a delay of 2 weeks and I have constantly been updating the
Issue.
The crash was a showstopper for me to address reviewer comments and the bug that
I had
filed for the crash never got addressed which further delayed the upload of new
patch-set.

I also don’t want to add too much here except that kbalazs has agreed earlier
that we
will go ahead with my implementation. And considering the fact that I have
open-sourced
and I have interacted and with reviewers much earlier, I believe reviewers
should review
my patch.

Powered by Google App Engine
This is Rietveld 408576698