Skip to content

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

launcher: wallpaper_true_color, decode wallpapers in 32-bit colour (opt-in)

Cristian Rojas7817bad245b6
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 8f41173e3..c6b7b3967 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -70,6 +70,8 @@ final class Config {
final boolean dockRow;
/** Reorder button in the top bar (config.xml reorder_button); the Settings long-press menu offers it either way. */
final boolean reorderButton;
+ /** Decode wallpapers in 32-bit colour instead of RGB_565 (config.xml wallpaper_true_color). */
+ final boolean wallpaperTrueColor;
final String vpnApp;
final boolean showHomeSettingsShortcut;
/** One line under the clock: CPU, free memory, free storage. Off unless config or a theme turns it on. */
@@ -109,7 +111,7 @@ final class Config {
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,
- boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, boolean reorderButton, String vpnApp,
+ boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, boolean reorderButton, 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,
int wallpaperRotationMinutes, int wallpaperDim, boolean overlayApplied,
@@ -139,6 +141,7 @@ final class Config {
this.dockTitle = dockTitle;
this.dockRow = dockRow;
this.reorderButton = reorderButton;
+ this.wallpaperTrueColor = wallpaperTrueColor;
this.vpnApp = vpnApp;
this.showHomeSettingsShortcut = showHomeSettingsShortcut;
this.showStats = showStats;
@@ -187,6 +190,7 @@ final class Config {
boolean dockTitle = res.getBoolean(R.bool.dock_title);
boolean dockRow = res.getBoolean(R.bool.dock_row);
boolean reorderButton = res.getBoolean(R.bool.reorder_button);
+ boolean wallpaperTrueColor = res.getBoolean(R.bool.wallpaper_true_color);
String vpn = res.getString(R.string.vpn_app).trim();
boolean homeSettings = res.getBoolean(R.bool.show_home_settings_shortcut);
boolean showStats = res.getBoolean(R.bool.show_stats);
@@ -227,6 +231,7 @@ final class Config {
dockTitle = bool(json, "dock_title", dockTitle);
dockRow = bool(json, "dock_row", dockRow);
reorderButton = bool(json, "reorder_button", reorderButton);
+ wallpaperTrueColor = bool(json, "wallpaper_true_color", wallpaperTrueColor);
vpn = string(json, "vpn_app", vpn);
homeSettings = bool(json, "show_home_settings_shortcut", homeSettings);
showStats = bool(json, "show_stats", showStats);
@@ -288,7 +293,7 @@ final class Config {
packageMap(appBanners), panelService,
panelAction, inputAction,
Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,
- shamsi, greetingName, moduleCards, reducedMotion, dockTitle, dockRow, reorderButton, vpn, homeSettings, showStats, library, background,
+ shamsi, greetingName, moduleCards, reducedMotion, dockTitle, dockRow, reorderButton, wallpaperTrueColor, vpn, homeSettings, showStats, library, background,
Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,
wallpapers, rotationMinutes, wallpaperDim, applied,
festival, inputKeycodes, appKeys, json == null ? Collections.emptyList() : raceCalendar(json), cinematic);
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/WallpaperPlayer.java b/launcher/app/src/main/java/com/gathin/tvhome/WallpaperPlayer.java
index 7292276c6..0d8a02327 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/WallpaperPlayer.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/WallpaperPlayer.java
@@ -28,6 +28,8 @@ final class WallpaperPlayer {
private final ExecutorService decoder = Executors.newSingleThreadExecutor();
private final Random random = new Random();
private final int width;
+ /** config wallpaper_true_color: ARGB_8888 instead of RGB_565. */
+ private final Bitmap.Config bitmapConfig;
private final int height;
private boolean active;
private boolean closed;
@@ -38,6 +40,7 @@ final class WallpaperPlayer {
this.root = root;
files = new ArrayList<>(config.wallpapers);
interval = config.wallpaperRotationMinutes * 60_000L;
+ bitmapConfig = config.wallpaperTrueColor ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
preferences = context.getSharedPreferences("wallpaper_rotation", Context.MODE_PRIVATE);
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
width = metrics.widthPixels;
@@ -152,7 +155,7 @@ final class WallpaperPlayer {
options.inDensity = scale[0];
options.inTargetDensity = scale[1];
}
- options.inPreferredConfig = Bitmap.Config.RGB_565;
+ options.inPreferredConfig = bitmapConfig;
return BitmapFactory.decodeFile(file.getPath(), options);
} catch (Exception | OutOfMemoryError failure) {
return null;
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 3deebbea4..bff551a81 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -110,6 +110,9 @@
<!-- A reorder button (two arrows) in the top bar. Off by default: reordering is also in the Settings
button's long-press menu, so it needs no extra button on screen. -->
<bool name="reorder_button">false</bool>
+ <!-- Wallpapers decode as RGB_565 (2 bytes a pixel, 4 MB at 1080p), which bands dark gradients such as a night
+ sky, most of all under wallpaper_dim. true decodes them in 32-bit colour: 8 MB, for TVs with 2 GB or more. -->
+ <bool name="wallpaper_true_color">false</bool>
<!-- Grid rows left visible under the dock on the home screen. 0 = dock sits at the very bottom. Tiles shrink if
the dock, its title and this many rows would not otherwise fit the screen height. -->
diff --git a/themes/README.md b/themes/README.md
index d08c19670..ebad817b3 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -40,6 +40,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `dock_title` | bool | The focused dock app's name in large type above the dock (`true`); `false` keeps only the glow |
| `dock_row` | bool | The dock as its own row with a band (`true`); `false` makes the dock apps the first tiles of one plain grid |
| `reorder_button` | bool | A reorder button in the top bar (`false` by default); reordering is always in the Settings button's long-press menu |
+| `wallpaper_true_color` | bool | Decode wallpapers in 32-bit colour (8 MB at 1080p) instead of RGB_565 (4 MB), which bands dark gradients such as a night sky; for TVs with 2 GB or more (`false` by default) |
| `app_library` | bool | An App library pill after the last Home row: every installed app, add one to Home or take it off (`false` by default). The choices stay on the TV when a theme is pushed or reset; see [docs/app-library.md](../docs/app-library.md) |
| `shamsi_date` | bool | Show the Solar Hijri date above the Gregorian one |
| `greeting_name` | string | A name after the greeting, e.g. `"Mr. Trịnh"` for GOOD MORNING, MR. TRỊNH; empty for the greeting alone |