Skip to content

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

Launcher: inputs_cec_state_only, for TVs that report HDMI port states on the wrong port

Axel Rosadofefba107414e
diff --git a/docs/switches.md b/docs/switches.md
index 9ddd4ced3..d497df982 100644
--- a/docs/switches.md
+++ b/docs/switches.md
@@ -63,6 +63,7 @@ rule sit on its wanted list until a screenshot arrives.
| `icon_only_vpn` | <img src="switches/icon_only_vpn.jpg" width="320" alt="icon_only_vpn with no VPN up: an open lock on the plain round button, between Wi-Fi and Settings"> <img src="switches/icon_only_vpn_on.jpg" width="320" alt="icon_only_vpn with a VPN up: the closed lock in a green outline, focus on a tile"> |
| `power_on_home_always` | <img src="switches/power_on_home_always.jpg" width="320" alt="power_on_home_always on a TV"> |
| `inputs_connected_only` | <img src="switches/inputs_connected_only.jpg" width="320" alt="inputs_connected_only on a TV"> |
+| `inputs_cec_state_only` | <img src="switches/inputs_cec_state_only.jpg" width="320" alt="inputs_cec_state_only: Steam Deck · HDMI 1 Connected, the bare HDMI 2 with no state, on a TV"> |
| `icon_tiles` | <img src="switches/icon_tiles.jpg" width="320" alt="icon_tiles: an app drawn from its icon in the grid on a TV"> |
| `game_day` | <img src="switches/game_day.jpg" width="320" alt="game_day: Minnesota Vikings at Detroit Lions, Kickoff in 5d 13h, with four dots, under the clock on a TV"> |
| `clock_format` | <img src="switches/clock_format.jpg" width="320" alt="clock_format on a TV"> |
diff --git a/docs/switches/inputs_cec_state_only.jpg b/docs/switches/inputs_cec_state_only.jpg
new file mode 100644
index 000000000..223242df7
Binary files /dev/null and b/docs/switches/inputs_cec_state_only.jpg differ
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 a5541ffa2..feb5a8166 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -189,6 +189,8 @@ final class Config {
final boolean powerOnHomeAlways;
/** The Inputs menu lists only inputs reporting connected; the rest fold behind a More inputs row (config.xml / theme inputs_connected_only). */
final boolean inputsConnectedOnly;
+ /** Only CEC device rows in the Inputs menu show a connection state, never a bare HDMI port (config.xml / theme inputs_cec_state_only). */
+ final boolean inputsCecStateOnly;
/** "12", "24" or "system" (theme clock_format, or Launcher settings' Clock row); see ClockFormat. */
final String clockFormat;
/** The Settings button opens the quick settings panel instead of the TV's Settings (settings_key_panel). */
@@ -289,7 +291,7 @@ final class Config {
List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, boolean appGlow, boolean fadeRows, int homeIdleClockMinutes,
boolean keyFilter, boolean dockGlass, String glowStyle, boolean wallpaperCaptions,
boolean handleViewInputs, boolean tileMenu, boolean dockEvenPadding, boolean dockBand, boolean cinematicDots, boolean cinematicWhiteFocus, boolean wifiStatusColor, int cinematicScrim, int cinematicArt,
- Map<String, Set<String>> wallpaperMoods, boolean gamepadPassthrough, boolean consumeVolumeKeys, boolean powerOnHome, boolean homeLongPressHome, boolean wifiStatusWarnings, List<String> topBarApps, boolean showGreeting, boolean headerWhite, boolean clockWallpaper, int clockWallpaperDim, boolean clockGlow, String glassStyle, boolean singleRow, boolean dockBandAll, boolean lunarDate, int lunarUtcOffset, boolean dateBelowClock, boolean vpnPill, String locale, boolean powerOnHomeAlways, boolean inputsConnectedOnly,
+ Map<String, Set<String>> wallpaperMoods, boolean gamepadPassthrough, boolean consumeVolumeKeys, boolean powerOnHome, boolean homeLongPressHome, boolean wifiStatusWarnings, List<String> topBarApps, boolean showGreeting, boolean headerWhite, boolean clockWallpaper, int clockWallpaperDim, boolean clockGlow, String glassStyle, boolean singleRow, boolean dockBandAll, boolean lunarDate, int lunarUtcOffset, boolean dateBelowClock, boolean vpnPill, String locale, boolean powerOnHomeAlways, boolean inputsConnectedOnly, boolean inputsCecStateOnly,
int openOnStartNetworkWait, boolean openOnStartOnWake, boolean iconOnlyVpn, String clockFormat, boolean backOpensClock, boolean glowSnap) {
this.handleViewInputs = handleViewInputs;
this.tileMenu = tileMenu;
@@ -391,6 +393,7 @@ final class Config {
this.homeLongPressHome = homeLongPressHome;
this.powerOnHomeAlways = powerOnHomeAlways;
this.inputsConnectedOnly = inputsConnectedOnly;
+ this.inputsCecStateOnly = inputsCecStateOnly;
this.openOnStartNetworkWait = openOnStartNetworkWait;
this.openOnStartOnWake = openOnStartOnWake;
this.clockFormat = clockFormat;
@@ -509,6 +512,7 @@ final class Config {
boolean homeLongPressHome = res.getBoolean(R.bool.home_long_press_home);
boolean powerOnHomeAlways = res.getBoolean(R.bool.power_on_home_always);
boolean inputsConnectedOnly = res.getBoolean(R.bool.inputs_connected_only);
+ boolean inputsCecStateOnly = res.getBoolean(R.bool.inputs_cec_state_only);
String clockFormat = res.getString(R.string.clock_format);
boolean dockGlass = res.getBoolean(R.bool.dock_glass);
boolean dockEvenPadding = res.getBoolean(R.bool.dock_even_padding);
@@ -622,6 +626,7 @@ final class Config {
homeLongPressHome = bool(json, "home_long_press_home", homeLongPressHome);
powerOnHomeAlways = bool(json, "power_on_home_always", powerOnHomeAlways);
inputsConnectedOnly = bool(json, "inputs_connected_only", inputsConnectedOnly);
+ inputsCecStateOnly = bool(json, "inputs_cec_state_only", inputsCecStateOnly);
clockFormat = string(json, CLOCK_FORMAT_KEY, clockFormat);
dockGlass = bool(json, "dock_glass", dockGlass);
dockEvenPadding = bool(json, "dock_even_padding", dockEvenPadding);
@@ -709,7 +714,7 @@ final class Config {
dockBand, cinematicDots, cinematicWhiteFocus, wifiStatusColor, cinematicScrim, cinematicArt, wallpaperMoods, gamepadPassthrough,
consumeVolumeKeys, powerOnHome, homeLongPressHome, wifiStatusWarnings, topBarApps, showGreeting, headerWhite, clockWallpaper,
Math.max(0, Math.min(90, clockWallpaperDim)), clockGlow, glassStyle, singleRow && dockRow, dockBandAll, lunar, lunarOffset,
- dateBelowClock, vpnPill, locale, powerOnHomeAlways, inputsConnectedOnly,
+ dateBelowClock, vpnPill, locale, powerOnHomeAlways, inputsConnectedOnly, inputsCecStateOnly,
Math.max(0, Math.min(600, openOnStartNetworkWait)), openOnStartOnWake, iconOnlyVpn, clockFormat, backOpensClock, glowSnap);
}
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 eda36c898..aa940984c 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -210,6 +210,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private boolean showStats;
/** config.xml inputs_connected_only: the Inputs menu lists only connected inputs, the rest behind "More inputs". */
private boolean inputsConnectedOnly;
+ /** config.xml inputs_cec_state_only: only CEC device rows show a connection state, bare HDMI ports none. */
+ private boolean inputsCecStateOnly;
private boolean shamsi;
/** greeting_name: said after the greeting, which is shown in capitals. */
private String greetingName = "";
@@ -576,6 +578,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
rotationStart = SystemClock.elapsedRealtime();
showStats = cfg.showStats;
inputsConnectedOnly = cfg.inputsConnectedOnly;
+ inputsCecStateOnly = cfg.inputsCecStateOnly;
shamsi = cfg.shamsiDate;
lunarDate = findViewById(R.id.lunarDate);
lunar = cfg.lunarDate;
@@ -3441,7 +3444,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
hdmiPorts++;
if (tim.getInputState(info.getId()) == TvInputManager.INPUT_STATE_CONNECTED) hdmiConnected++;
}
- boolean hdmiStateBogus = hdmiPorts > 1 && hdmiConnected == hdmiPorts;
+ // inputs_cec_state_only: the TV puts port states on the wrong port (TCL UnionTV, Android 9), so
+ // ports show none, and a CEC device row shows its own state, which the CEC bus keeps right.
+ boolean hdmiStateBogus = inputsCecStateOnly || (hdmiPorts > 1 && hdmiConnected == hdmiPorts);
for (TvInputInfo info : inputs) {
if (info.getType() == TvInputInfo.TYPE_TUNER
&& (info.getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
@@ -3491,7 +3496,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
if (name == null || name.length() == 0) name = named ? custom : device.loadLabel(this);
String deviceLabel = name == null || name.length() == 0 ? label : name + " \u00B7 " + label;
final String deviceId = device.getId();
- int state = hdmiStateBogus ? -1 : tim.getInputState(deviceId);
+ int state = hdmiStateBogus && !inputsCecStateOnly ? -1 : tim.getInputState(deviceId);
View row = addInputRow(rows, popup, R.drawable.ic_input, deviceLabel, state, () -> openInput(deviceId));
if (connectedOnly && InputFold.folds(true, state)) fold(row, folded);
}
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index cb0781de6..2255d16f0 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -359,6 +359,11 @@
whose state the TV cannot be trusted with stays. Off by default: every input is listed. Can also be set
with "inputs_connected_only" in a theme. -->
<bool name="inputs_connected_only">false</bool>
+ <!-- Only CEC device rows in the Inputs list show a connection state ("Steam Deck · HDMI 1 Connected"); bare HDMI
+ ports show none. For TVs whose port states land on the wrong port: TCL UnionTV (Android 9) reports the empty
+ HDMI 1 as connected and a device on HDMI 2 nowhere, while its CEC device list stays right. A device without
+ CEC then shows no state at all. Off by default. Can also be set with "inputs_cec_state_only" in a theme. -->
+ <bool name="inputs_cec_state_only">false</bool>
<!-- Names under every tile, not only the focused one: unfocused names stay dimmed, the focused one is full white.
With dock_row the band grows down to hold the dock's names too. -->
<bool name="always_show_names">false</bool>
diff --git a/themes/README.md b/themes/README.md
index 7254511f6..693e9eac6 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -167,6 +167,7 @@ A new key needs one there in the same pull request.
| `home_long_press_home` | bool | Every Home press opens Home, a held one too. Android turns a Home press held past 400 ms into ALL_APPS for the system-image launcher, which nothing answers once the stock launcher is disabled, so a firm press on a slow remote did nothing (Philips TPM191E, Android 12, where `long_press_timeout` does not move that limit). Needs `key_filter` (`HOME_KEY_SERVICE=1`), so held keys such as Volume Up/Down stop repeating, confirmed on that Philips; single presses still step. Off by default |
| `power_on_home_always` | bool | Home at every power-on, whatever the TV put in front: the last HDMI input, Live TV or an app, for TVs that come back to the last source (Philips). Unlike `power_on_home`, it does not wait for a window to show: the Home screen comes up about a second after the screen turns on (`HOME_KEY_SERVICE=1`). A key pressed before that wins. Ignored with `boot_to_live_tv`, or with an Open on start app. Off by default |
| `inputs_connected_only` | bool | The Inputs list shows only HDMI ports and CEC devices that report connected; empty ports, the AV jacks and devices asleep in standby fold behind a "More inputs" row that expands them. Some TVs (TCL) report an empty HDMI port as connected-standby, the same state a sleeping device has, so a device in standby is folded too. An HDMI row whose state the TV cannot be trusted with stays (`false` by default) |
+| `inputs_cec_state_only` | bool | Only CEC device rows in the Inputs list show a connection state ("Steam Deck · HDMI 1", Connected); bare HDMI ports show none. For TVs that put port states on the wrong port: TCL UnionTV (Android 9) reports its empty HDMI 1 as connected and a device on HDMI 2 nowhere, while its CEC device list stays right. A device without CEC shows no state (`false` by default) |
| `clock_format` | `12`, `24` or `system` | The launcher's clocks (Home and the clock screensaver) in 12- or 24-hour time whatever the TV is set to; `system` (the default) follows the TV. Launcher settings' Clock row sets it too |
| `race_calendar` | list of races | F1 race-weekend mode: from 12 hours before a weekend's first session until 4 hours after the race starts, a panel under the clock shows the next session with a countdown (or the live one) and the weekend's session times in the TV's time zone. Write it with `tools/venv/bin/python -I tools/race_calendar.py <theme folder>`, which fetches the season from the free Jolpica API; the launcher itself never goes online |
| `home_idle_clock_minutes` | 0 to 1440 | Minutes Home may sit untouched before it shows the clock screensaver (a thin clock and date drifting over a slow glow, as the system "Clock" screensaver does). Any key returns to Home. It starts only from Home, never over Live TV or an app; 0 is off (default) |