If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Map gamepad buttons to UI features

RESOLVED FIXED in Firefox 22

Status

()

Firefox for Android
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: kats, Assigned: cwiiis)

Tracking

unspecified
Firefox 22
All
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

Comment hidden (empty)
(Assignee)

Comment 1

5 years ago
Created attachment 723571 [details] [diff] [review]
Toggle chrome on Gamepad-Y button

This is blocked by bug 846772
Attachment #723571 - Flags: review?(bugmail.mozilla)
Comment on attachment 723571 [details] [diff] [review]
Toggle chrome on Gamepad-Y button

Review of attachment 723571 [details] [diff] [review]:
-----------------------------------------------------------------

Some nits but looks ok otherwise.

::: mobile/android/base/BrowserApp.java
@@ +296,5 @@
> +            return false;
> +        }
> +
> +        Log.d(LOGTAG, "Key event from view " + v + ": " + event);
> +        if (keyCode == KeyEvent.KEYCODE_BUTTON_Y) {

I think we also want if ((event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) here. Also remove log line.

@@ +414,5 @@
>              }
>          }
>  
> +        // Intercept key events for gamepad shortcuts
> +        mBrowserToolbar.getLayout().setOnKeyListener(this);

You can use actionBar instead of mBrowserToolbar.getLayout() here. Also probably better to move this line up to near were actionBar is defined.
Attachment #723571 - Flags: review?(bugmail.mozilla) → review+
(Assignee)

Comment 3

5 years ago
Review comments addressed and dependency on bug 846772 removed. Pushed to inbound:

https://hg.mozilla.org/integration/mozilla-inbound/rev/cd118a1602b2

Adding leave-open to whiteboard.
Whiteboard: [leave-open]
(Assignee)

Comment 4

5 years ago
Created attachment 723992 [details] [diff] [review]
Map gamepad L1/R1 to back/forward

Does what it says on the tin. Also rearranged the key callback function as I expect we're going to add a few more buttons/behaviours in there.
Attachment #723992 - Flags: review?(bugmail.mozilla)
Comment on attachment 723992 [details] [diff] [review]
Map gamepad L1/R1 to back/forward

Review of attachment 723992 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/base/BrowserApp.java
@@ +349,5 @@
> +                case KeyEvent.KEYCODE_BUTTON_R1:
> +                    // Go forward on R1
> +                    Tabs.getInstance().getSelectedTab().doForward();
> +                    return true;
> +                default:

I'd rather take out the "default:" since it has no body anyway.
Attachment #723992 - Flags: review?(bugmail.mozilla) → review+
(Assignee)

Comment 6

5 years ago
Comment addressed and pushed to inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/71d1bd406c7e
https://hg.mozilla.org/mozilla-central/rev/cd118a1602b2
Something in this push (along with bug 849958) was causing robocop-1/2 to timeout. Backed out.
https://hg.mozilla.org/integration/mozilla-inbound/rev/14c0d137f08e

Possibly of help - one of the runs shows this:
https://tbpl.mozilla.org/php/getParsedLog.php?id=20578472&tree=Mozilla-Inbound

INFO | automation.py | Application pid: 0
0 INFO SimpleTest START
1 INFO TEST-START | testHistoryTab
2 INFO TEST-PASS | testHistoryTab | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_big_link.html should equal http://mochi.test:8888/tests/robocop/robocop_big_link.html
3 INFO TEST-PASS | testHistoryTab | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_blank_01.html should equal http://mochi.test:8888/tests/robocop/robocop_blank_01.html
INFO | automation.py | Application ran for: 0:00:57.216669
INFO | automation.py | Reading PID log: /var/folders/jr/dj51k_ns4vq2yg4mcygb26gw0000gn/T/tmpRCOathpidlog
PROCESS-CRASH | java-exception | java.lang.NoSuchMethodError: android.view.KeyEvent.getSource	at org.mozilla.gecko.BrowserApp.onKey(BrowserApp.java:329)
WARNING | automationutils.processLeakLog() | refcount logging is off, so leaks can't be detected!

INFO | runtests.py | Running tests: end.

Note that the timeouts were always after testAllPagesTab.
(Assignee)

Comment 9

5 years ago
(In reply to Ryan VanderMeulen [:RyanVM] from comment #8)
> Something in this push (along with bug 849958) was causing robocop-1/2 to
> timeout. Backed out.
> https://hg.mozilla.org/integration/mozilla-inbound/rev/14c0d137f08e
> 
> Possibly of help - one of the runs shows this:
> https://tbpl.mozilla.org/php/getParsedLog.php?id=20578472&tree=Mozilla-
> Inbound
> 
> INFO | automation.py | Application pid: 0
> 0 INFO SimpleTest START
> 1 INFO TEST-START | testHistoryTab
> 2 INFO TEST-PASS | testHistoryTab | Awesomebar URL typed properly -
> http://mochi.test:8888/tests/robocop/robocop_big_link.html should equal
> http://mochi.test:8888/tests/robocop/robocop_big_link.html
> 3 INFO TEST-PASS | testHistoryTab | Awesomebar URL typed properly -
> http://mochi.test:8888/tests/robocop/robocop_blank_01.html should equal
> http://mochi.test:8888/tests/robocop/robocop_blank_01.html
> INFO | automation.py | Application ran for: 0:00:57.216669
> INFO | automation.py | Reading PID log:
> /var/folders/jr/dj51k_ns4vq2yg4mcygb26gw0000gn/T/tmpRCOathpidlog
> PROCESS-CRASH | java-exception | java.lang.NoSuchMethodError:
> android.view.KeyEvent.getSource	at
> org.mozilla.gecko.BrowserApp.onKey(BrowserApp.java:329)
> WARNING | automationutils.processLeakLog() | refcount logging is off, so
> leaks can't be detected!
> 
> INFO | runtests.py | Running tests: end.
> 
> Note that the timeouts were always after testAllPagesTab.

Whoops, so gamepad support was only added in API level 9 and we support 8 - I've added the relevant check, will re-push when the tree opens.
(Assignee)

Comment 10

5 years ago
Added API check, pushed again:

https://hg.mozilla.org/integration/mozilla-inbound/rev/f79290f4b8d3
https://hg.mozilla.org/mozilla-central/rev/f79290f4b8d3
I'm going to mark this bug closed. We can map other buttons in other bugs.
Assignee: nobody → chrislord.net
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Whiteboard: [leave-open]
Target Milestone: --- → Firefox 22
You need to log in before you can comment on or make changes to this bug.