Fallback BUTTON_MODE to HOME

Currently, BUTTON_MODE falls back to MENU.
It is not clear which functionality relies on that. However, many
joysticks currently map their "branded" button, for example, the "XBOX"
key on the Xbox joystick, and "PS" key on the playstation joystick, to
the BUTTON_MODE. On other joysticks, the same button is mapped to
"HOME". So it would make sense to have this button to fall back to HOME
in order to make the behaviour consistent.

Also, remap the "XBOX" button on the Xbox controller to "BUTTON_MODE".
This would give apps the chance to intercept this key and actually use
it, instead of limiting it to the system.

Bug: 37115804
Bug: 77803694
Test: Made a test app to dump out joystick events in response to
dispatchKeyEvent. Then either returned true or false to ensure that the
fallback happens. If returning true, the app has handled the event, and
HOME is not dispatched. If returning false, the app does not care about
the event. Therefore, HOME is generated and the phone goes to home
screen (so the app gets closed).

Change-Id: I023620551f52d34638303db60f8a4ca37f06d4d8
Merged-In: I023620551f52d34638303db60f8a4ca37f06d4d8
This commit is contained in:
Siarhei Vishniakou
2018-08-21 18:30:16 -07:00
parent bfb5b8b03e
commit 0b607447b6
2 changed files with 2 additions and 2 deletions

View File

@@ -540,7 +540,7 @@ key BUTTON_SELECT {
}
key BUTTON_MODE {
base: fallback MENU
base: fallback HOME
}
key BUTTON_1 {

View File

@@ -56,4 +56,4 @@ key 0x136 BUTTON_SELECT
key 0x137 BUTTON_START
# Xbox key
key 0x8b HOME
key 0x8b BUTTON_MODE