Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
Merge PR #722: Inputs: map HW inputs to vendor source numbers (Xiaomi China tvplayer)
Gathin232b1acce50e70
diff --cc launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex d109264d3,c0a8578c1..2fe57fb9b--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@@ -2267,17 -2232,41 +2267,46 @@@ public class MainActivity extends Activ}}- /** 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 `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). */+ /** `input_sources` in config.xml: "HW5=23" maps the framework input whose id ends in /HW5 to a vendor+ * source number; "HW8=-" leaves that input out of the Inputs menu (a port the board reports but the set+ * does not have). Returns the number, -1 for a left-out input, or null when the input is not listed. */+ private Integer mappedSource(String inputId) {+ if (inputId == null) return null;+ String hw = inputId.substring(inputId.lastIndexOf('/') + 1);+ for (String m : getResources().getStringArray(R.array.input_sources)) {+ int eq = m.indexOf('=');+ if (eq <= 0 || !m.substring(0, eq).trim().equals(hw)) continue;+ String v = m.substring(eq + 1).trim();+ if (v.equals("-")) return -1;+ try { return Integer.parseInt(v); } catch (NumberFormatException e) { return null; }+ }+ return null;+ }++ /** Switches to a passthrough input (HDMI, AV). An input mapped in `input_sources` is opened by sending+ * `input_action` with its source number as the int extra "input" (Xiaomi China firmware, whose tvplayer+ * answers com.xiaomi.mitv.tvplayer.EXTSRC_PLAY and nothing else). Otherwise 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). */++ * 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) {+ Integer source = mappedSource(inputId);+ if (source != null && source >= 0 && !inputAction.isEmpty()) {+ try {+ startActivity(new Intent(inputAction).putExtra("input", source.intValue())+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));+ return;- } catch (ActivityNotFoundException e) {++ } catch (ActivityNotFoundException | SecurityException e) {+ // fall through to the standard way+ }+ }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);diff --cc launcher/app/src/main/res/values/config.xmlindex a3e127804,07dbaeb02..4e50cf07e--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@@ -76,17 -59,16 +76,26 @@@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>++ <!-- Whether HomeKeyService and InputKeyService actually request key filtering (config.xml or a theme's+ "key_filter"). Some firmware (TCL Google TV on Android 12) drops key auto-repeat once ANY service+ filters keys, so long-pressing volume only steps once: set false and the service keeps running but+ stops filtering, which brings repeat back at the price of the remote buttons below doing nothing. -->+ <bool name="key_filter">true</bool>+ <!-- Vendor source numbers for the Inputs menu, "HW<n>=<number>" by the framework input id's last part+ (`tools/tv.py 'dumpsys tv_input'` lists them). A mapped input opens by sending input_action with the+ number as the int extra "input"; "HW<n>=-" leaves a port the board reports but the set does not have+ out of the menu. Xiaomi/Redmi China firmware (MiTV-MFTP0) needs input_action+ com.xiaomi.mitv.tvplayer.EXTSRC_PLAY and MStar numbers: HW5=23, HW6=24, HW7=25, HW8=-, HW2=2,+ HW3=-, HW4=- (see examples/redmi-mitv-mftp0). Leave empty to omit. -->+ <string-array name="input_sources" translatable="false">+ </string-array>+<!-- Remote buttons that open Settings, by Linux scancode (HOME_KEY_SERVICE=1 build-and-install.sh). Remotesthat send KEYCODE_SETTINGS need no entry. Some send a code Android does not map: the Xiaomi/Fengmiprojector remote's gear button is scancode 384 (KEY_TAPE). Find yours withdiff --cc themes/README.mdindex 07cec607e,e9ae32cfe..d620bf98f--- a/themes/README.md+++ b/themes/README.md@@@ -39,7 -36,6 +39,8 @@@ is ignored, and a file that doesn't par| `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) |++| `input_sources` | list, `config.xml` only | Vendor source numbers for the Inputs menu, `HW<n>=<number>` by the input id's last part; a mapped input opens by sending `input_action` with the number as the int extra `input`, and `HW<n>=-` leaves a port the set doesn't have out of the menu. Xiaomi/Redmi China firmware: [redmi-mitv-mftp0](../examples/redmi-mitv-mftp0/). Not read from a theme || `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 |