Skip to content

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

Allow selecting an exact Live TV tuner through configuration

MIDHAT NASHAR56b416164337
diff --git a/docs/devices/haam-r4-inputs.png b/docs/devices/haam-r4-inputs.png
new file mode 100644
index 000000000..5b83f1d02
Binary files /dev/null and b/docs/devices/haam-r4-inputs.png differ
diff --git a/docs/devices/haam-r4.md b/docs/devices/haam-r4.md
new file mode 100644
index 000000000..b44eea638
--- /dev/null
+++ b/docs/devices/haam-r4.md
@@ -0,0 +1,71 @@
+# HAAM HM4K75S11TND: selecting the satellite tuner
+
+Checked on a retail HM4K75S11TND whose Android model is `R4`, Android 11 / API 30,
+Realtek `rtd2851m`, software `V8-T851MGL-0001103`, fingerprint
+`HAAM/HAAM/R4:11/RTT7.221026.001/3172:user/release-keys`.
+These are launcher-routing observations, not a debloat list or firmware compatibility claim.
+
+![Inputs menu on the tested HAAM R4](haam-r4-inputs.png)
+
+## Several tuners, one Live TV app
+
+The player is `com.apps.livetv`. It is separate from the packages that supply the
+inputs. This firmware registers all four of these as system `TYPE_TUNER` inputs:
+
+| Label | Input ID |
+|---|---|
+| ATV | `com.apps.atv/.atvinput.AtvInputService/HW33619968` |
+| CABLE | `com.apps.dtv/.tvinput.DTVTvInputService/HW33685504` |
+| ANTENNA | `com.apps.dtv/.tvinput.DTVTvInputService/HW33685505` |
+| SATELLITE | `com.apps.dtv/.tvinput.DTVTvInputService/HW33685506` |
+
+The automatic tuner heuristic picks ATV here: its ID does not contain `analog`.
+Even preferring a digital input would not tell the launcher which of cable,
+antenna or satellite has the owner's dish connected. Sending a passthrough URI
+for the satellite input also opened AV on this firmware. The working route is
+the satellite input's **channel collection**, using `TvContract.buildChannelsUriForInput`
+and `TvContract.Channels.CONTENT_TYPE`, restricted to `com.apps.livetv`.
+
+For this exact configuration, merge these keys into your theme's `config.json`:
+
+```json
+{
+ "live_tv_package": "com.apps.livetv",
+ "live_tv_input_id": "com.apps.dtv/.tvinput.DTVTvInputService/HW33685506"
+}
+```
+
+Or set the equivalent strings in `launcher/app/src/main/res/values/config.xml`.
+The ID must match a registered system tuner exactly; obtain your own IDs from
+`tools/tv.py 'dumpsys tv_input'` rather than copying a number from another model.
+If the chosen input is missing, or the configured player cannot resolve the
+channel collection, the row opens the normal Live TV app. It does not silently
+choose another tuner. Leave `live_tv_input_id` empty to retain existing automatic
+selection and OEM routing.
+
+This selects an input, not a particular programme, satellite orbital position or
+frequency. The TV's own channel database and player still control tuning. It does
+not scan, renumber channels, replace a tuner driver or change dish settings.
+
+## Evidence and limits
+
+On the owner's customized launcher, selecting the satellite collection after AV
+opened the satellite input and an existing programme. The owner confirmed normal
+picture and sound. The native TV-input session reported `HW33685506`.
+The proposed change was also built against upstream commit `687b5ee` and tested
+as a separate application on the same TV. With the explicit satellite ID, the
+activity launch used the package-restricted channel-collection URI and the active
+TV-input session reported `HW33685506`. With a deliberately nonexistent ID, the
+launcher instead sent the normal leanback launch intent to the configured Live
+TV app. Up/Down/Left/Right were checked at the Inputs popup's first and last rows;
+Back closed the popup. The screenshot above is from that test build.
+
+The picture/sound confirmation above belongs to the earlier customized build;
+the separate test build was verified through its launch intent and input session.
+Do not treat an empty screenshot of the video plane as failed reception; check
+the session and ask the person watching the TV.
+
+The TV reports AV as connected even with its jack empty. Its inactive HDMI ports
+report standby whether a cable is attached or not. Those state reports cannot
+establish physical cable presence. This tuner-selection change does not alter
+the connection indicators or hide any input rows.
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..d05bef851 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -45,6 +45,7 @@ final class Config {
final List<String> hiddenApps;
final String liveTvPackage;
final String liveTvAction;
+ final String liveTvInputId;
/** Package to the action its tile sends instead of opening the start screen (config.xml, launch_actions). */
final Map<String, String> launchActions;
/** Package to the name its tile shows instead of the app's label (config.xml, app_labels). */
@@ -106,7 +107,7 @@ final class Config {
final boolean cinematicHome;
private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, String liveTvPackage,
- String liveTvAction, Map<String, String> launchActions, Map<String, String> appLabels,
+ String liveTvAction, String liveTvInputId, 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,
@@ -122,6 +123,7 @@ final class Config {
this.hiddenApps = Collections.unmodifiableList(hiddenApps);
this.liveTvPackage = liveTvPackage;
this.liveTvAction = liveTvAction;
+ this.liveTvInputId = liveTvInputId;
this.launchActions = Collections.unmodifiableMap(launchActions);
this.appLabels = Collections.unmodifiableMap(appLabels);
this.appBanners = Collections.unmodifiableMap(appBanners);
@@ -170,6 +172,7 @@ final class Config {
List<String> hidden = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.hidden_apps)));
String liveTv = res.getString(R.string.live_tv_package).trim();
String liveTvAction = res.getString(R.string.live_tv_action).trim();
+ String liveTvInputId = res.getString(R.string.live_tv_input_id).trim();
List<String> launchActions = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.launch_actions)));
List<String> appLabels = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.app_labels)));
List<String> appBanners = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.app_banners)));
@@ -210,6 +213,7 @@ final class Config {
hidden = stringList(json, "hidden_apps", hidden);
liveTv = string(json, "live_tv_package", liveTv);
liveTvAction = string(json, "live_tv_action", liveTvAction);
+ liveTvInputId = string(json, "live_tv_input_id", liveTvInputId);
launchActions = stringList(json, "launch_actions", launchActions);
appLabels = stringList(json, "app_labels", appLabels);
appBanners = stringList(json, "app_banners", appBanners);
@@ -284,7 +288,7 @@ final class Config {
Festival festival = json == null ? Festival.NONE : Festival.parse(string(json, "festival", ""),
string(json, "festival_until", ""), string(json, "greeting", ""), string(json, "accent_color", ""));
- return new Config(dock, fillDock, hidden, liveTv, liveTvAction, packageMap(launchActions), packageMap(appLabels),
+ return new Config(dock, fillDock, hidden, liveTv, liveTvAction, liveTvInputId, packageMap(launchActions), packageMap(appLabels),
packageMap(appBanners), panelService,
panelAction, inputAction,
Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,
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..71a632c79 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -98,6 +98,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private static final long STATS_MS = 10_000L;
private String liveTvPkg;
private String liveTvAction;
+ private String liveTvInputId;
private String inputAction;
private String sourcePanelService;
private String sourcePanelAction;
@@ -286,6 +287,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
festive = festival.active(LocalDate.now());
liveTvPkg = cfg.liveTvPackage;
liveTvAction = cfg.liveTvAction;
+ liveTvInputId = cfg.liveTvInputId;
inputAction = cfg.inputAction;
sourcePanelService = cfg.sourcePanelService;
sourcePanelAction = cfg.sourcePanelAction;
@@ -2109,7 +2111,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
boolean hdmiStateBogus = hdmiPorts > 1 && hdmiConnected == hdmiPorts;
for (TvInputInfo info : inputs) {
if (info.getType() == TvInputInfo.TYPE_TUNER
- && (info.getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ && (info.getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
+ && (liveTvInputId.isEmpty() || liveTvInputId.equals(info.getId()))) {
// Prefer a hardware tuner: the framework names those ".../HW<n>". System apps such as
// AirPlay also register software inputs of type TUNER and may sort first (seen on TCL G05).
// Among tuners of the same kind, skip an analog input when another is present.
@@ -2174,9 +2177,14 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// AIWA AI PONT SA that player stays black, and the Live TV package does not handle the
// URI at all, which used to toast "Not available on this TV". Keep the leanback activity
// then: it is the same path as the Live TV tile. Do not drop the package restriction.
+ // An explicit tuner uses its channel collection (e.g. DVB-S rather than DVB-T/C).
+ // Keep the legacy passthrough route for automatic selection: some OEM players need it.
+ // If the configured input is absent, tunerId stays null and the app opens normally.
+ boolean configured = !liveTvInputId.isEmpty();
Intent tuned = new Intent(Intent.ACTION_VIEW)
- .setDataAndType(TvContract.buildChannelUriForPassthroughInput(tunerId),
- "vnd.android.cursor.item/channel")
+ .setDataAndType(configured ? TvContract.buildChannelsUriForInput(tunerId)
+ : TvContract.buildChannelUriForPassthroughInput(tunerId),
+ configured ? TvContract.Channels.CONTENT_TYPE : TvContract.Channels.CONTENT_ITEM_TYPE)
.setPackage(liveTvPkg);
if (tuned.resolveActivity(getPackageManager()) != null) liveTv = tuned;
}
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 3deebbea4..3ee76291d 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -33,6 +33,13 @@
to that package instead, and the app starts normally. Leave empty to omit. -->
<string name="live_tv_action" translatable="false"></string>
+ <!-- Optional exact system tuner ID for the Inputs menu's Live TV row, e.g. the DVB-S input on
+ a TV with separate antenna, cable and satellite tuners. It opens that input's channel
+ collection, restricted to live_tv_package. Empty keeps automatic selection and its existing
+ OEM passthrough route. If the ID is absent or the app cannot handle the collection, open
+ the Live TV app normally instead of selecting a different input. See docs/devices/haam-r4.md. -->
+ <string name="live_tv_input_id" translatable="false"></string>
+
<!-- Tiles that open a screen of the app instead of its start screen: "package=action", sent to that package.
A tile whose action no longer resolves opens the app normally. MagentaTV's program guide:
com.telekom.onetv.tv.pl=com.telekom.onetv.tv.pl.action.PROGRAM_GUIDE. -->
diff --git a/themes/README.md b/themes/README.md
index d08c19670..5fa396f77 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -30,6 +30,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `fill_dock` | bool | Fill the dock slots `dock_apps` leaves free with the first grid apps (true by default); false leaves them empty |
| `hidden_apps` | list of package names | Never shown as tiles |
| `live_tv_package`, `live_tv_action` | string | The Live TV app and, if it has no leanback entry, the action to start it with |
+| `live_tv_input_id` | string | Exact system tuner for the Inputs menu's Live TV row; opens its channel collection. Empty keeps automatic selection. Missing input or unsupported collection falls back to the app's normal launch. [HAAM satellite example](../docs/devices/haam-r4.md) |
| `source_panel_service`, `source_panel_action` | string | The TV's own source panel, for sets with no TvInputManager: a service, or an activity (BYINTEK U4). Without a Live TV app, the Inputs pill opens it directly |
| `launch_actions` | list of `"package=action"` | Tiles that open a screen of the app instead of its start screen; an action that no longer resolves opens the app normally (MagentaTV's guide: `com.telekom.onetv.tv.pl=com.telekom.onetv.tv.pl.action.PROGRAM_GUIDE`) |
| `app_labels` | list of `"package=Name"` | A tile's name instead of the app's own (MagentaTV as `com.telekom.onetv.tv.pl=TV`) |