Skip to content

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

Launcher: the idle clock no longer starts over an app opened by a held key

tomasz.esz8f847a7ab5cd
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 179614434..8cde81d16 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -264,6 +264,11 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private boolean stopped;
/** Between onStart and onStop: Home is (at least partly) on screen. */
private boolean started;
+ /**
+ * Between onResume and onPause: Home is in front. The idle clock only runs then; a key's ACTION_UP can still
+ * reach Home after onPause, when that key opened another app, and must not start the clock over the app.
+ */
+ private boolean resumed;
/** Rebuild the tiles on the way back to Home only when apps changed meanwhile (TileRefresh). */
private final TileRefresh tileRefresh = new TileRefresh();
/** PackageManager's change counter at the last rebuild, to catch a package broadcast that never arrived. */
@@ -943,6 +948,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
@Override
protected void onResume() {
super.onResume();
+ resumed = true;
// A festival that started or ended while Home was in the background: rebuild with or without it.
if (festive != festival.active(LocalDate.now())) {
recreate();
@@ -1148,12 +1154,13 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private void restartIdleClock() {
root.removeCallbacks(showIdleClock);
- if (idleClockMs > 0) root.postDelayed(showIdleClock, idleClockMs);
+ if (resumed && idleClockMs > 0) root.postDelayed(showIdleClock, idleClockMs);
}
@Override
protected void onPause() {
super.onPause();
+ resumed = false;
root.removeCallbacks(showIdleClock);
endReorder(); // Home or another app while reordering keeps the order so far
wallpaperPlayer.stop();