feat: handle Google Assistant voice queries (Android Auto voice commands) - #868
feat: handle Google Assistant voice queries (Android Auto voice commands)#868sinful1992 wants to merge 4 commits into
Conversation
Voice requests ("Hey Google, play <artist/album/song> on Tempus")
arrive as a media item carrying only requestMetadata.searchQuery, which
was never read: the queue resolver fell through to session-metadata
lookup, found nothing playable, and playback silently did nothing.
Resolve the spoken query against the server instead: an exact artist
match starts a self-extending instant mix, an exact album match plays
the album, anything else queues the matching songs, and an empty query
("play some music") shuffles random songs like the Random browse node.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughVoice-query requests with blank media IDs now use a dedicated resolver that searches album and artist results, supports random playback for empty queries, and returns artist mixes, album tracks, or playable matches. ChangesVoice Query Resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MediaLibrarySessionCallback
participant resolveVoiceQuery
participant automotiveRepository
participant MediaServiceExtensionRegistry
MediaLibrarySessionCallback->>resolveVoiceQuery: pass trimmed search query
resolveVoiceQuery->>automotiveRepository: search album and artist results
automotiveRepository-->>resolveVoiceQuery: return library results
resolveVoiceQuery->>MediaServiceExtensionRegistry: set TracksChangedExtension handler for artist match
resolveVoiceQuery-->>MediaLibrarySessionCallback: return resolved media items
🚥 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
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/service/MediaLibraryServiceCallback.kt`:
- Around line 286-289: Wrap the empty-query
`getRandomSongs(ConstantsAA.MAX_SHUFFLE_ITEMS)` flow in the same
`Futures.catching` error-handling pattern used by the non-empty query path,
returning an empty item list when resolution fails while preserving the existing
successful `toItemList` behavior.
🪄 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: 79cb66b8-22dc-4f2e-be40-11cb53ba8522
📒 Files selected for processing (1)
app/src/tempus/java/com/cappielloantonio/tempo/service/MediaLibraryServiceCallback.kt
A voice query that does not exactly match any artist or album title (e.g. a misheard artist name) previously fell through to the playable-songs filter; when the search returned only browsable artist/album entries the resolved queue was empty, so the Assistant announced playback but nothing played. Now, when there is no exact match and no playable song results, the first artist (or album) returned by the server search is used instead.
|
My comment to the PR #877 would be more appropriate here: #877 (comment) |
Voice queries that resolve to an artist now size the mix from the artist's library (small/medium/large tiers) like the browse path, instead of a hardcoded medium mix. Artists that don't qualify for a mix (fewer than two albums or too few tracks) fall back to queueing one of their albums in random order instead of entering the mix builder.
|
Implemented in e9031e3. One clarification first: the voice path was already going through the same deferred process as browse — it called
Implementation-wise there's a new |
|
I think this solves #603. |
What
Voice requests — "Hey Google, play <artist/album/song> on Tempus" — arrive as a media item carrying only
requestMetadata.searchQuery. That field was never read anywhere: the queue resolver fell through to session-metadata lookup, found nothing playable, and playback silently did nothing. Voice control is arguably the most important interaction while driving, so this makes it work:Matching is done against the server via the existing
search3repository call; no new endpoints or settings.Notes
mediaId, so taps on regular browse/search results are unaffected.Testing
assembleDebugbuilds clean.Summary by CodeRabbit