Skip to content

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

launcher: prefer a hardware tuner for the Live TV entry, from damonearl's #73

Gathin23c7ea3b684339
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 ca43fcbd6..9dfa9335b 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -604,6 +604,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
TvInputManager tim = (TvInputManager) getSystemService(TV_INPUT_SERVICE);
boolean sawNonHdmi = false;
String tunerId = null;
+ boolean tunerIsHw = false;
if (tim != null) {
List<TvInputInfo> inputs = new ArrayList<>(tim.getTvInputList());
// HDMI ports first in port order, then AV and the rest.
@@ -623,9 +624,14 @@ 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
- && (tunerId == null || info.getId().compareTo(tunerId) < 0)) {
- tunerId = info.getId();
+ && (info.getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ // 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).
+ boolean hw = info.getId().matches(".*/HW\\d+$");
+ if (tunerId == null || (hw && !tunerIsHw) || (hw == tunerIsHw && info.getId().compareTo(tunerId) < 0)) {
+ tunerId = info.getId();
+ tunerIsHw = hw;
+ }
}
if (!info.isPassthroughInput()) continue;
CharSequence l = info.loadLabel(this);