Bug 21083 - Proposal key names for Android
Proposal key names for Android
Status: NEW
Product: WebAppsWG
Classification: Unclassified
Component: UI Events
unspecified
Other other
: P2 normal
: ---
Assigned To: Gary Kacmarcik
public-webapps-bugzilla
:
Depends on: 21120 21121 21136 21137 21119 21134 21135 21139 21140
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-22 09:23 UTC by Masayuki Nakano
Modified: 2013-06-19 00:15 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masayuki Nakano 2013-02-22 09:23:52 UTC
I'm trying to implement KeyboardEvent.key value for non-printable keys on Android. Then, following native keys cannot be mapped to the key names in the list (http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#key-values-list):

* KEYCODE_SOFT_LEFT:  I have no idea.
* KEYCODE_SOFT_RIGHT: I have no idea.
* KEYCODE_HOME: Perhaps, 'Exit'? The key name is 'Home' but it exits active application and moves to home screen.
* KEYCODE_BACK: 'Back' as UI key? It's not only used for browser's 'back'.
* KEYCODE_CALL: 'PhoneCall' as Device key?
* KEYCODE_ENDCALL: 'PhoneEndCall' as Device key?
* KEYCODE_SYM: 'Symbol' as Modifier key? The Android document says this is a modifier, but D3E defines only 'SymbolLock'.
* KEYCODE_NUM: I'm not sure what's this key.
* KEYCODE_NOTIFICATION: I'm not sure what's this key too.
* KEYCODE_PICTSYMBOLS: 'PictureSymbolMode' as IME key?
* KEYCODE_MEDIA_CLOSE: 'Close' as Device key? It closes opened tray by 'Eject'. Then, 'Eject' should be separated as 'Eject' and 'EjectClose'?
* KEYCODE_ZOOM_IN: 'ZoomIn' as UI?
* KEYCODE_ZOOM_OUT: 'ZoomOut' as UI?
* KEYCODE_TV: Perhaps, 'Live'? But I think that 'TV' as Media key is better.
* KEYCODE_DVR: 'DVR' or 'VideoRecorder' as Media key?
* KEYCODE_TV_POWER: 'TVPower' as Media key?
* KEYCODE_TV_INPUT: 'TVSelectInput' as Media key?
* KEYCODE_STB_POWER: 'STBPower' as Media key?
* KEYCODE_STB_INPUT: 'STBSelectInput' as Media key?
* KEYCODE_AVR_POWER: 'AVReceiverPower' as Media key?
* KEYCODE_AVR_INPUT: 'AVReceiverSelectInput' as Media key?
* KEYCODE_LANGUAGE_SWITCH: 'ToggleLanguage' or 'SwitchLanguage' as IME key?
* KEYCODE_MANNER_MODE: 'ToggleMannerMode', 'SwitchMannerMode' or just 'MannerMode' as Device key?
* KEYCODE_3D_MODE: 'Toggle3DMode' as Media key?
* KEYCODE_CONTACTS: 'LaunchAddressBook' as General key?
* KEYCODE_CALENDAR: 'LaunchCalendar' as General key?
* KEYCODE_MUSIC: 'LaunchMusicPlayer' as General key?
* KEYCODE_CALCULATOR: 'LaunchCalculator' as General key?
* KEYCODE_ZENKAKU_HANKAKU: 'ToggleWidth' as IME key? Both 'FullWidth' and 'HalfWidth' are not useful for this.
* KEYCODE_KATAKANA_HIRAGANA: 'ToggleKatakanaHiragana' as IME key? 'Katakana' and 'Hiragana' key are not useful for this.

And for game pad:

KEYCODE_BUTTON_A:
KEYCODE_BUTTON_B:
KEYCODE_BUTTON_C:
KEYCODE_BUTTON_X:
KEYCODE_BUTTON_Y:
KEYCODE_BUTTON_Z:
KEYCODE_BUTTON_L1:
KEYCODE_BUTTON_R1:
KEYCODE_BUTTON_L2:
KEYCODE_BUTTON_R2:
KEYCODE_THUMBL:
KEYCODE_THUMBR:
KEYCODE_BUTTON_START:
KEYCODE_BUTTON_SELECT:
KEYCODE_BUTTON_MODE:   
KEYCODE_BUTTON_1:
KEYCODE_BUTTON_2:
KEYCODE_BUTTON_3:
KEYCODE_BUTTON_4:
KEYCODE_BUTTON_5:
KEYCODE_BUTTON_6:
KEYCODE_BUTTON_7:
KEYCODE_BUTTON_8:
KEYCODE_BUTTON_9:
KEYCODE_BUTTON_10:
KEYCODE_BUTTON_11:
KEYCODE_BUTTON_12:
KEYCODE_BUTTON_13:
KEYCODE_BUTTON_14:
KEYCODE_BUTTON_15:
KEYCODE_BUTTON_16: 

'GamePadButtonA'..., 'GamePadThumbLeft', 'GamePadThumbRight', 'GamePadButton1"?
Comment 1 Masayuki Nakano 2013-02-22 09:24:37 UTC
Oops, the document of Android is here:
http://developer.android.com/reference/android/view/KeyEvent.html
Comment 2 Masayuki Nakano 2013-02-23 02:21:53 UTC
(In reply to comment #0)
> KEYCODE_THUMBL:
> KEYCODE_THUMBR:

They are:

KEYCODE_BUTTON_THUMBL:
KEYCODE_BUTTON_THUMBR:

Then, the names are:

> 'GamePadButtonThumbLeft', 'GamePadButtonThumbRight'?
Comment 3 Gary Kacmarcik 2013-02-26 05:41:45 UTC
I'm not sure it makes sense to maps these values to 'key' or 'char'.

The documentation states:
"Key codes typically correspond one-to-one with individual keys on an input device. Many keys and key combinations serve quite different functions on different input devices so care must be taken when interpreting them. Always use the KeyCharacterMap associated with the input device when mapping keys to characters."

This sounds more like a 'code' value and some of the names (like KEYCODE_ZENKAKU_HANKAKU and KEYCODE_KATAKANA_HIRAGANA) are consistent with this interpretation.

To get a key/char, it looks like you'd need to pass the code value to the KeyCharacterMap (http://developer.android.com/reference/android/view/KeyCharacterMap.html) rather than using these codes directly.
Comment 4 Masayuki Nakano 2013-02-26 05:59:17 UTC
Gary:

I'm talking about non-printable keys. Looks like getDisplayLabel() returns null if the key is non-printable.
http://developer.android.com/reference/android/view/KeyCharacterMap.html#getDisplayLabel%28int%29
Comment 5 Masayuki Nakano 2013-02-27 02:36:57 UTC
I separated following key definition to bug 21121:

> * KEYCODE_CALL: 'PhoneCall' as Device key?
> * KEYCODE_* KEYCODE_MANNER_MODE: 'ToggleMannerMode', 'SwitchMannerMode' or just 'MannerMode' as Device key?
> * ENDCALL: 'PhoneEndCall' as Device key?
> * KEYCODE_CONTACTS: 'LaunchAddressBook' as General key?

I separated following key definition to bug 21120:

> * KEYCODE_TV: Perhaps, 'Live'? But I think that 'TV' as Media key is better.
> * KEYCODE_DVR: 'DVR' or 'VideoRecorder' as Media key?
> * KEYCODE_TV_POWER: 'TVPower' as Media key?
> * KEYCODE_TV_INPUT: 'TVSelectInput' as Media key?
> * KEYCODE_STB_POWER: 'STBPower' as Media key?
> * KEYCODE_STB_INPUT: 'STBSelectInput' as Media key?
> * KEYCODE_AVR_POWER: 'AVReceiverPower' as Media key?
> * KEYCODE_AVR_INPUT: 'AVReceiverSelectInput' as Media key?
> * KEYCODE_3D_MODE: 'Toggle3DMode' as Media key?

I separated following key definition to bug 21119:

> * KEYCODE_ZOOM_IN: 'ZoomIn' as UI?
> * KEYCODE_ZOOM_OUT: 'ZoomOut' as UI?
Comment 6 Masayuki Nakano 2013-02-27 03:57:50 UTC
I separated following key definition to bug 21136:

> * KEYCODE_HOME: Perhaps, 'Exit'? The key name is 'Home' but it exits active application and moves to home screen.
> * KEYCODE_BACK: 'Back' as UI key? It's not only used for browser's 'back'.

I separated following key definition to bug 21135:

> * KEYCODE_SYM: 'Symbol' as Modifier key? The Android document says this is a modifier, but D3E defines only 'SymbolLock'.

I separated following key definition to bug 21134:

> * KEYCODE_CONTACTS: 'LaunchAddressBook' as General key?
> * KEYCODE_MUSIC: 'LaunchMusicPlayer' as General key?
> * KEYCODE_CALCULATOR: 'LaunchCalculator' as General key?
Comment 7 Masayuki Nakano 2013-02-27 06:13:08 UTC
I separated the game pad related keys definition to bug 21137.
Comment 8 Masayuki Nakano 2013-02-27 06:47:59 UTC
I filed bug 21139 for
> * KEYCODE_ZENKAKU_HANKAKU: 'ToggleWidth' as IME key? Both 'FullWidth' and 'HalfWidth' are not useful for this.
> * KEYCODE_KATAKANA_HIRAGANA: 'ToggleKatakanaHiragana' as IME key? 'Katakana' and 'Hiragana' key are not useful for this.

And I filed bug 21083 for
> * KEYCODE_PICTSYMBOLS: 'PictureSymbolMode' as IME key?
> * KEYCODE_LANGUAGE_SWITCH: 'ToggleLanguage' or 'SwitchLanguage' as IME key?

Then, remaining issues here are:

* KEYCODE_SOFT_LEFT:  I have no idea.
* KEYCODE_SOFT_RIGHT: I have no idea.
* KEYCODE_NUM: I'm not sure what's this key.
* KEYCODE_NOTIFICATION: I'm not sure what's this key too.