Dead code
- Remove the manual sort screen, unreachable since sorting moved into the
album screen, with its route, strings, reorder repository/DAO methods and
the reorderable dependency.
- Remove unused parameters, defaults, typography styles and constants.
UI
- Share the settings card, selectable grid card, wallpaper grid, back top
bar, album cover, snackbar effect and onboarding button instead of
keeping copies per screen; move shared pieces to common/components.
- HomeViewModel owns the duplicate album name rule and exposes only the
animate flag; WallpaperViewViewModel exposes its own route arguments.
- The wallpaper viewer title shows the decoded file name.
- The empty library uses the same empty state as albums and folders.
Data and services
- Keep document-provider scanning next to AndroidDocumentSource and return
SourceImage directly.
- Define preference keys where they are used; query the current wallpaper
once.
- Use runCatchingCancellable for the remaining hand-written rethrows.
Live wallpaper
- Draw the crossfade without the always-opaque alpha helper and drop
redundant program binds, guards and dead stores.
- Stop checking GL errors after deletes, which threw stale errors from
cleanup and leaked tiles.
- A crashed GL thread refuses queued events instead of holding them.
- Strip Log.d/Log.v in release via R8; remove the per-frame parallax log.
- Use runCatchingCancellable instead of manual cancellation rethrows.
- Remove an unreachable catch in AlbumViewViewModel.deleteSelected.
- Reduce AlbumRefreshWorker to the work itself; drop log-only counters.
- Replace a force-unwrap in HomeScreen with a local val.
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>