Skip to content

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

Merge PR #2295: Launcher: open_on_start_network_wait, so the boot's app waits for the network (#2033)

Gathin2388615a12c1aa
diff --cc launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index 8fea6a08b,545826236..a1ef12e11
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@@ -258,10 -251,26 +258,28 @@@ public class MainActivity extends Activ
private boolean bootToLiveTv;
/** open_on_start_choice: the app picked in Launcher settings may open on the first Home of each boot. */
private boolean openOnStartChoice;
+ /** open_on_start_network_wait, in ms; the boot's app while it waits for the network, and until when. */
+ private long openOnStartWaitMs;
+ private Intent startPending;
+ private long startDeadline;
+ private final Runnable openWhenOnline = new Runnable() {
+ @Override
+ public void run() {
+ if (startPending == null) return;
+ if (!OpenOnStart.opensNow(OpenOnStart.online(MainActivity.this), SystemClock.elapsedRealtime(),
+ startDeadline)) {
+ handler.postDelayed(this, 500);
+ return;
+ }
+ Intent i = startPending;
+ startPending = null;
+ open(i);
+ }
+ };
/** hidden_apps as the adapter sees them (config.xml or a theme's config.json): a hidden app gets no card either. */
private Set<String> hiddenApps = Collections.emptySet();
+ /** library_excluded_apps: packages the App library catalogue never offers. */
+ private Set<String> libraryExcludedApps = Collections.emptySet();
private List<Cards.Card> cards = Collections.emptyList();
/** The grid has been laid out and focused since the last resume; the card prompt waits for this. */
private boolean tilesReady;
@@@ -1195,9 -1181,9 +1214,11 @@@
ambient.animate().cancel();
heroArt.animate().cancel();
handler.removeCallbacks(minuteTick);
+ handler.removeCallbacks(openWhenOnline);
+ startPending = null; // leaving Home before the network came back: the boot's app stays closed
stopStats();
+ if (gameDay != null) gameDay.stop();
+ handler.removeCallbacks(turnTick);
if (diya != null) diya.stop();
cancelPendingFocusScroll();
// Nothing of ours stays on screen over another app; an undecided prompt simply returns next time.