Modern Apps git

← Modern-Apps.git

library: custom splash base theme, drop disable-preview hack

Commit
e17db41c796d80a33e26c17e3ec1105be7ec216b
Author
Vayun Mathur <[email protected]>
When
2026-12-05 22:54 UTC (4 hours ago)
Parents
161f6c0
This deliberately supersedes the agent-no-splash2 changes now on main
(invisible system splash in af52efb63 and windowDisablePreview=true in
69549219a). windowDisablePreview does not reliably suppress the
starting window on current Android, and suppressing it was only ever a
way to hide a blank/default splash. The apps now own a proper custom
splash instead.

Theme.General becomes Theme.General.Base in :library (light/dark and
v33 twins): no windowDisablePreview, splash background is the theme
window background (?android:attr/colorBackground), no icon background
disc, zero animated-icon duration. The splash icon itself cannot live
here - a library link has no app icon (AAPT fails on
@mipmap/ic_launcher in :library) - so Base carries everything except
the icon and build-logic generates each app's Theme.General as Base
plus that app's icon (next commit).

Weather keeps its own splash background matching its window background;
Web just inherits; watch-wear (no :library dependency) spells the same
recipe out in Theme.WatchWear and drops its now-unused empty splash
drawable. Theme.General.Translucent is unchanged in behaviour: it is a
headless biometric host, not a launcher surface, so it honestly keeps
windowDisablePreview and the empty icon - no splash may appear there.

User-visible effect: on cold start the user sees the app's own launcher
icon centred on the app's theme background (light/dark correct), no
brand text and no spinner, until the first frame replaces it on the
same background colour.

Verified: :library lint/lintVitalRelease/testDevUnitTest and
:notes/:camera/:weather/:web lint, lintVitalRelease and
assembleRelease all pass; aapt2 dumps of the merged APK themes show
the splash attrs (see the build-logic commit).

Diff

library/AGENTS.md
diff --git a/library/AGENTS.md b/library/AGENTS.mdindex c5903ccef7..51dfb51a0f 100644--- a/library/AGENTS.md+++ b/library/AGENTS.md@@ -13,6 +13,7 @@ **Purpose:** Base library every module depends on — navigation keys, cross-app `AssistantIntent` + shared IPC DTOs (`intents/<app>`), `RoomRepository` base, messenger, backup/storage helpers, game-hub reporting. **How to use:** Routes implement `util/NavKey`; screens navigate via `util/Navigation.kt` (+ bottom-bar/motion/results helpers). Cross-app calls go through `AssistantIntent<In,Out>` with DTOs in `library.intents.<app>`. Room entities subclass `util/RoomViewModel`/`DatabaseHelper` patterns; backups via `BackupAgent`/`BackupHelper`/`BackupFormat`. Games report via `GameHubReporter`/`DailyStreakReporter`. **Entry points:** `util/Navigation.kt` → `util/NavKey` (same file) → `util/AssistantIntent.kt` → `intents/notes/` (copy-pattern) → `util/AppMessages.kt`.+**Themes:** `res/values*/themes.xml` carries `Theme.General.Base` (window + Android 12+ splash background, light/dark + v33 twins) and `Theme.General.Translucent` (headless biometric host; keeps `windowDisablePreview` + empty splash icon). The splash icon is not here — a library cannot reference an app's icon — so build-logic generates each app's `Theme.General` as Base plus `windowSplashScreenAnimatedIcon=@mipmap/ic_launcher` (that app's generated adaptive icon). **Gotchas:** `util/` here is grandfathered (this IS the util library) — the no-`util/` rule applies to apps, not this module. DTO changes break every consumer — keep `intents/` backward-compatible.  ## Key files
library/src/main/res/values-night-v33/themes.xml
diff --git a/library/src/main/res/values-night-v33/themes.xml b/library/src/main/res/values-night-v33/themes.xmlindex 2cff022527..9303add942 100644--- a/library/src/main/res/values-night-v33/themes.xml+++ b/library/src/main/res/values-night-v33/themes.xml@@ -1,20 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> <resources> -    <!-- API 33+ night twin of Theme.General: dark parent, identical-         no-visible-splash attrs (disablePreview, empty icon, dark background). -->-    <style name="Theme.General" parent="android:Theme.Material.NoActionBar">+    <!-- Custom splash (Android 12+ SplashScreen API, installed by MaActivity):+         the app's own launcher icon centred on the theme background, no text,+         no spinner, removed the moment the first frame is ready. The icon is+         referenced as @mipmap/ic_launcher, which resolves per app at link+         time to the adaptive icon build-logic generates from that app's+         launcherIcon symbol, so this one shared theme gives every app its+         own icon: build-logic generates Theme.General per app as this style+         plus windowSplashScreenAnimatedIcon=@mipmap/ic_launcher (a library+         cannot reference an app's icon). windowDisablePreview is deliberately+         absent: the splash surface is wanted now (it previously only+         suppressed a blank/default splash, and it does not reliably+         suppress anything on current Android). The background is the window background, so the+         first app frame continues from the splash with no colour jump. -->+    <style name="Theme.General.Base" parent="android:Theme.Material.NoActionBar">         <item name="android:windowSoftInputMode">stateUnchanged</item>-        <item name="android:windowDisablePreview">true</item>         <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>-        <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_splash_empty</item>         <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>         <item name="android:windowSplashScreenAnimationDuration">0</item>     </style>      <!-- Transparent host for headless prompt activities (passwords' CableActivity):          no content is ever set, only a system BiometricPrompt is shown, so the-         window must not paint an opaque background over the calling app. -->+         window must not paint an opaque background over the calling app. This+         is not a launcher surface, so it keeps windowDisablePreview and the+         empty splash icon: no splash may ever appear for it. -->     <style name="Theme.General.Translucent" parent="android:Theme.Material.NoActionBar">         <item name="android:windowIsTranslucent">true</item>         <item name="android:windowDisablePreview">true</item>
library/src/main/res/values-night/themes.xml
diff --git a/library/src/main/res/values-night/themes.xml b/library/src/main/res/values-night/themes.xmlindex d48d074fc8..9303add942 100644--- a/library/src/main/res/values-night/themes.xml+++ b/library/src/main/res/values-night/themes.xml@@ -1,20 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> <resources> -    <!-- Night twin of Theme.General: same style, dark Material parent. No visible-         splash (see day twin): disablePreview first, invisible splash as fallback. -->-    <style name="Theme.General" parent="android:Theme.Material.NoActionBar">+    <!-- Custom splash (Android 12+ SplashScreen API, installed by MaActivity):+         the app's own launcher icon centred on the theme background, no text,+         no spinner, removed the moment the first frame is ready. The icon is+         referenced as @mipmap/ic_launcher, which resolves per app at link+         time to the adaptive icon build-logic generates from that app's+         launcherIcon symbol, so this one shared theme gives every app its+         own icon: build-logic generates Theme.General per app as this style+         plus windowSplashScreenAnimatedIcon=@mipmap/ic_launcher (a library+         cannot reference an app's icon). windowDisablePreview is deliberately+         absent: the splash surface is wanted now (it previously only+         suppressed a blank/default splash, and it does not reliably+         suppress anything on current Android). The background is the window background, so the+         first app frame continues from the splash with no colour jump. -->+    <style name="Theme.General.Base" parent="android:Theme.Material.NoActionBar">         <item name="android:windowSoftInputMode">stateUnchanged</item>-        <item name="android:windowDisablePreview">true</item>         <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>-        <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_splash_empty</item>         <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>         <item name="android:windowSplashScreenAnimationDuration">0</item>     </style>      <!-- Transparent host for headless prompt activities (passwords' CableActivity):          no content is ever set, only a system BiometricPrompt is shown, so the-         window must not paint an opaque background over the calling app. -->+         window must not paint an opaque background over the calling app. This+         is not a launcher surface, so it keeps windowDisablePreview and the+         empty splash icon: no splash may ever appear for it. -->     <style name="Theme.General.Translucent" parent="android:Theme.Material.NoActionBar">         <item name="android:windowIsTranslucent">true</item>         <item name="android:windowDisablePreview">true</item>
library/src/main/res/values-v33/themes.xml
diff --git a/library/src/main/res/values-v33/themes.xml b/library/src/main/res/values-v33/themes.xmlindex 347154dcde..08475b4152 100644--- a/library/src/main/res/values-v33/themes.xml+++ b/library/src/main/res/values-v33/themes.xml@@ -1,20 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> <resources> -    <!-- API 33+ twin of Theme.General: identical no-visible-splash attrs-         (disablePreview, empty icon, window background). -->-    <style name="Theme.General" parent="android:Theme.Material.Light.NoActionBar">+    <!-- Custom splash (Android 12+ SplashScreen API, installed by MaActivity):+         the app's own launcher icon centred on the theme background, no text,+         no spinner, removed the moment the first frame is ready. The icon is+         referenced as @mipmap/ic_launcher, which resolves per app at link+         time to the adaptive icon build-logic generates from that app's+         launcherIcon symbol, so this one shared theme gives every app its+         own icon: build-logic generates Theme.General per app as this style+         plus windowSplashScreenAnimatedIcon=@mipmap/ic_launcher (a library+         cannot reference an app's icon). windowDisablePreview is deliberately+         absent: the splash surface is wanted now (it previously only+         suppressed a blank/default splash, and it does not reliably+         suppress anything on current Android). The background is the window background, so the+         first app frame continues from the splash with no colour jump. -->+    <style name="Theme.General.Base" parent="android:Theme.Material.Light.NoActionBar">         <item name="android:windowSoftInputMode">stateUnchanged</item>-        <item name="android:windowDisablePreview">true</item>         <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>-        <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_splash_empty</item>         <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>         <item name="android:windowSplashScreenAnimationDuration">0</item>     </style>      <!-- Transparent host for headless prompt activities (passwords' CableActivity):          no content is ever set, only a system BiometricPrompt is shown, so the-         window must not paint an opaque background over the calling app. -->+         window must not paint an opaque background over the calling app. This+         is not a launcher surface, so it keeps windowDisablePreview and the+         empty splash icon: no splash may ever appear for it. -->     <style name="Theme.General.Translucent" parent="android:Theme.Material.Light.NoActionBar">         <item name="android:windowIsTranslucent">true</item>         <item name="android:windowDisablePreview">true</item>
library/src/main/res/values/themes.xml
diff --git a/library/src/main/res/values/themes.xml b/library/src/main/res/values/themes.xmlindex dcf5b312ab..08475b4152 100644--- a/library/src/main/res/values/themes.xml+++ b/library/src/main/res/values/themes.xml@@ -1,24 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> <resources> -    <style name="Theme.General" parent="android:Theme.Material.Light.NoActionBar">+    <!-- Custom splash (Android 12+ SplashScreen API, installed by MaActivity):+         the app's own launcher icon centred on the theme background, no text,+         no spinner, removed the moment the first frame is ready. The icon is+         referenced as @mipmap/ic_launcher, which resolves per app at link+         time to the adaptive icon build-logic generates from that app's+         launcherIcon symbol, so this one shared theme gives every app its+         own icon: build-logic generates Theme.General per app as this style+         plus windowSplashScreenAnimatedIcon=@mipmap/ic_launcher (a library+         cannot reference an app's icon). windowDisablePreview is deliberately+         absent: the splash surface is wanted now (it previously only+         suppressed a blank/default splash, and it does not reliably+         suppress anything on current Android). The background is the window background, so the+         first app frame continues from the splash with no colour jump. -->+    <style name="Theme.General.Base" parent="android:Theme.Material.Light.NoActionBar">         <item name="android:windowSoftInputMode">stateUnchanged</item>-        <!-- No visible splash: windowDisablePreview stops the system drawing any-             starting window/splash surface before the first app frame, so the app UI-             is the first thing shown. The splash attrs below stay as the fallback for-             launches where the system ignores disablePreview (HOME/system-surface-             launches on some Android versions): empty icon, no disc, no animation,-             background matched to the window background. -->-        <item name="android:windowDisablePreview">true</item>         <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>-        <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_splash_empty</item>         <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>         <item name="android:windowSplashScreenAnimationDuration">0</item>     </style>      <!-- Transparent host for headless prompt activities (passwords' CableActivity):          no content is ever set, only a system BiometricPrompt is shown, so the-         window must not paint an opaque background over the calling app. -->+         window must not paint an opaque background over the calling app. This+         is not a launcher surface, so it keeps windowDisablePreview and the+         empty splash icon: no splash may ever appear for it. -->     <style name="Theme.General.Translucent" parent="android:Theme.Material.Light.NoActionBar">         <item name="android:windowIsTranslucent">true</item>         <item name="android:windowDisablePreview">true</item>@@ -29,4 +36,4 @@         <item name="android:windowIsFloating">false</item>         <item name="android:backgroundDimEnabled">false</item>     </style>-</resources>\ No newline at end of file+</resources>
watch-wear/src/main/res/drawable/ic_splash_empty.xml
diff --git a/watch-wear/src/main/res/drawable/ic_splash_empty.xml b/watch-wear/src/main/res/drawable/ic_splash_empty.xmldeleted file mode 100644index a2f8c3effb..0000000000--- a/watch-wear/src/main/res/drawable/ic_splash_empty.xml+++ /dev/null@@ -1,7 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<!-- Empty splash icon (copy of :library's): this module does not depend on :library, so it-     carries its own. Theme.WatchWear points windowSplashScreenAnimatedIcon here so the-     system splash draws no icon — just the window background until the first frame. -->-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">-    <solid android:color="@android:color/transparent" />-</shape>
watch-wear/src/main/res/values/themes.xml
diff --git a/watch-wear/src/main/res/values/themes.xml b/watch-wear/src/main/res/values/themes.xmlindex fa3d3150ab..aebae4d5b0 100644--- a/watch-wear/src/main/res/values/themes.xml+++ b/watch-wear/src/main/res/values/themes.xml@@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <resources>-    <!-- Watch app theme: same parent as before, plus the shared no-visible-splash-         recipe (this module cannot inherit :library's Theme.General).-         windowDisablePreview stops any starting window; the splash attrs are the-         fallback where the system ignores it: no icon, no animation, splash-         background is the (dark) window background. -->+    <!-- Watch app theme: same parent as before, plus the shared custom-splash+         recipe (this module cannot inherit :library's Theme.General): the+         app's own launcher icon centred on the (dark) window background,+         removed as soon as the first frame is ready. minSdk 30 means the+         Android 12+ splash attrs are simply unused on API 30, where the+         system draws its default starting window instead. -->     <style name="Theme.WatchWear" parent="android:Theme.Material.NoActionBar">-        <item name="android:windowDisablePreview">true</item>         <item name="android:windowSplashScreenBackground">?android:attr/colorBackground</item>-        <item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_splash_empty</item>+        <item name="android:windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>         <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>         <item name="android:windowSplashScreenAnimationDuration">0</item>     </style>
weather/src/main/res/values/themes.xml
diff --git a/weather/src/main/res/values/themes.xml b/weather/src/main/res/values/themes.xmlindex 46d5006914..b03f26e373 100644--- a/weather/src/main/res/values/themes.xml+++ b/weather/src/main/res/values/themes.xml@@ -1,10 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <resources>     <style name="Theme.Weather" parent="Theme.General">-        <item name="android:windowDisablePreview">true</item>         <item name="android:windowBackground">@color/window_background</item>         <!-- The splash must match this app's own window background, not the shared-             Theme.General colour, or cold start flashes between the two. -->+             Theme.General colour, or cold start flashes between the two. The+             splash icon is inherited from Theme.General (@mipmap/ic_launcher,+             resolved to this app's generated adaptive icon). -->         <item name="android:windowSplashScreenBackground">@color/window_background</item>     </style> </resources>
web/src/main/res/values-night/themes.xml
diff --git a/web/src/main/res/values-night/themes.xml b/web/src/main/res/values-night/themes.xmlindex 051d390a11..9a1e8f9348 100644--- a/web/src/main/res/values-night/themes.xml+++ b/web/src/main/res/values-night/themes.xml@@ -2,9 +2,8 @@ <resources>      <!-- Parent is Theme.General (its night twin is the same dark Material parent) so Web-         inherits the shared no-splash attrs instead of the platform default icon splash. -->+         inherits the shared custom splash (own launcher icon on the theme background). -->     <style name="Theme.Web" parent="Theme.General">-        <item name="android:windowDisablePreview">true</item>         <item name="android:isLightTheme">false</item>     </style> 
web/src/main/res/values/themes.xml
diff --git a/web/src/main/res/values/themes.xml b/web/src/main/res/values/themes.xmlindex e6416ccb9d..3d958773b9 100644--- a/web/src/main/res/values/themes.xml+++ b/web/src/main/res/values/themes.xml@@ -2,7 +2,6 @@ <resources>      <style name="Theme.Web" parent="Theme.General">-        <item name="android:windowDisablePreview">true</item>         <item name="android:isLightTheme">true</item>     </style>