Introduction
This document describes a method that remaps an Android KeyEvent received to another Android KeyEvent. (available from H200 firmware version 25.3.2022.9R)
A typical use case is to replace a default KeyEvent assigned to remote control key with a different keyEvent, when the default keyEvent is not desirable or redundant to the end user.
Simple example use case and instructions
We will assume a case when the keyEvent KEYCODE_HOME is redundant and we would like to replace it with keyEvent KEYCODE_BACK. We will achieve this with the following steps,
1. Identify the keyEvent constant values from the developer.android.com, for the keyEvent to be remapped and the keyEvent to remap to.
KEYCODE_HOME (constant value 140)
KEYCODE_BACK (constant value 4)
2. Add the following option to the Engage group setting or the H200 boot INI file if you are booting up the H200 with VCI configuration.
keycode.remap.generic=140=4
3. Reboot the STB. Pressing the remote key that was originally triggering the KEYCODE_HOME event would now trigger KEYCODE_BACK instead.
Advance example use case and instructions
The Amino OAK remote does not have any physical function keys and we would like to make the HOME key ("X" key on the OAK remote) to open the Android settings menu instead. To do this, we will remap KEYCODE_HOME to KEYCODE_STEM1 (i.e. "Fucntion Key 1" keyEvent) and then assign the Android Settings menu deeplink to "Function key 1".
To do this we will add the following INI options,
keycode.remap.generic=140=265
key.link.fn1="pkg://com.android.tv.settings?cls=com.android.tv.settings.MainSettings"
Rebooting the STB and if we press the "X" button on OAK remote, it will open the Android Settings menu instead of getting us back to Android HOME.
Note that it is an advance use case because it is not possible to directly map a deeplink to the HOME key but it is possible to map a deeplink to "Function Key 1". Therefore by remapping the HOME keyEvent to Function Key 1 keyEvent, the objective is achievable.
Comments
0 comments
Article is closed for comments.