Introduction
The Oak IR Remote Control (RCU) is the default RCU for the Amino H-series devices. The Oak RCU has several keys that may be customized to support the application’s uses with the H-Series device. This article will share which keys may be remapped and the processes to complete the action.
Prerequisites
Receiving the Global Key section is required to have the 25.6.2420 firmware or later.
Summary
Key remapping for the Oak RCU will be split into several sections:
- Global Key Configuration
- Unique Key Configuration
Global Key Configuration
By default, most of the Oak RCU keys are global meaning they are raised to the Android system and handled by any APP that might recognize the action. However, they may be customized to act directly on your APP as described in this article.
Key handling integration
As Global keys will most likely not cover all the needed actions, Amino provides two different ways of customizing their behavior:
- Defining Function Keys in the Amino Device Management System (INI parameters);
- Receiving the global key and handling them directly in the APP.
Global key - Define the function
Using a default configuration, the H-series device will raise the keys as global meaning it will be processed either through Android or by any foreground APP that can process it.
Here is a list of all Global keys:
Remote Key | Android Key Code | Global key configuration |
AV | KEYCODE_DVR | globalkey.dvr |
Guide | KEYCODE_GUIDE | globalkey.guide |
Menu | KEYCODE_MENU | globalkey.option |
Red | KEYCODE_PROG_RED | globalkey.red |
Green | KEYCODE_PROG_GREEN | globalkey.green |
Blue | KEYCODE_PROG_BLUE | globalkey.blue |
Yellow | KEYCODE_PROG_YELLOW | globalkey.yellow |
Receiving the Global Key
To ensure that your app can receive global keys, it must meet the following requirements:
- Receiver Implementation: Your app needs a receiver that implements an intent filter for the action com.aminocom.intent.action.GLOBAL_BUTTON
Example of Global Key Receiver Intent Filter
Below is an example of how to define the global key receiver intent filter in your app's AndroidManifest.xml:
<receiver android:name="com.android.tv.livetv.receiver.GlobalKeyReceiver" android:exported="true">
<intent-filter>
<action android:name="com.aminocom.intent.action.GLOBAL_BUTTON" />
</intent-filter>
</receiver>
Customized key handling
Amino then provides the capability of customizing the behavior for many of the Oak RCU keys noting there are three different ways these keys can work:
- Trigger Deeplink;
- Trigger an APP, based on package ID;
- Trigger a specific Activity within an APP;
To switch from the default Global key to one of the three options above, the following INI parameters need to be added:
Remote key | INI parameter |
AV | key.link.dvr |
Guide | key.link.guide |
Menu | key.link.option |
RED | key.link.red |
GREEN | key.link.green |
YELLOW | key.link.yellow |
BLUE | key.link.blue |
These should then point to one of the three preferred actions, as shown:
Use case | INI format | Example |
Trigger Deeplink | URI |
https://www.youtube.com/watch?v=<youtubeId> or app_custom_scheme://foo/?navigate=bar |
Trigger APP, based on package ID | pkg://<app_package_id> | pkg://com.netflix.ninja |
Trigger specific Activity within an APP | pkg://<app_package_id>?cls=<activity_class_name> | pkg://com.aminocom.tv?cls=com.android.tv.MainActivity |
More documentation on Deep-links can be found on the Android documentation: https://developer.android.com/training/app-links
Unique Key Configuration
This section describes a configuration that allows the keys that are normally forwarded to H-Series OS directly, to be remapped to other Android/browser key events, making it possible for these keys to be used for other purposes. Examples of such keys are shown below with instructions.
OAK remote key | Original Android key event (value) | Target Android key event (value) |
STB Power key | KEYCODE_POWER (26) | KEYCODE_TV_POWER (177) |
Vol+ | KEYCODE_VOLUME_UP (24) | KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP (253) |
Vol - | KEYCODE_VOLUME_DOWN (25) | KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN (254) |
MUTE | KEYCODE_VOLUME_MUTE (164) | KEYCODE_TV_AUDIO_DESCRIPTION (252) |
To remap all the keys in the table above, the following INI option needs to be added:
keycode.remap.generic="26=177 24=253 25=254 164=252"
Reboot the H-Series device with the new configuration.
Note: the target key will be triggered if the respective OAK RCU key is pressed. For example, use adb to connect to the H-series device and monitor the logcat output.
When the Power key is pressed:
09-29 07:30:41.751 3937 4021 V WindowManager: start: cks.size() = 2 ck.key = 177 ck.time = 1664436641751
09-29 07:30:42.154 3937 4021 I InputReader: Amino: remap keycode: 177
When the Vol + key is pressed:
09-29 07:30:00.945 3937 4021 V WindowManager: start: cks.size() = 4 ck.key = 253 ck.time = 1664436600945
09-29 07:30:01.134 3937 4021 I InputReader: Amino: remap keycode: 253
When the Vol – key is pressed:
09-29 07:36:19.253 3937 4021 V WindowManager: start: cks.size() = 3 ck.key = 254 ck.time = 1664436979253
09-29 07:36:19.550 3937 4021 I InputReader: Amino: remap keycode: 254
When the Mute key is pressed:
10-26 17:58:34.870 3822 3907 V WindowManager: start: cks.size() = 5 ck.key = 252 ck.time = 1666778314870
10-26 17:58:35.163 3822 3907 I InputReader: Amino: remap keycode: 252
References
Additional documentation on Deep-links can be found here:
https://developer.android.com/training/app-links