diff options
author | Siarhei Vishniakou <svv@google.com> | 2018-05-09 09:54:43 -0700 |
---|---|---|
committer | Siarhei Vishniakou <svv@google.com> | 2018-05-22 07:23:34 -0700 |
commit | de1f904713e00045ad545ecb0ad51d83f9ca0e42 (patch) | |
tree | e7c1f59d895e3ad3599a7456fb52675c155f1fc8 /tools/aapt2/java/JavaClassGenerator.cpp | |
parent | dfe3c2206966fcfc18c5b4b3601fd2915869a0f0 (diff) |
Allow keycode lookup without KEYCODE_ prefix
Currently, KeyEvent.keyCodeFromString(String name) requires the string
to either start with "KEYCODE_", or be directly convertible to an int.
However, the string representation of every keycode starts with
"KEYCODE_", so this requirement is redundant. Relax this requirement to
alllow both of the following usages:
1) keyCodeFromString("KEYCODE_BUTTON_A")
2) keyCodeFromString("BUTTON_A")
Currently, only 1) is supported.
The other usage,
3) keyCodeFromString("29")
is unchanged.
The input is no longer case-sensitive.
Improved the example of usage in the documentation: the input
"1001" suggests that the string must contain binary representation for
usage 3), while in fact it is supposed to be a base 10 number.
Test: atest cts.KeyEventTest#testKeyCodeFromString
Bug: 36069459
Change-Id: I54d7f9d1270748854143cc9d1e8af48c9ec0cd0f
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
0 files changed, 0 insertions, 0 deletions