Error handling
- Replace the custom Result type with exceptions; callers catch at the
edge via runCatchingCancellable so cancellation always propagates.
- Log live wallpaper queue failures that were previously ignored.
Architecture
- Add SettingsCoordinator to own settings edits and their scheduling side
effects; ViewModels now only hold UI state.
- Add a domain WallpaperRenderer interface (Android implementation in
data/source) and drop Context from use cases; the service maps
exceptions to messages.
- Share queue dequeuing between static changes and the live wallpaper.
- Merge PreferencesManager into SettingsRepositoryImpl with generated
effect keys (stored key names unchanged).
- Start WallpaperChangeService only through its helpers; merge the
duplicate change actions and share one error path for all actions.
- Fold AlbumRefreshScheduler into WallpaperScheduler.
- Move WallpaperSorter, AppModule and design tokens to their owners.
Cleanup
- Remove unused constants, WorkManager tags, single-value enums and
converters (Room schema unchanged), brand-based texture limits and
single-use design tokens.
- Deduplicate effect controls, interval fields, sort events and
StateFlow sharing.
- Cut trivial tests and comments that restated the code.
Add cancellable imports, preserve inaccessible sources, and update covers and queues atomically. Share folder refresh logic, improve collection controls and accessibility, and simplify repository and selection code.
Validated with 299 unit tests, 29 device tests, lint, and a debug build.
Correct natural-orientation static rendering, make Fill scrolling opt-in, add persistent pause/resume scheduling controls, and remove the unused network-state permission.
Make notification destinations explicit in an analyzer-visible form while retaining immutable PendingIntent flags, resolving the high-severity CodeQL finding.
The preview read the live wallpaper via WallpaperManager.getDrawable(), which
is privacy-restricted on modern Android and returns null without the optional
all-files-access permission - leaving both previews blank/grey.
Render the wallpaper Paperize last recorded instead, loading its source URI
with Coil. A new reactive getCurrentWallpaperFlow (DAO + repository) drives
HomeViewModel.current{Home,Lock}WallpaperUri, so the preview updates whenever
the wallpaper changes and needs no extra permission. Falls back to the
BOTH-mode record when home/lock are synced.
Shows the source image rather than the exact cropped/effected result; a
pixel-exact cached-bitmap preview can follow later.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adding a large folder previously gave no feedback at all (the FAB's
isLoading hook was hardcoded false), so a long import looked frozen.
Surface an ImportProgress state from AlbumViewViewModel and show a modal
dialog with a live count: a counting-up 'Scanning... N found' during the
folder walk, then a determinate 'Saving X / total' bar while rows are
written. scanFolderImages now reports discovery progress (throttled), and
inserts run in chunks that report saved/total - which also avoids
materializing the full entity list at once.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adding a folder walked the tree with DocumentFile.listFiles(), which issues
a separate ContentResolver IPC for every file and for every attribute access
(name, isDirectory, lastModified). For folders with tens of thousands of
images this dominates the add/refresh time and risks ANRs.
Replace it with a single DocumentsContract cursor query per directory that
returns document id, name, mime type and last-modified in one round-trip, and
traverse directories iteratively to avoid deep-recursion stack overflow. The
album-view add path additionally dropped its per-file getFileName() and
detectMediaType() lookups by reusing the name returned from the scan.
Returned URIs are built from the same tree document id as before, so existing
wallpaper URIs remain stable. Both folder-scan call sites now share one helper.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two memory optimizations:
1. ImageDecoder FILL path: use setCrop() to crop to canvas during decode
instead of allocating the full fill-scale bitmap first. For a portrait
2000x3000 image on a 4032x2992 parallax canvas, this avoids a ~97MB
intermediate (4032x6048) — the output is directly 4032x2992 (~48MB).
2. BOTH mode: recycle the HOME bitmap before rendering the LOCK bitmap,
so they are never in memory simultaneously. Removes the fallback that
reused the HOME bitmap for LOCK (which kept it alive during LOCK
rendering). If LOCK rendering fails, the lock screen retains its
previous wallpaper rather than getting the oversized HOME bitmap.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In BOTH mode, the same HOME-sized bitmap (wide parallax canvas, e.g.
4032x2992) was reused for the lock screen via setBitmap(FLAG_LOCK).
The lock screen has no parallax, so Android center-cropped the wide
bitmap — defeating FIT/NONE modes which should letterbox, not crop.
Fix: after setting HOME, sync the LOCK queue, then re-render the same
wallpaper via reapplyEffectsUseCase(ScreenType.LOCK) at the physical
screen dimensions. Falls back to the old behavior if re-render fails.
Applied to both WallpaperChangeService and WallpaperChangeWorker.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>