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
launcher: put the VIEW_INPUTS handler behind handle_view_inputs, off by default
johnbenwoo1d0851910bc5
diff --git a/launcher/app/src/main/AndroidManifest.xml b/launcher/app/src/main/AndroidManifest.xmlindex a3432a6b2..7dd5267cb 100644--- a/launcher/app/src/main/AndroidManifest.xml+++ b/launcher/app/src/main/AndroidManifest.xml@@ -61,15 +61,6 @@<action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent-filter>- <!-- The system input switcher. On some sets the stock launcher was the only handler of this action- (Hisense huangshan, Android TV 10: no global_keys.xml and no vendor input picker), so once it is- disabled the remote's Input button, which the Live TV app and InputKeyService turn into this- action, did nothing. Answered here with the Inputs menu; where a vendor picker exists the TV- keeps offering the choice. -->- <intent-filter>- <action android:name="com.android.tv.action.VIEW_INPUTS" />- <category android:name="android.intent.category.DEFAULT" />- </intent-filter></activity><activity@@ -77,6 +68,23 @@android:exported="false"android:excludeFromRecents="true"android:screenOrientation="landscape" />+ <!-- The system input switcher (com.android.tv.action.VIEW_INPUTS), which is what the remote's Input+ button becomes through the TV's Live TV app or InputKeyService. Disabled here and switched on by+ MainActivity only while handle_view_inputs is true (config.xml or a theme), for sets whose stock+ launcher was the only handler of the action (Hisense huangshan, Android TV 10): kept off, a TV with+ its own input picker never sees a second candidate and a chooser. -->+ <activity+ android:name=".InputsRequestActivity"+ android:exported="true"+ android:enabled="false"+ android:excludeFromRecents="true"+ android:noHistory="true"+ android:theme="@android:style/Theme.NoDisplay">+ <intent-filter>+ <action android:name="com.android.tv.action.VIEW_INPUTS" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ </activity><!-- Remote Settings button panel (settings_key_panel); own task so the app behind stays put. --><activityandroid:name=".QuickSettingsActivity"diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex b55b5a100..79c372ba8 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -128,6 +128,8 @@ final class Config {final boolean ambientGlow;/** Minutes Home may sit untouched before the clock screensaver (config.xml, home_idle_clock_minutes); 0 is off. */final int homeIdleClockMinutes;+ /** Answer VIEW_INPUTS with the Inputs menu (handle_view_inputs); see InputsRequestActivity. */+ final boolean handleViewInputs;private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, String liveTvPackage,String liveTvAction, Map<String, String> launchActions, Map<String, String> appLabels,@@ -138,7 +140,9 @@ final class Config {int[] settingsKeycodes, boolean settingsKeyPanel, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,int wallpaperRotationMinutes, int wallpaperDim, String wallpaperOrder, boolean overlayApplied,Festival festival, int[] inputKeycodes, List<String> appKeys,- List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes) {+ List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes,+ boolean handleViewInputs) {+ this.handleViewInputs = handleViewInputs;this.inputKeycodes = inputKeycodes;this.appKeys = Collections.unmodifiableList(appKeys);this.dockApps = Collections.unmodifiableList(dockApps);@@ -235,6 +239,7 @@ final class Config {int[] settingsKeycodes = res.getIntArray(R.array.settings_key_keycodes);boolean settingsKeyPanel = res.getBoolean(R.bool.settings_key_panel);int[] inputKeycodes = res.getIntArray(R.array.input_key_keycodes);+ boolean handleViewInputs = res.getBoolean(R.bool.handle_view_inputs);List<String> appKeys = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.app_keys)));boolean cinematic = res.getBoolean(R.bool.cinematic_home);boolean ambientGlow = res.getBoolean(R.bool.ambient_glow);@@ -284,6 +289,7 @@ final class Config {settingsKeycodes = intArray(json, "settings_key_keycodes", settingsKeycodes);settingsKeyPanel = bool(json, "settings_key_panel", settingsKeyPanel);inputKeycodes = intArray(json, "input_key_keycodes", inputKeycodes);+ handleViewInputs = bool(json, "handle_view_inputs", handleViewInputs);appKeys = stringList(json, "app_keys", appKeys);cinematic = bool(json, "cinematic_home", cinematic);ambientGlow = bool(json, "ambient_glow", ambientGlow);@@ -347,7 +353,7 @@ final class Config {Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,wallpapers, rotationMinutes, wallpaperDim, wallpaperOrder, applied,festival, inputKeycodes, appKeys, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow,- Math.max(0, idleClockMinutes));+ Math.max(0, idleClockMinutes), handleViewInputs);}/**diff --git a/launcher/app/src/main/java/com/gathin/tvhome/InputsRequestActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/InputsRequestActivity.javanew file mode 100644index 000000000..e0cc83fc2--- /dev/null+++ b/launcher/app/src/main/java/com/gathin/tvhome/InputsRequestActivity.java@@ -0,0 +1,22 @@+package com.gathin.tvhome;++import android.app.Activity;+import android.content.Intent;+import android.os.Bundle;++/**+ * Answers com.android.tv.action.VIEW_INPUTS, the system input switcher that the remote's Input button turns into+ * (through the TV's Live TV app, or InputKeyService), by bringing Home forward with its Inputs menu open. The+ * component is disabled in the manifest and MainActivity switches it on only while handle_view_inputs is set,+ * so a TV with its own input picker is never offered a chooser. No UI of its own (Theme.NoDisplay).+ */+public class InputsRequestActivity extends Activity {+ @Override+ protected void onCreate(Bundle savedInstanceState) {+ super.onCreate(savedInstanceState);+ startActivity(new Intent(this, MainActivity.class)+ .setAction(MainActivity.ACTION_VIEW_INPUTS)+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));+ finish();+ }+}diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex d9be02c4e..195a3a5f7 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -10,6 +10,7 @@ import android.content.ComponentName;import android.content.Context;import android.content.Intent;import android.content.IntentFilter;+import android.content.pm.PackageManager;import android.content.pm.ApplicationInfo;import android.content.pm.ResolveInfo;import android.graphics.Bitmap;@@ -93,7 +94,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private static final int LAUNCHER_SETTINGS_REQUEST = 42;/** Sent by QuickSettingsActivity: open Launcher settings from here so Home rebuilds when they close. */static final String ACTION_LAUNCHER_SETTINGS = "com.gathin.tvhome.action.LAUNCHER_SETTINGS";- /** The system input switcher; answered here on TVs where nothing else handles it (see the manifest). */+ /** The system input switcher, forwarded here by InputsRequestActivity while handle_view_inputs is on. */static final String ACTION_VIEW_INPUTS = "com.android.tv.action.VIEW_INPUTS";/** Tiles per row and dock slots (res/values/config.xml, columns). Set in onCreate. */static int COLUMNS = 4;@@ -307,6 +308,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {density = getResources().getDisplayMetrics().density;// config.xml, overlaid by config.json from a pushed theme (see Config and tools/theme.sh).Config cfg = Config.load(this);+ applyViewInputsHandler(cfg.handleViewInputs);settingsKeycodes = cfg.settingsKeycodes;settingsKeyPanel = cfg.settingsKeyPanel;COLUMNS = cfg.columns;@@ -599,8 +601,22 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {}/**- * VIEW_INPUTS, which is what the remote's Input button becomes (InputKeyService, or the TV's Live TV app):- * open the Inputs menu once the pill is on screen. The intent is replaced so a later recreate() does not+ * handle_view_inputs: switch InputsRequestActivity, the VIEW_INPUTS handler, on or off. It is disabled in the+ * manifest, so a TV with its own input picker never sees it; only the sets that need it turn it on. Written+ * only when the state differs, so an ordinary start does not touch the package manager.+ */+ private void applyViewInputsHandler(boolean on) {+ ComponentName handler = new ComponentName(this, InputsRequestActivity.class);+ PackageManager pm = getPackageManager();+ int want = on ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;+ if (pm.getComponentEnabledSetting(handler) != want) {+ pm.setComponentEnabledSetting(handler, want, PackageManager.DONT_KILL_APP);+ }+ }++ /**+ * VIEW_INPUTS, forwarded by InputsRequestActivity while handle_view_inputs is on: open the Inputs menu once+ * the pill is on screen. The intent is replaced so a later recreate() does not* open it again. Nothing to do when the TV has no inputs to list (the pill is hidden then).*/private boolean openInputsIfAsked(Intent intent) {diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlindex 4ca1b963c..aae27ef02 100644--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@ -84,6 +84,12 @@reach InputKeyService. Leave empty to omit. --><integer-array name="input_key_keycodes"></integer-array>+ <!-- Answer the system input switcher (com.android.tv.action.VIEW_INPUTS) with the Inputs menu. For TVs whose+ stock launcher was the only handler of that action, so the remote's Input button does nothing once the+ stock launcher is disabled even with InputKeyService on (Hisense huangshan, Android TV 10: no+ global_keys.xml, no vendor input picker). Off by default: a TV with its own input picker would otherwise+ get a chooser on every press. Also "handle_view_inputs": true in a theme's config.json. -->+ <bool name="handle_view_inputs">false</bool><!-- Remote buttons that open an app, as "keycode:package" or "KEYCODE_NAME:package" (INPUT_KEY_SERVICE=1 orHOME_KEY_SERVICE=1; both read this one list, and a theme's config.json can set it too). On Google TV theYouTube button sends 190 (KEYCODE_BUTTON_3) to the stock launcher, so it does nothing once launcherxdiff --git a/themes/README.md b/themes/README.mdindex e9ae32cfe..a85576344 100644--- a/themes/README.md+++ b/themes/README.md@@ -57,6 +57,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can| `advanced_effects` | bool | Optional lifted tile, icon zoom, smooth ambient colour and app opening effects; false by default || `show_home_settings_shortcut` | bool | Keep the optional Default-home tile visible when the TV has a home picker; false by default || `show_stats` | bool | One line under the clock with CPU, free memory and free storage. Off unless set |+| `handle_view_inputs` | bool | Answer the system input switcher (`VIEW_INPUTS`, what the remote's Input button becomes) with the Inputs menu, for sets whose stock launcher was its only handler (Hisense huangshan); `false` by default so a TV with its own input picker never gets a chooser || `background_color` | `#RRGGBB` | Colour behind everything; black by default || `sky_intensity` | 0 to 100 | Time-of-day backdrop: a dark gradient that follows the clock, 0 hides it (default) || `wallpaper` | bool | Show `wallpaper.jpg` from the theme folder (`true`), or ignore it (`false`) |