Optim/optimize resource consumption#1037
Merged
theovilardo merged 2 commits intomasterfrom Feb 11, 2026
Merged
Conversation
- **Memory & Resource Management**:
- Implement bounded caches for `AiPlaylistGenerator`, and `LyricsRepositoryImpl` using `LinkedHashMap` to prevent unbounded growth and potential memory leaks.
- Explicitly nullify callbacks and providers in `AiStateHolder`'s `onCleared` method to break reference cycles.
- Add a comprehensive `onCleared` method to `CastTransferStateHolder` to cancel jobs, unregister listeners, and nullify callbacks, preventing memory leaks.
- Resolve a duplicate call to `listeningStatsTracker.onCleared()` and add a missing `castTransferStateHolder.onCleared()` in `PlayerViewModel`.
- Ensure `DualPlayerEngine` removes its listener and abandons audio focus upon release.
- Manage the `refreshRoutesJob` in `CastStateHolder` by canceling any existing job before starting a new one and on clear.
- **Performance & Bug Fixes**:
- **Music Repository**: Optimize `getSongsByIds` by directly querying the DAO with a list of IDs instead of loading all songs into memory for filtering. This significantly improves performance for large libraries.
- **Artist Image Prefetch**: Simplify the artist image prefetch logic by removing an unnecessary, manually-created coroutine scope.
- **Widget Updates**: Refactor `WidgetUpdateReceiver` to use `goAsync()` and a dedicated coroutine scope, ensuring long-running update operations don't get terminated by the system.
- **Sleep Timer**: Remove a redundant `delay`-based coroutine meant to clear UI state, as this is now handled more reliably by the `AlarmManager` broadcast.
- **Code Cleanup**:
- Simplify log messages in `LogUtils.kt` by removing method and line number details, making them cleaner.
- **Performance**:
- Add explicit `key` to `LazyColumn` and `LazyRow` items across multiple screens (`LibraryScreen`, `ArtistDetailScreen`, `QuickFillScreen`, `FetchLyricsDialog`, `ChangelogBottomSheet`) to improve list stability and recomposition performance.
- Implement `derivedStateOf` for `collapseFraction` in `ArtistDetailScreen` to minimize unnecessary recompositions during scroll.
- Optimized `AsyncImage` in `ArtistDetailScreen` by setting a fixed request size instead of `Size.ORIGINAL`.
- **UI/UX**:
- Add horizontal padding to the navigation icon in `QuickFillScreen` for better alignment.
- Clean up redundant `derivedStateOf` usage and unused imports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.