App shortcut icons appear corrupted / mismatched with labels on Android 17 (black background, wrong scaling)
- 主要語言
- Kotlin
- 星號
- 62.6k
- 分支
- 8.1k
- 平均合併
- 3 天 7 小時
- 30 天內合併 PR
- 36
描述
### Fault point
The 4 static app shortcuts defined in `res/xml/shortcuts.xml` (both `main` and `fdroid` variants) render incorrectly on Android 17: the icons appear as black blocks / badly zoomed crops, looking as if the icon does not match its label.
Shortcuts affected:
- `shortcuts_switch` → `@drawable/ic_qu_switch_24dp`
- `shortcuts_scan` → `@drawable/ic_qu_scan_24dp`
- `shortcuts_start` → `@drawable/ic_qu_start_24dp`
- `shortcuts_stop` → `@drawable/ic_qu_stop_24dp`
They are only shown on Android 17; Android 16 and earlier render them correctly.
### Root cause (platform-level, not a binding bug)
The icon↔label binding is correct — git history shows it was never swapped (`fcc478ff` and later). The real cause is two-fold:
1. **Icon resource structure**: All four `ic_qu_*` drawables are plain non-adaptive vectors with a **white circle baseline + transparent corners** (a circle `pathData` on a 1024×1024 viewport leaves the four corners transparent) plus a black glyph on top.
2. **Android 17 rendering change**: Android 17 now renders transparent areas of shortcut icons as **black** and applies broken zoom/cropping to newly placed shortcuts. The transparent corners therefore turn into black blocks, and the glyph gets scaled incorrectly.
This exact behavior is reported on other projects too:
- Waboodoo/HTTP-Shortcuts#568 (Pixel 9 Pro / Android 17: “Icon Cropping & Background on Home”)
- Waboodoo/HTTP-Shortcuts#569 (“Android 17 Mangles Shortcut Icons”: transparent areas now render black instead of white)
### Analysis
- The shortcut icon bitmap cache (`/data/system/package_shortcut_*`) plus launcher caches can also keep stale icons after an OS/app update, worsening the “old icon, new label” appearance.
- The `ic_qu_*` drawables have no `drawable-night` variant and are not `adaptive-icon`, leaving no safe fallback for the Android 17 rendering path.
### Suggested fix
**User-side (immediate relief):**
1. Delete the app shortcuts and re-add them by long-pressing the launcher icon (forces re-render).
2. Clear the launcher app cache and/or toggle the themed-icon setting to refresh.
**Code-side (proper fix):**
1. Remove the transparent corners by filling the full viewport with an opaque background (e.g. extend the white circle path to a full rect), so there is nothing transparent for Android 17 to turn black.
2. Optionally migrate the shortcut icons to `adaptive-icon` (foreground/background layers) and to semantically clear glyphs (power symbol for switch, `qr_code`, `play_arrow`, `stop`), and add matching `drawable-night` resources.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
此問題位於 `res/xml/shortcuts.xml` 中定義的捷徑圖示和 drawable 資源 `ic_qu_*_24dp`。先檢查 `res/drawable/` 中的 vector drawable 檔案以查看其結構。修正方式是修改 SVG path data 以移除透明角或轉換為 adaptive icons。在 Android 17 模擬器或設備上測試更改,並透過從 launcher 重新新增捷徑來驗證。
由索引模型根據 Issue 內容生成。
評估
- 領域
- mobile
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 活躍
- 描述清晰度
- 描述清楚
- 新手友好度
- 65/100