feat: add Downloads section for offline playback in Android Auto#862
Open
sinful1992 wants to merge 2 commits into
Open
feat: add Downloads section for offline playback in Android Auto#862sinful1992 wants to merge 2 commits into
sinful1992 wants to merge 2 commits into
Conversation
Contributor
📝 WalkthroughWalkthroughAdds a downloaded songs section to the Android Auto media hierarchy, backed by locally stored downloads and rendered with a new identifier and icon. ChangesDownloaded songs in Android Auto
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AndroidAuto
participant MediaBrowserTree
participant AutomotiveRepository
participant downloadDao
AndroidAuto->>MediaBrowserTree: Request downloaded section
MediaBrowserTree->>AutomotiveRepository: getDownloadedSongs()
AutomotiveRepository->>downloadDao: getAllSync()
downloadDao-->>AutomotiveRepository: Download records
AutomotiveRepository-->>MediaBrowserTree: LibraryResult with MediaItems
MediaBrowserTree-->>AndroidAuto: Downloaded songs
Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java`:
- Around line 375-391: Wrap the background thread body in the
AutomotiveRepository flow that loads downloads and builds mediaItems in a
try-catch, including getAllSync, setChildrenMetadata, and
MappingUtil.mapMediaItems. On any exception, always resolve listenableFuture
with the appropriate error result instead of leaving it pending; preserve the
existing successful and empty-list results.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 478c993f-735d-43dc-b761-31b49ae0f665
📒 Files selected for processing (4)
app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.javaapp/src/tempus/java/com/cappielloantonio/tempo/service/MediaBrowserTree.ktapp/src/tempus/java/com/cappielloantonio/tempo/util/ConstantsAA.ktapp/src/tempus/res/drawable/ic_aa_downloaded.xml
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.
What
Adds a Downloads section to the Android Auto browse tree, served entirely from the local Room
downloadtable - zero network calls - so downloaded music is browsable and playable in the car even with no connectivity at all.[downloadedID]node, placed as the first child of Home/More (it is the only section that works with no connectivity).AutomotiveRepository.getDownloadedSongs()readsDownloadDao.getAllSync()on a background thread and maps through the existingMappingUtil.mapMediaItems(..., QUEUE_CACHED_SOURCE)path - the same mapping the rest of AA uses.MappingUtil.getUri()already resolves downloaded songs to their local file, so items play fully offline.download_title_sectionstring; adds one AA icon drawable.Why
MediaBrowserTreepreviously built every section from server requests, so in a dead zone or tunnel Android Auto showed nothing playable even with gigabytes of downloaded music on the phone. Driving is exactly where connectivity is least reliable. Related pain points: #810, #811. Refs #860.Testing
assembleTempusDebuglocally.Summary by CodeRabbit