Skip to content

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

launcher: boot_to_live_tv, open the Live TV app on the first Home after boot

alessandrodauriaa677e27a4594
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
index 8f41173e3..93cad5742 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -64,6 +64,8 @@ final class Config {
final boolean moduleCards;
/** Calmer motion for weak GPUs (config.xml, reduced_motion): stiff spring, short fades, no replay. */
final boolean reducedMotion;
+ /** Open the Live TV app on the first Home after the TV starts (config.xml, boot_to_live_tv). */
+ final boolean bootToLiveTv;
/** The focused dock app's name in large type above the dock (config.xml, dock_title). */
final boolean dockTitle;
/** The dock as its own row: band, no names, parked low (config.xml dock_row). false: one plain grid. */
@@ -109,7 +111,7 @@ final class Config {
String liveTvAction, Map<String, String> launchActions, Map<String, String> appLabels,
Map<String, String> appBanners, String sourcePanelService, String sourcePanelAction, String inputAction,
int columns, int rowsBelowDock, boolean animations, boolean advancedEffects,
- boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, boolean reorderButton, String vpnApp,
+ boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean bootToLiveTv, boolean dockTitle, boolean dockRow, boolean reorderButton, String vpnApp,
boolean showHomeSettingsShortcut, boolean showStats, boolean appLibrary, int backgroundColor, int skyIntensity,
int[] settingsKeycodes, boolean settingsKeyPanel, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,
int wallpaperRotationMinutes, int wallpaperDim, boolean overlayApplied,
@@ -136,6 +138,7 @@ final class Config {
this.greetingName = greetingName;
this.moduleCards = moduleCards;
this.reducedMotion = reducedMotion;
+ this.bootToLiveTv = bootToLiveTv;
this.dockTitle = dockTitle;
this.dockRow = dockRow;
this.reorderButton = reorderButton;
@@ -184,6 +187,7 @@ final class Config {
String greetingName = res.getString(R.string.greeting_name).trim();
boolean moduleCards = res.getBoolean(R.bool.module_cards);
boolean reducedMotion = res.getBoolean(R.bool.reduced_motion);
+ boolean bootToLiveTv = res.getBoolean(R.bool.boot_to_live_tv);
boolean dockTitle = res.getBoolean(R.bool.dock_title);
boolean dockRow = res.getBoolean(R.bool.dock_row);
boolean reorderButton = res.getBoolean(R.bool.reorder_button);
@@ -224,6 +228,7 @@ final class Config {
greetingName = string(json, "greeting_name", greetingName).trim();
moduleCards = bool(json, "module_cards", moduleCards);
reducedMotion = bool(json, "reduced_motion", reducedMotion);
+ bootToLiveTv = bool(json, "boot_to_live_tv", bootToLiveTv);
dockTitle = bool(json, "dock_title", dockTitle);
dockRow = bool(json, "dock_row", dockRow);
reorderButton = bool(json, "reorder_button", reorderButton);
@@ -288,7 +293,7 @@ final class Config {
packageMap(appBanners), panelService,
panelAction, inputAction,
Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,
- shamsi, greetingName, moduleCards, reducedMotion, dockTitle, dockRow, reorderButton, vpn, homeSettings, showStats, library, background,
+ shamsi, greetingName, moduleCards, reducedMotion, bootToLiveTv, dockTitle, dockRow, reorderButton, vpn, homeSettings, showStats, library, background,
Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,
wallpapers, rotationMinutes, wallpaperDim, applied,
festival, inputKeycodes, appKeys, json == null ? Collections.emptyList() : raceCalendar(json), cinematic);
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 c38133eec..73f84caf7 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -9,6 +9,7 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.graphics.Bitmap;
@@ -177,6 +178,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private int greetingColor;
/** The day the petal shower last played, so it greets the first Home of each day only. */
private static LocalDate lastPetalShower;
+ /** boot_to_live_tv: open the Live TV app on the first Home of each boot. */
+ private boolean bootToLiveTv;
/** 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();
private List<Cards.Card> cards = Collections.emptyList();
@@ -285,6 +288,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
festival = cfg.festival;
festive = festival.active(LocalDate.now());
liveTvPkg = cfg.liveTvPackage;
+ bootToLiveTv = cfg.bootToLiveTv;
liveTvAction = cfg.liveTvAction;
inputAction = cfg.inputAction;
sourcePanelService = cfg.sourcePanelService;
@@ -589,6 +593,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
reloadApps(true);
}
rebuildOnResume = false;
+ if (openLiveTvAfterBoot()) return;
updateGreeting();
updateRace();
updateWifiLabel();
@@ -1999,6 +2004,20 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
btnInputs.setVisibility(any ? View.VISIBLE : View.GONE);
}
+ /** boot_to_live_tv: the first time Home comes up after the TV starts, open the Live TV app instead. Once per
+ * boot, keyed on Settings.Global.BOOT_COUNT, so a later Home press stays on Home. */
+ private boolean openLiveTvAfterBoot() {
+ if (!bootToLiveTv) return false;
+ int boot = Settings.Global.getInt(getContentResolver(), Settings.Global.BOOT_COUNT, -1);
+ SharedPreferences prefs = getSharedPreferences("boot", MODE_PRIVATE);
+ if (boot < 0 || prefs.getInt("live_tv_boot", -1) == boot) return false;
+ prefs.edit().putInt("live_tv_boot", boot).apply();
+ Intent i = liveTvIntent();
+ if (i == null) return false;
+ open(i);
+ return true;
+ }
+
/** The Live TV app's launch intent: its leanback entry point, or the configured action if it has none. */
private Intent liveTvIntent() {
if (liveTvPkg.isEmpty()) return null;
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 3deebbea4..a023192ba 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -28,6 +28,11 @@
<!-- The TV's Live TV / tuner app, offered at the end of the Inputs menu. Leave empty to omit. -->
<string name="live_tv_package" translatable="false">com.mediatek.wwtv.tvcenter</string>
+ <!-- Open the Live TV app above the first time Home comes up after the TV is switched on, for sets that are
+ mostly used for broadcast TV. Once per boot: Home after that stays Home. Can also be set with
+ "boot_to_live_tv": true in a theme's config.json. -->
+ <bool name="boot_to_live_tv">false</bool>
+
<!-- Some TVs give their Live TV app no leanback entry point at all, so `live_tv_package` above
resolves to nothing (TCL Android TV 9 on China-market sets is one). This action is then sent
to that package instead, and the app starts normally. Leave empty to omit. -->
diff --git a/themes/README.md b/themes/README.md
index d08c19670..332edb30e 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -45,6 +45,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `greeting_name` | string | A name after the greeting, e.g. `"Mr. Trịnh"` for GOOD MORNING, MR. TRỊNH; empty for the greeting alone |
| `module_cards` | bool | Look for module cards and ask about them (`true`); `false` turns the feature off |
| `reduced_motion` | bool | Calmer motion for weak GPUs: stiff highlight spring, no tile overshoot, short fades, no entrance replay |
+| `boot_to_live_tv` | bool | Open the Live TV app (`live_tv_package`) on the first Home after the TV starts, once per boot |
| `vpn_app` | string | App the network pill opens when a VPN is configured; also shows a red "VPN off" badge while no VPN is up |
| `animations` | bool | Basic focus, glass, title and tile entrance motion; true by default |
| `advanced_effects` | bool | Optional lifted tile, icon zoom, smooth ambient colour and app opening effects; false by default |