diff --git a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 374a5715..19917389 100644 --- a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -6,4 +6,9 @@ android:drawable="@mipmap/ic_launcher_foreground" android:inset="22%"/> + + + \ No newline at end of file diff --git a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png new file mode 100644 index 00000000..c43676db Binary files /dev/null and b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png new file mode 100644 index 00000000..413aacf6 Binary files /dev/null and b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png new file mode 100644 index 00000000..83783a71 Binary files /dev/null and b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png new file mode 100644 index 00000000..86343cfe Binary files /dev/null and b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png new file mode 100644 index 00000000..c9fbb303 Binary files /dev/null and b/apps/readest-app/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/icons/android/mipmap-hdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/icons/android/mipmap-hdpi/ic_launcher_monochrome.png old mode 100755 new mode 100644 index 1e8dd023..c43676db Binary files a/apps/readest-app/src-tauri/icons/android/mipmap-hdpi/ic_launcher_monochrome.png and b/apps/readest-app/src-tauri/icons/android/mipmap-hdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/icons/android/mipmap-mdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/icons/android/mipmap-mdpi/ic_launcher_monochrome.png old mode 100755 new mode 100644 index de648c34..413aacf6 Binary files a/apps/readest-app/src-tauri/icons/android/mipmap-mdpi/ic_launcher_monochrome.png and b/apps/readest-app/src-tauri/icons/android/mipmap-mdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_monochrome.png old mode 100755 new mode 100644 index a0478a4e..83783a71 Binary files a/apps/readest-app/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_monochrome.png and b/apps/readest-app/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_monochrome.png old mode 100755 new mode 100644 index 5cffb08c..86343cfe Binary files a/apps/readest-app/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_monochrome.png and b/apps/readest-app/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_monochrome.png b/apps/readest-app/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_monochrome.png old mode 100755 new mode 100644 index 1cdffbe8..c9fbb303 Binary files a/apps/readest-app/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_monochrome.png and b/apps/readest-app/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_monochrome.png differ diff --git a/apps/readest-app/src/__tests__/android/themed-icon.test.ts b/apps/readest-app/src/__tests__/android/themed-icon.test.ts new file mode 100644 index 00000000..220638c4 --- /dev/null +++ b/apps/readest-app/src/__tests__/android/themed-icon.test.ts @@ -0,0 +1,49 @@ +import { describe, it, expect } from 'vitest'; +import { existsSync, readFileSync } from 'fs'; +import { resolve } from 'path'; + +/** + * Regression guard for the Android themed ("Material You" / monochrome) launcher + * icon (issue #4733). + * + * Android 13+ recolors the adaptive icon's `` layer with a + * wallpaper-derived tint when the user enables themed icons. Support for it was + * originally added in #2122/#2153 (the `ic_launcher_monochrome.png` assets) and + * wired into the source adaptive icon, but #2353 ("fixed Android launcher icon + * size") rewrote the *committed* `gen/` adaptive icon to inset the foreground + * and silently dropped the `` layer — so themed icons stopped + * working in shipped builds. + * + * The CI/release flow regenerates `gen/android` from scratch + * (`tauri android init` + `tauri icon`) and then `git checkout .` to restore the + * *tracked* customizations. `tauri icon` does not emit a monochrome layer, so + * the themed icon only survives if both the adaptive-icon XML and the + * monochrome mipmaps are tracked under `gen/`. + * + * Invariants: + * 1. The committed adaptive icon declares a `` layer pointing at + * `@mipmap/ic_launcher_monochrome`. + * 2. A tracked `ic_launcher_monochrome.png` exists for every launcher density + * so the resource resolves at build time (these are force-added past the + * `gen/` .gitignore, like the other customized resources). + */ + +const appRoot = process.cwd(); +const resRoot = resolve(appRoot, 'src-tauri/gen/android/app/src/main/res'); + +const DENSITIES = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']; + +describe('Android themed (monochrome) launcher icon', () => { + it('declares a layer in the adaptive icon', () => { + const xml = readFileSync(resolve(resRoot, 'mipmap-anydpi-v26/ic_launcher.xml'), 'utf8'); + expect(xml).toMatch(/ { + const missing = DENSITIES.filter( + (d) => !existsSync(resolve(resRoot, `mipmap-${d}`, 'ic_launcher_monochrome.png')), + ); + expect(missing, `missing tracked monochrome mipmaps for: ${missing.join(', ')}`).toEqual([]); + }); +});