Skip to content

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

Launcher: library_excluded_apps, an off-by-default App Library exclusion key

ahmersdevabdc36b8f1e7
diff --git a/docs/switches.md b/docs/switches.md
index 28650c749..74e611231 100644
--- a/docs/switches.md
+++ b/docs/switches.md
@@ -48,6 +48,7 @@ fits the rules; keys from before the rule sit on its wanted list until a screens
| `dock_band` | <img src="switches/dock_band.jpg" width="320" alt="dock_band on a TV"> |
| `show_library_pill` | <img src="switches/show_library_pill.jpg" width="320" alt="show_library_pill on a TV"> |
| `library_ok_opens` | <img src="switches/library_ok_opens.jpg" width="320" alt="library_ok_opens on a TV"> |
+| `library_excluded_apps` | <img src="switches/library_excluded_apps.png" width="320" alt="library_excluded_apps on a TV: a CANDY Android TV DVB2K's App library catalogue, factory-menu packages excluded"> |
| `date_below_clock` | <img src="switches/date_below_clock.jpg" width="320" alt="date_below_clock on a TV"> |
| `locale` | <img src="switches/locale.jpg" width="320" alt="locale set to en on a TV whose system language is Vietnamese"> |
| `power_on_home` | <img src="switches/power_on_home.jpg" width="320" alt="power_on_home on a TV"> |
diff --git a/docs/switches/library_excluded_apps.png b/docs/switches/library_excluded_apps.png
new file mode 100644
index 000000000..6fc71a710
Binary files /dev/null and b/docs/switches/library_excluded_apps.png differ
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java b/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java
index e62db4635..5699296d2 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java
@@ -143,7 +143,11 @@ final class AppLibraryDialog {
if (popup.isShowing()) popup.update(width, height);
}
- AppLibraryDialog(Activity activity, boolean animations, boolean reducedMotion, boolean selectionMode, boolean okOpens, Predicate<String> onHome, Runnable changed, Runnable dismissed) {
+ /** library_excluded_apps (config.xml), never offered in the catalogue; empty by default, so existing
+ * setups are unaffected. See LibraryApps.excludedFromCatalog(). */
+ private final Set<String> excludedApps;
+
+ AppLibraryDialog(Activity activity, boolean animations, boolean reducedMotion, boolean selectionMode, boolean okOpens, Predicate<String> onHome, Runnable changed, Runnable dismissed, Set<String> excludedApps) {
this.activity = activity;
this.animations = animations;
this.rtl = activity.getResources().getBoolean(R.bool.rtl_app_grid);
@@ -153,6 +157,7 @@ final class AppLibraryDialog {
this.onHome = onHome;
this.changed = changed;
this.dismissed = dismissed;
+ this.excludedApps = excludedApps;
density = activity.getResources().getDisplayMetrics().density;
panel = new LinearLayout(activity);
panel.setLayoutDirection(rtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
@@ -229,7 +234,7 @@ final class AppLibraryDialog {
if (info.activityInfo == null || !info.activityInfo.exported) continue;
String pkg = info.activityInfo.packageName;
if (Intent.CATEGORY_LEANBACK_LAUNCHER.equals(category)) tv.add(pkg);
- if (!pkg.equals(self) && !unique.containsKey(pkg)) unique.put(pkg, info);
+ if (!pkg.equals(self) && !LibraryApps.excludedFromCatalog(excludedApps, pkg) && !unique.containsKey(pkg)) unique.put(pkg, info);
}
}
Map<String, String> names = new HashMap<>();
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 5d4b78fbd..f6aa5eeb8 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -62,6 +62,8 @@ final class Config {
final List<String> hiddenApps;
/** Packages pre-seeded into the App library's "added" set (config.xml, library_apps); empty by default. */
final List<String> libraryApps;
+ /** Packages the App library catalogue never offers, even with app_library on (config.xml, library_excluded_apps). */
+ final List<String> libraryExcludedApps;
final String liveTvPackage;
final String liveTvAction;
final String liveTvInputId;
@@ -259,7 +261,7 @@ final class Config {
/** With single_row, the band runs behind every app in the row, not only the dock apps (config.xml, dock_band_all). */
final boolean dockBandAll;
- private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, List<String> libraryApps, String liveTvPackage,
+ private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, List<String> libraryApps, List<String> libraryExcludedApps, String liveTvPackage,
String liveTvAction, String liveTvInputId, Map<String, String> launchActions, Map<String, String> appLabels,
Map<String, String> appBanners, String sourcePanelService, String sourcePanelAction,
String sourcePanelExtra, boolean coocaaSources, String inputAction, List<String> inputSources,
@@ -283,6 +285,7 @@ final class Config {
this.fillDock = fillDock;
this.hiddenApps = Collections.unmodifiableList(hiddenApps);
this.libraryApps = Collections.unmodifiableList(libraryApps);
+ this.libraryExcludedApps = Collections.unmodifiableList(libraryExcludedApps);
this.liveTvPackage = liveTvPackage;
this.liveTvAction = liveTvAction;
this.liveTvInputId = liveTvInputId;
@@ -406,6 +409,7 @@ final class Config {
boolean fillDock = res.getBoolean(R.bool.fill_dock);
List<String> hidden = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.hidden_apps)));
List<String> libraryApps = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.library_apps)));
+ List<String> libraryExcludedApps = new ArrayList<>(Arrays.asList(res.getStringArray(R.array.library_excluded_apps)));
String liveTv = res.getString(R.string.live_tv_package).trim();
String liveTvAction = res.getString(R.string.live_tv_action).trim();
String liveTvInputId = res.getString(R.string.live_tv_input_id).trim();
@@ -511,6 +515,7 @@ final class Config {
fillDock = bool(json, "fill_dock", fillDock);
hidden = stringList(json, "hidden_apps", hidden);
libraryApps = stringList(json, "library_apps", libraryApps);
+ libraryExcludedApps = stringList(json, "library_excluded_apps", libraryExcludedApps);
liveTv = string(json, "live_tv_package", liveTv);
liveTvAction = string(json, "live_tv_action", liveTvAction);
liveTvInputId = string(json, "live_tv_input_id", liveTvInputId);
@@ -652,7 +657,7 @@ final class Config {
Festival festival = json == null ? Festival.NONE : Festival.parse(string(json, "festival", ""),
string(json, "festival_until", ""), string(json, "greeting", ""), string(json, "accent_color", ""));
- return new Config(dock, fillDock, hidden, libraryApps, liveTv, liveTvAction, liveTvInputId, packageMap(launchActions), packageMap(appLabels),
+ return new Config(dock, fillDock, hidden, libraryApps, libraryExcludedApps, liveTv, liveTvAction, liveTvInputId, packageMap(launchActions), packageMap(appLabels),
packageMap(appBanners), panelService, panelAction, panelExtra, coocaaSources, inputAction, inputSources, inputUriScheme, Math.max(1, columns),
Math.max(0, rowsBelow), animations, advancedEffects, shamsi, greetingName, moduleCards, reducedMotion, bootToLiveTv,
openOnStartChoice, dockTitle, dockRow, topMenu, launcherSettingsButton, reorderButton, showNetworkPill, showInputsPill,
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java b/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java
index 23e02a4ed..f2bdc2e8f 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java
@@ -107,6 +107,12 @@ final class LibraryApps {
return library && (pill || !button);
}
+ /** A package on library_excluded_apps (config.xml): never offered in the catalogue, unlike hidden_apps,
+ * which only keeps a package off Home while the catalogue still lists it. */
+ static boolean excludedFromCatalog(Set<String> excludedApps, String pkg) {
+ return excludedApps.contains(pkg);
+ }
+
/** OK on a library card opens the app (true) or changes its Home shortcut. app_library_selection's OK always
* changes it; otherwise an app on Home opens, and with library_ok_opens every app does. */
static boolean okOpens(boolean selection, boolean openAll, boolean onHome) {
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 179614434..e8ea411d5 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -253,6 +253,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private boolean openOnStartChoice;
/** hidden_apps as the adapter sees them (config.xml or a theme's config.json): a hidden app gets no card either. */
private Set<String> hiddenApps = Collections.emptySet();
+ /** library_excluded_apps: packages the App library catalogue never offers. */
+ private Set<String> libraryExcludedApps = Collections.emptySet();
private List<Cards.Card> cards = Collections.emptyList();
/** The grid has been laid out and focused since the last resume; the card prompt waits for this. */
private boolean tilesReady;
@@ -517,6 +519,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
btnVpn = findViewById(R.id.btnVpn);
moduleCards = cfg.moduleCards;
hiddenApps = new HashSet<>(cfg.hiddenApps);
+ libraryExcludedApps = new HashSet<>(cfg.libraryExcludedApps);
grid = findViewById(R.id.grid);
rtlAppGrid = getResources().getBoolean(R.bool.rtl_app_grid);
@@ -1619,7 +1622,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
grid.post(() -> {
if (libraryFocusPending && appLibrary == null && hasWindowFocus() && !isFinishing()) focusLibrary();
});
- });
+ }, libraryExcludedApps);
openPopup = appLibrary.popup;
appLibrary.show();
}
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index c963338f1..93907296a 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -391,6 +391,15 @@
<string-array name="library_apps" translatable="false">
</string-array>
+ <!-- Packages the App library catalogue never offers, even with app_library on (config.xml
+ library_excluded_apps, or a theme's config.json). Different from hidden_apps, which only keeps a
+ package off Home while still listing it here: some boards hide a package because opening it is
+ unsafe (a factory-test menu that can misconfigure the TV), and the catalogue otherwise ignores
+ hidden_apps and offers it as "Add to Home" anyway. Empty (off) by default, so existing setups
+ change nothing. -->
+ <string-array name="library_excluded_apps" translatable="false">
+ </string-array>
+
<!-- Module cards: an app that declares a card (docs/specs/card.md) can stand in for its tile with its own
label, caption and glow colour, once you answer Show on the prompt. false: never look for cards or ask. -->
<bool name="module_cards">true</bool>
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java b/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java
index e4da5053f..a8ed90e14 100644
--- a/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java
+++ b/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java
@@ -134,6 +134,14 @@ public class LibraryAppsTest {
}
}
+ @Test public void excludedFromCatalogIsExactSetMembershipAndEmptyByDefault() {
+ Set<String> excluded = new HashSet<>();
+ excluded.add("com.example.factory");
+ assertTrue(LibraryApps.excludedFromCatalog(excluded, "com.example.factory"));
+ assertFalse(LibraryApps.excludedFromCatalog(excluded, "com.example.other"));
+ assertFalse(LibraryApps.excludedFromCatalog(Collections.emptySet(), "com.example.factory"));
+ }
+
@Test public void aFullListAllowsRemovalAndAnExistingChoiceButNotAnotherApp() {
Set<String> apps = new HashSet<>();
for (int i = 0; i < LibraryApps.MAX_ADDED; i++) apps.add("com.example.app" + i);
diff --git a/themes/README.md b/themes/README.md
index 9fe471a6e..bc6ec5ae5 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -82,6 +82,7 @@ A new key needs one there in the same pull request.
| `app_library_selection` | bool | OK toggles Home checkmarks in the library; checked apps first, both groups alphabetized. Hiding keeps focus on the adjacent next app (previous at the end). Requires `app_library`; `false` preserves the standard open/long-press behavior |
| `library_ok_opens` | bool | OK opens every app in the library, not only the ones on Home, for a library that holds the apps `hidden_apps` keeps off Home; holding OK still offers Add to Home, and cards drop their "Add to Home" line. Requires `app_library`; `app_library_selection` wins when both are on; `false` by default |
| `library_apps` | list of package names | Packages pre-seeded into the App library's "added" set at startup (config.xml `library_apps`, or a theme's `config.json`). They show on Home as if the owner had added them in the App library UI, and stay removable there (a removed one stays hidden); empty (off) by default |
+| `library_excluded_apps` | list of package names | Packages the App library catalogue never offers, even with `app_library` on. Different from `hidden_apps`, which only keeps a package off Home while still listing it in the catalogue; empty (off) by default |
| `shamsi_date` | bool | Show the Solar Hijri date above the Gregorian one |
| `lunar_date` | bool | Show the lunisolar date under the Gregorian one, e.g. `LUNAR 13/9 · YEAR OF THE HORSE`, or `13/9 ÂM LỊCH · BÍNH NGỌ` in Vietnamese; a leap month is marked. Off by default |
| `lunar_utc_offset` | 0 to 14 | Hours east of UTC the lunar calendar is computed for: `7` is the Vietnamese calendar, `8` the Chinese one, `9` the Korean one; they differ by a day now and then (and by a month in 1985). Unset: 7 when the TV is in Vietnamese, 9 in Korean, 8 otherwise |