Skip to content

feat: add Downloads section for offline playback in Android Auto#862

Open
sinful1992 wants to merge 2 commits into
eddyizm:developmentfrom
sinful1992:feat/aa-downloads
Open

feat: add Downloads section for offline playback in Android Auto#862
sinful1992 wants to merge 2 commits into
eddyizm:developmentfrom
sinful1992:feat/aa-downloads

Conversation

@sinful1992

@sinful1992 sinful1992 commented Jul 11, 2026

Copy link
Copy Markdown

What

Adds a Downloads section to the Android Auto browse tree, served entirely from the local Room download table - zero network calls - so downloaded music is browsable and playable in the car even with no connectivity at all.

  • New [downloadedID] node, placed as the first child of Home/More (it is the only section that works with no connectivity).
  • AutomotiveRepository.getDownloadedSongs() reads DownloadDao.getAllSync() on a background thread and maps through the existing MappingUtil.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.
  • Queue behavior on tap matches Starred tracks (cached-source queue resolution).
  • Reuses the existing translated download_title_section string; adds one AA icon drawable.

Why

MediaBrowserTree previously 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

  • Built assembleTempusDebug locally.
  • Tempus flavor only (the degoogled flavor has no AA browse tree).

Summary by CodeRabbit

  • New Features
    • Added a Downloaded section to the Android Auto media browsing experience.
    • Downloaded content is now shown directly in the hierarchy (with results limited to the app’s supported maximum).
    • Included a dedicated Downloaded icon for clearer navigation.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a downloaded songs section to the Android Auto media hierarchy, backed by locally stored downloads and rendered with a new identifier and icon.

Changes

Downloaded songs in Android Auto

Layer / File(s) Summary
Downloaded song retrieval
app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java
Adds getDownloadedSongs(), which asynchronously reads downloaded records, limits the result, maps them to MediaItem instances, and returns a LibraryResult.
Android Auto downloaded section
app/src/tempus/java/com/cappielloantonio/tempo/service/MediaBrowserTree.kt, app/src/tempus/java/com/cappielloantonio/tempo/util/ConstantsAA.kt, app/src/tempus/res/drawable/ic_aa_downloaded.xml
Registers the downloaded section under the Android Auto home node, routes child requests to the repository, and adds its identifier and artwork.

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
Loading

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Downloads section for offline playback in Android Auto.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3fe7074 and 62a6876.

📒 Files selected for processing (4)
  • app/src/tempus/java/com/cappielloantonio/tempo/repository/AutomotiveRepository.java
  • app/src/tempus/java/com/cappielloantonio/tempo/service/MediaBrowserTree.kt
  • app/src/tempus/java/com/cappielloantonio/tempo/util/ConstantsAA.kt
  • app/src/tempus/res/drawable/ic_aa_downloaded.xml

@eddyizm eddyizm changed the base branch from main to development July 12, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant