Skip to content

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

Launcher: Home releases its vendor-key holds when it pauses

Rasmus Kjær Damgaard8b1caf89ef9e
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 e8bea208c..fe0067441 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -1227,6 +1227,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
protected void onPause() {
super.onPause();
resumed = false;
+ // No UP reaches a paused Home, so a vendor-key hold it saw go down would still open its app later.
+ // Only Home's own share is dropped: a key service that saw the same DOWN keeps its hold.
+ RemoteKeys.release(this);
root.removeCallbacks(showIdleClock);
endReorder(); // Home or another app while reordering keeps the order so far
wallpaperPlayer.stop();
@@ -1293,6 +1296,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
@Override
protected void onDestroy() {
super.onDestroy();
+ RemoteKeys.release(this);
if (gameDay != null) gameDay.shutdown();
unregisterReceiver(packageReceiver);
wallpaperPlayer.close();
@@ -1338,8 +1342,9 @@ 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, so their
- // "hold:" entries run here too or nowhere.
- if (event.getKeyCode() >= 1000 && RemoteKeys.handle(this, event, homeAppKeys.get(event.getKeyCode()),
+ // "hold:" entries run here too or nowhere. Only while resumed: onPause releases Home's holds, and a DOWN
+ // taken after that would arm one nothing releases.
+ if (resumed && 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