Skip to content

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

launcher: switch inputs through YaOS's source player (ACCESS_TV_SOURCE, input_uri_scheme) and survive a guarded player

ramory-l5ff262e44d59
diff --git a/launcher/app/src/main/AndroidManifest.xml b/launcher/app/src/main/AndroidManifest.xml
index 7dc9ee681..de697520e 100644
--- a/launcher/app/src/main/AndroidManifest.xml
+++ b/launcher/app/src/main/AndroidManifest.xml
@@ -14,6 +14,9 @@
FINE" rule does not apply here. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
tools:ignore="CoarseFineLocation" />
+ <!-- YaOS (Yandex TV OS): HDMI, AV and the tuner all play in com.yandex.tv.live, whose activities require
+ this permission (protection level normal, so it is granted at install). Ignored on other TVs. -->
+ <uses-permission android:name="yandex.tv.permission.ACCESS_TV_SOURCE" />
<!-- Android 11+ package visibility: lets the launcher list the TV apps it shows as tiles, and the
apps that declare a module card (docs/specs/card.md). -->
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 b55b5a100..27daef067 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -57,6 +57,8 @@ final class Config {
final String sourcePanelService;
final String sourcePanelAction;
final String inputAction;
+ /** Scheme an Inputs row's passthrough URI is sent with instead of content:// (config.xml input_uri_scheme). */
+ final String inputUriScheme;
final int columns;
final boolean animations;
final boolean advancedEffects;
@@ -132,7 +134,7 @@ final class Config {
private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, String liveTvPackage,
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,
+ String inputUriScheme, int columns, int rowsBelowDock, boolean animations, boolean advancedEffects,
boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, boolean reorderButton, boolean showNetworkPill, boolean iconOnlyButtons, boolean libraryButton, int wifiLabelWidth, boolean alwaysShowNames, boolean wallpaperTrueColor, String vpnApp,
boolean showHomeSettingsShortcut, boolean showStats, boolean appLibrary, int backgroundColor, int skyIntensity,
int[] settingsKeycodes, boolean settingsKeyPanel, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,
@@ -152,6 +154,7 @@ final class Config {
this.sourcePanelService = sourcePanelService;
this.sourcePanelAction = sourcePanelAction;
this.inputAction = inputAction;
+ this.inputUriScheme = inputUriScheme;
this.columns = columns;
this.rowsBelowDock = rowsBelowDock;
this.animations = animations;
@@ -209,6 +212,7 @@ final class Config {
String panelService = res.getString(R.string.source_panel_service).trim();
String panelAction = res.getString(R.string.source_panel_action).trim();
String inputAction = res.getString(R.string.input_action).trim();
+ String inputUriScheme = res.getString(R.string.input_uri_scheme).trim();
int columns = res.getInteger(R.integer.columns);
int rowsBelow = res.getInteger(R.integer.rows_below_dock);
boolean animations = res.getBoolean(R.bool.animations);
@@ -258,6 +262,7 @@ final class Config {
panelService = string(json, "source_panel_service", panelService);
panelAction = string(json, "source_panel_action", panelAction);
inputAction = string(json, "input_action", inputAction);
+ inputUriScheme = string(json, "input_uri_scheme", inputUriScheme).trim();
columns = integer(json, "columns", columns, 1, 8);
rowsBelow = integer(json, "rows_below_dock", rowsBelow, 0, 3);
animations = bool(json, "animations", animations);
@@ -341,7 +346,7 @@ final class Config {
return new Config(dock, fillDock, hidden, liveTv, liveTvAction, packageMap(launchActions), packageMap(appLabels),
packageMap(appBanners), panelService,
- panelAction, inputAction,
+ panelAction, inputAction, inputUriScheme,
Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,
shamsi, greetingName, moduleCards, reducedMotion, dockTitle, dockRow, reorderButton, showNetworkPill, iconOnlyButtons, libraryButton, wifiLabelWidth, alwaysShowNames, wallpaperTrueColor, vpn, homeSettings, showStats, library, background,
Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,
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 e89977e15..148612c65 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -109,6 +109,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private final Runnable showIdleClock = () -> startActivity(new Intent(this, ClockActivity.class));
private String liveTvAction;
private String inputAction;
+ private String inputUriScheme;
private String sourcePanelService;
private String sourcePanelAction;
@@ -318,6 +319,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
idleClockMs = cfg.homeIdleClockMinutes * MINUTE_MS;
liveTvAction = cfg.liveTvAction;
inputAction = cfg.inputAction;
+ inputUriScheme = cfg.inputUriScheme;
sourcePanelService = cfg.sourcePanelService;
sourcePanelAction = cfg.sourcePanelAction;
@@ -2227,22 +2229,27 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(i);
- } catch (ActivityNotFoundException e) {
+ } catch (ActivityNotFoundException | SecurityException e) {
Toast.makeText(this, R.string.not_available, Toast.LENGTH_SHORT).show();
}
}
/** Switches to a passthrough input (HDMI, AV). The standard way is ACTION_VIEW on its channel URI,
* which the Live TV app handles; where nothing takes that, the configured `input_action` is sent
- * with the same URI instead (XGIMI's HDMI player only answers com.xgimi.action.hdmiPlayer). */
+ * with the same URI instead (XGIMI's HDMI player only answers com.xgimi.action.hdmiPlayer).
+ * With `input_uri_scheme` set (YaOS: live-tv) the same URI goes out with that scheme and no MIME type.
+ * A player guarded by a permission this build does not declare throws SecurityException, which
+ * used to take Home down with it (YaOS before the manifest asked for ACCESS_TV_SOURCE). */
private void openInput(String inputId) {
Uri uri = TvContract.buildChannelUriForPassthroughInput(inputId);
- Intent view = new Intent(Intent.ACTION_VIEW).setDataAndType(uri, "vnd.android.cursor.item/channel")
+ Intent view = (inputUriScheme.isEmpty()
+ ? 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);
try {
startActivity(view);
return;
- } catch (ActivityNotFoundException e) {
+ } catch (ActivityNotFoundException | SecurityException e) {
if (inputAction.isEmpty()) {
Toast.makeText(this, R.string.not_available, Toast.LENGTH_SHORT).show();
return;
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 4ca1b963c..cc93533cb 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -59,6 +59,10 @@
Live TV app handles. Where nothing answers that, this action is sent with the same URI instead
(XGIMI projectors: com.xgimi.action.hdmiPlayer). Leave empty to omit. -->
<string name="input_action" translatable="false"></string>
+ <!-- Inputs menu: a scheme to send the input's passthrough URI with instead of content:// (and no channel MIME
+ type). YaOS: live-tv. Its source player answers live-tv://android.media.tv/passthrough/<input>, while the
+ content:// URI goes to its channel player, which resumes the last film it played. Leave empty to omit. -->
+ <string name="input_uri_scheme" translatable="false"></string>
<!-- Remote buttons that open Settings, by Linux scancode (HOME_KEY_SERVICE=1 build-and-install.sh). Remotes
that send KEYCODE_SETTINGS need no entry. Some send a code Android does not map: the Xiaomi/Fengmi
diff --git a/themes/README.md b/themes/README.md
index e9ae32cfe..1c06ceccf 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -36,6 +36,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `app_labels` | list of `"package=Name"` | A tile's name instead of the app's own (MagentaTV as `com.telekom.onetv.tv.pl=TV`) |
| `app_banners` | list of `"package=banner_name"` | A tile's artwork from a `banner_*` drawable bundled with the launcher (`banner_tv`: magenta with the Live TV glyph) |
| `input_action` | string | Action sent with an HDMI/AV row's channel URI when nothing handles the standard `VIEW` (XGIMI: `com.xgimi.action.hdmiPlayer`) |
+| `input_uri_scheme` | string | Scheme an HDMI/AV row's passthrough URI is sent with instead of `content://`, with no MIME type (YaOS: `live-tv`, which its source player answers) |
| `columns` | 1 to 8 | Tiles per row; tiles shrink to fit from 5 up |
| `rows_below_dock` | 0 to 3 | Grid rows left visible under the dock; tiles shrink if the dock, its title and that many rows would not fit the screen height |
| `dock_title` | bool | The focused dock app's name in large type above the dock (`true`); `false` keeps only the glow |