Skip to content

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

launcher: send the HDMI/AV input intent to live_tv_package first

Pierre Kerschgens812a0e1e0e9f
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 dca4f8424..a102a0c9c 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -2675,6 +2675,15 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
? new Intent(Intent.ACTION_VIEW).setDataAndType(uri, "vnd.android.cursor.item/channel")
: new Intent(Intent.ACTION_VIEW, uri.buildUpon().scheme(inputUriScheme).build()))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ // Aim it at the TV app first: apps installed later (a streaming app, a file manager) can claim the same
+ // channel URI too, and with two or more handlers Android shows a chooser instead of the input (WhaleOS).
+ if (!liveTvPkg.isEmpty()) {
+ try {
+ startActivity(new Intent(view).setPackage(liveTvPkg));
+ return;
+ } catch (ActivityNotFoundException | SecurityException ignored) {
+ }
+ }
try {
startActivity(view);
return;