Skip to content

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

Launcher: Home runs "hold:" app_keys entries for vendor keys

Rasmus Kjær Damgaarde525f084119e
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 a68495feb..e8bea208c 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -422,6 +422,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
};
private java.util.Map<Integer, String> homeAppKeys = java.util.Collections.emptyMap();
+ private java.util.Map<Integer, String> homeHoldAppKeys = java.util.Collections.emptyMap();
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -431,6 +432,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// 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);
+ homeHoldAppKeys = RemoteKeys.parseHoldAppKeys(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
@@ -1335,8 +1337,10 @@ 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;
+ // Vendor keys (TCL Netflix button, 4062) never reach the key services, only the focused window, so their
+ // "hold:" entries run here too or nowhere.
+ if (event.getKeyCode() >= 1000 && RemoteKeys.handle(this, event, homeAppKeys.get(event.getKeyCode()),
+ homeHoldAppKeys.get(event.getKeyCode()))) return true;
if (handleSettingsKey(event)) return true;
if (tileMenuEnabled && !reordering && openPopup == null && cardPrompt == null
&& event.getKeyCode() == KeyEvent.KEYCODE_MENU) {