Skip to content

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

App library: pre-seed apps from config.xml library_apps, off by default (#419)

yaxi01555-progbf8e272e2204
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
index 7cd53373d..290d0b9a7 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
@@ -190,6 +190,8 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private int docked, emptySlots;
/** Never shown as tiles (res/values/config.xml, hidden_apps). */
private final Set<String> hidden;
+ /** Apps pre-seeded into the App library's "added" set (config.xml library_apps); empty by default. */
+ private final Set<String> libraryPreload;
private final boolean animations;
private final boolean advancedEffects;
private final boolean showLibrary;
@@ -215,6 +217,7 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
this.favourites = cfg.dockApps;
this.fillDock = cfg.fillDock;
this.hidden = new HashSet<>(cfg.hiddenApps);
+ this.libraryPreload = new HashSet<>(cfg.libraryApps);
this.animations = cfg.animations;
this.advancedEffects = cfg.animations && cfg.advancedEffects;
this.showHomeSettings = cfg.showHomeSettingsShortcut;
@@ -247,7 +250,9 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
Set<String> tvPackages = new HashSet<>();
for (ResolveInfo ri : found) if (ri.activityInfo != null) tvPackages.add(ri.activityInfo.packageName);
leanbackPackages = tvPackages;
- Set<String> added = LibraryApps.load(ctx);
+ // Copy before merging: LibraryApps.load() may return an immutable empty set (#419).
+ Set<String> added = new HashSet<>(LibraryApps.load(ctx));
+ added.addAll(libraryPreload);
Set<String> removed = LibraryApps.loadRemoved(ctx);
if (!added.isEmpty()) {
Set<String> seen = new HashSet<>(tvPackages);
@@ -768,4 +773,4 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
});
}
}
-}
+}
\ No newline at end of file