[TV] Change Nexus Remote default key mapping.

RESOLVED FIXED in Firefox 49

Status

P2
normal
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: selee, Assigned: xeonchen)

Tracking

unspecified
2.6 S13 - 5/6
ARM
Gonk (Firefox OS)
Dependency tree / graph

Firefox Tracking Flags

(blocking-b2g:2.6+, firefox49 fixed)

Details

(Whiteboard: [ft:conndevices])

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
After verifying Nexus Remote with BT HID patch, we found the default key mapping probably should be changed to a similar TV remote controller.

Here is the current mapping:
  BrowserSearch, 116
      ArrowLeft, 37
        ArrowUp, 38
     ArrowRight, 39
      ArrowDown, 40
         Accept, 41  (Should be defined as Enter key[keycode=13])
    BrowserBack, 0   (Should be defined as Backspace key[keycode=8])
 MediaPlayPause, 0

Let's have a discussion that how we have a better remote control experience :)

Comment 1

3 years ago
@Gary, please help on this.
Flags: needinfo?(xeonchen)
(Assignee)

Comment 2

3 years ago
OK
Assignee: nobody → xeonchen
Flags: needinfo?(xeonchen)
(Reporter)

Comment 3

3 years ago
Hey Gary, Thanks for you to take this bug :)

Here is the updated version of the key mapping.
  BrowserSearch, 116 (Should be defined as Home key[keycode=38])
      ArrowLeft, 37
        ArrowUp, 38
     ArrowRight, 39
      ArrowDown, 40
         Accept, 41  (Should be defined as Enter key[keycode=13])
    BrowserBack, 0   (Should be defined as Backspace key[keycode=8])
 MediaPlayPause, 0   (Should be defined as Option key[keycode=623])
(Reporter)

Updated

3 years ago
blocking-b2g: --- → 2.6?
(Assignee)

Updated

3 years ago
Depends on: 1256618
(Assignee)

Updated

3 years ago
Depends on: 1252787, 1223732
(Reporter)

Updated

3 years ago
Depends on: 1257282
(Assignee)

Comment 4

3 years ago
Chromium maps AKEYCODE_BACK to VKEY_BROWSER_BACK ([1]),
Gecko maps it to NS_VK_ESCAPE for android([2]),
and Gaia setting page ([3]) only handles keycode=8 (backspace) to leave.

Masayuki-san, it seems that we have inconsistent behavior here, would you give some comments?

[1] https://code.google.com/p/chromium/codesearch#chromium/src/ui/events/keycodes/keyboard_code_conversion_android.cc&q=AKEYCODE_BACK&sq=package:chromium&type=cs&l=470
[2] https://dxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp#2142
[3] https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/js/modules/settings_panel.js#L87
Flags: needinfo?(masayuki)
(In reply to Gary Chen [:xeonchen] from comment #4)
> Chromium maps AKEYCODE_BACK to VKEY_BROWSER_BACK ([1]),
> Gecko maps it to NS_VK_ESCAPE for android([2]),
> and Gaia setting page ([3]) only handles keycode=8 (backspace) to leave.
> 
> Masayuki-san, it seems that we have inconsistent behavior here, would you
> give some comments?

I found this bug, bug 748473. This means that changing the keycode mapping for this may cause some regression, sigh... If the keyCode value is exposed to the web contents, I believe that we should use same keyCode value for compatibility with the other browsers. Otherwise, not changing the keyCode mapping *might* be better... (I.e., it might be better Gaia to check VK_ESCAPE too.)

The value of KeyboardEvent.key for Android's back is now defined as "GoBack", see <https://w3c.github.io/uievents-key/#keys-mobile>. So, ideally, we should support this value and Gaia handles it. However, I think that it's not bad Gaia to check VK_ESCAPE because pressing "Escape" key may be expected same result as "Backspace" key at navigation.

# Sorry for the delay to reply due to my business trip
Flags: needinfo?(masayuki)
Anyway, could you check if the key event is exposed to web contents, first? If it's exposed, we should change the keyCode value.
(Assignee)

Comment 7

3 years ago
(In reply to Masayuki Nakano [:masayuki] (Mozilla Japan) from comment #6)
> Anyway, could you check if the key event is exposed to web contents, first?
> If it's exposed, we should change the keyCode value.

Yes, the key is exposed to web content.

The problem is that some Gaia apps are designed for the remote controls that might have both BACK on EXIT buttons.
We're working on this to see if we can have a better solution.

Updated

3 years ago
blocking-b2g: 2.6? → 2.6+
See Also: → bug 1266659
(Assignee)

Comment 8

3 years ago
Created attachment 8744213 [details]
MozReview Request: Bug 1255264 - add keycode for back key; r=masayuki

Review commit: https://reviewboard.mozilla.org/r/48407/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/48407/
Attachment #8744213 - Flags: review?(masayuki)
Comment on attachment 8744213 [details]
MozReview Request: Bug 1255264 - add keycode for back key; r=masayuki

https://reviewboard.mozilla.org/r/48407/#review45445

::: widget/gonk/GonkKeyMapping.h:31
(Diff revision 1)
>  static const unsigned long kKeyMapping[] = {
>      0,
>      0, // SOFT_LEFT
>      0, // SOFT_RIGHT
>      NS_VK_HOME, // HOME
> -    0, // BACK
> +    NS_VK_ESCAPE, // BACK

I don't like to use different keyCode value from Chromium, though. For now we should use same mapping with Gecko for Android.
Attachment #8744213 - Flags: review?(masayuki) → review+

Comment 12

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/d665aa57b5fe
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox49: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 2.6 S13 - 5/6
You need to log in before you can comment on or make changes to this bug.