Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

launcher: Home answers app_keys for vendor keycodes (1000+)

Jamie Turner00e6d9e91083
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index 13f181e81..43dece0d5 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -381,6 +381,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
}
};
+ private java.util.Map<Integer, String> homeAppKeys = java.util.Collections.emptyMap();
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -388,6 +390,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
density = getResources().getDisplayMetrics().density;
// config.xml, overlaid by config.json from a pushed theme (see Config and tools/theme.sh).
Config cfg = Config.load(this);
+ homeAppKeys = RemoteKeys.parseAppKeys(cfg.appKeys);
appLibrarySelection = cfg.appLibrarySelection;
libraryOkOpens = cfg.libraryOkOpens;
// restore_key_services: after a force stop, put back the remote's accessibility helpers that Android took
@@ -1253,6 +1256,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
+ // Vendor keys (TCL Netflix button, 4062) never reach the key services, only the focused window.
+ if (event.getKeyCode() >= 1000 && RemoteKeys.handle(this, event, homeAppKeys.get(event.getKeyCode()), null)) return true;
if (handleSettingsKey(event)) return true;
if (tileMenuEnabled && !reordering && openPopup == null && cardPrompt == null
&& event.getKeyCode() == KeyEvent.KEYCODE_MENU) {