User experience and companion features
Metrolist connects music discovery, playback, and shared listening across its Compose app and Android companion surfaces. People can browse music, build and control a queue, read lyrics, listen with others, use widgets, and identify nearby music without staying on one screen.
Experience model
Compose app shell
The Compose app shell gives the main music tasks a stable place in the app. Home, Search, Listen Together, and Library form the primary destinations, while detail screens let a person move from a result to an album, artist, playlist, or other music source. The app keeps the player available while these destinations change, so browsing and playback remain connected. See Compose navigation and screens.
The home experience combines personal and online discovery. It can show quick access, recent listening, recommendations, account playlists, community playlists, and mood or genre entry points. Selecting a song or collection changes the active playback queue rather than creating a separate playback experience.
The same browsing and playback actions use locale-specific labels. The supported locale resources cover destination names, library filters, queue actions, lyrics actions, account-aware browsing choices, and the newer account sign-in and sign-out labels.
References: app/…/Screens.kt• L13-50 app/…/NavigationBuilder.kt• L68-149 app/…/HomeScreen.kt• L177-204 app/…/strings.xml• L3-17 app/…/strings.xml• L3-17 app/…/strings.xml• L3-19 app/…/strings.xml• L3-18 app/…/strings.xml• L3-16 app/…/strings.xml• L3-18 app/…/strings.xml• L3-19 app/…/strings.xml• L3-18 app/…/strings.xml• L3-20 app/…/strings.xml• L3-17 app/…/strings.xml• L3-23 app/…/strings.xml• L3-17 app/…/strings.xml• L3-16 app/…/strings.xml• L3-16 app/…/strings.xml• L3-20
Browsing and playback entry
Browsing turns music choices into a queue that the shared player can use. A person can start one item, play a collection, start a radio-style continuation, or add an item to the current queue; the same player state then drives the in-app player and Android companion surfaces. Song actions also connect playback with library state through likes, saved episodes, downloads, playlists, sharing, and links to the related artist or album.
The main relationship is:
flowchart LR
A[Home, search, or detail screen] --> B[Music choice]
B --> C[Playback queue]
C --> D[Shared player state]
D --> E[In-app player]
D --> F[Widgets and system controls]
Listen Together changes this entry rule for guests. A guest can see the shared session but cannot make local playback changes that would conflict with the host.
References: app/…/HomeScreen.kt• L1837-1853 app/…/QueueMenu.kt• L180-251 app/…/QueueMenu.kt• L268-390 app/…/PlayerConnection.kt• L242-257 app/…/PlayerConnection.kt• L288-299
Player interaction
Playback surface
The player surface gives a person fast controls in a compact form and a full view for deeper control. The mini player stays near the app content and exposes the current track, progress, and common actions. Expanding it provides the queue, seek control, playback actions, sleep timer, download and library actions, sharing, and access to lyrics.
The full player can use album art, a blurred background, or a color gradient. It can also enter a full-screen lyrics view. In that view, the track thumbnail remains an active control: a local listener can play or pause, a guest can mute or unmute, and a cast session can play or pause its remote playback.
Playback state comes from one player connection. This keeps play state, current media, queue position, skip availability, seek position, and lyrics aligned as the person moves between the mini player, full player, widgets, casting, or a shared room. See Player presentation.
References: app/…/MiniPlayer.kt• L142-169 app/…/MiniPlayer.kt• L175-221 app/…/Player.kt• L207-410 app/…/Player.kt• L958-1051 app/…/Player.kt• L1660-1772 app/…/PlayerConnection.kt• L100-189
Queue interaction
The queue is the working list for the current listening session. It shows the active item, queue size and length, similar-content continuation, and controls for shuffle, repeat, and the sleep timer. A person can select several items, reorder them when queue editing is unlocked, remove items with undo, or open item actions for playback and library tasks.
Queue controls follow the listening role. The host or local listener can change order and playback mode, while a Listen Together guest can follow the shared queue without sending conflicting local changes.
References: app/…/Queue.kt• L145-257 app/…/Queue.kt• L657-743 app/…/Queue.kt• L772-945 app/…/Queue.kt• L1180-1257 app/…/QueueMenu.kt• L336-390
Lyrics experience
Lyrics are an optional part of the full player. The app finds lyrics from its enabled sources, stores the selected result with the current song, and presents timed or plain text with the track position. When timing data exists, the view can follow the active line; when it does not, it still presents readable text.
The lyrics view can also support romanization, translation, alternate display styles, offset changes, and sharing as text or an image. These options change how lyrics are read without changing the playback source. See Player presentation.
References: app/…/LyricsHelper.kt• L33-111 app/…/Lyrics.kt• L16-39 app/…/LyricsViewModel.kt• L31-83 app/…/ExperimentalLyrics.kt• L183-247 app/…/Player.kt• L1215-1298
Companion surfaces
Home-screen widgets
Widgets extend the current music session outside the app. The player widget shows the active track and basic playback controls, the turntable widget offers a visual alternate player surface, and the playlist widget offers quick picks from local and saved music. Widget actions return to the playback service or open the app when a full screen is needed.
Widget state follows the active track, play state, like state, artwork, and progress. The available layout changes with widget size, so a small placement keeps only the most useful action while a larger placement can show track details or quick picks. See Widgets and companion services.
References: app/…/MetrolistWidgetManager.kt• L52-121 app/…/MetrolistWidgetManager.kt• L151-228 app/…/PlaylistWidgetManager.kt• L86-175 app/…/AndroidManifest.xml• L290-337
Music recognition
Music recognition lets a person identify nearby music from the app, the recognizer widget, or other entry points. The flow records a short microphone sample, turns it into a music fingerprint, sends it for recognition, and shows a match, no-match result, or error. A successful match can lead to a search in Metrolist and can be kept in recognition history.
Recognition uses a foreground microphone service when it runs outside the normal screen. The widget mirrors the recognition state and lets the person start, stop, or open the related app screen. Microphone permission is a hard boundary: without it, the flow opens the permission path instead of starting capture.
flowchart LR
A[Recognition screen or widget] --> B{Microphone permission}
B -->|No| C[Permission flow]
B -->|Yes| D[Foreground recognition service]
D --> E[Audio sample]
E --> F[Recognition result]
F --> G[Match and history]
F --> H[No match or error]
References: app/…/MusicRecognitionService.kt• L60-75 app/…/MusicRecognitionService.kt• L78-154 app/…/RecognitionForegroundService.kt• L74-97 app/…/MusicRecognizerWidgetReceiver.kt• L93-134 app/…/RecognitionScreen.kt• L124-198
Synchronized listening
Shared listening rooms
Listen Together lets people create or join a room and share a playback session. The host controls the shared track, play state, seek position, queue, and related room actions; guests receive the shared state and remain restricted from conflicting local playback changes.
The room flow combines a connection, a room state, and a player state. It handles join approval, connected users, track suggestions, host changes, buffering, reconnects, and drift correction so each participant can follow the same session over time.
sequenceDiagram
participant Person
participant App as Compose app
participant Room as Shared room
participant Player
Person->>App: Create or join room
App->>Room: Connect and exchange room state
Room-->>App: Role, users, track, queue, position
App->>Player: Apply shared playback state
Person->>Player: Host playback action
Player->>Room: Publish track or playback change
Room-->>Player: Sync participants
The Listen Together screen exposes connection state, room membership, users, pending join requests, suggestions, and room controls. Its settings also determine whether the feature appears in the main app bar. See Compose navigation and screens.
References: app/…/ListenTogetherScreen.kt• L109-186 app/…/ListenTogetherScreen.kt• L280-417 app/…/ListenTogetherManager.kt• L63-73 app/…/Protocol.kt• L44-56
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the main destination list, navigation routes, and external intent handling aligned when adding or renaming a user-facing destination.
- Keep player state exposed by
PlayerConnectionaligned with the mini player, full player, widgets, cast controls, and Listen Together guest restrictions. - Keep full-screen lyrics thumbnail controls aligned with local playback, cast playback, and guest mute behavior.
- Keep queue editing, selection actions, undo behavior, and host or guest restrictions aligned across
QueueandQueueMenu. - Keep widget actions and their declared receiver intents aligned with the playback or recognition service actions.
- Keep recognition terminal states aligned across the recognition screen, foreground service, widget state, and recognition history persistence.
- Keep lyrics provider results, stored lyrics, timing data, player position, and translation or sharing actions aligned when changing lyrics sources or display behavior.
- Keep Listen Together playback actions and room state fields compatible between the client, manager, and shared protocol.
- Keep new or changed user-facing strings present across supported locale resources without changing the meaning of action labels.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A widget action does not reach the playback service | The widget appears interactive but playback does not change | Keep receiver actions, pending intents, manifest filters, and service actions in one contract |
| Recognition starts without microphone permission | Capture cannot start and the user sees a failed recognition path | Check permission before starting the microphone foreground service |
| A guest sends a local playback change | The guest can diverge from the shared room | Block guest playback changes while allowing internal sync actions |
| Full-screen lyrics controls use local state during casting | The displayed control does not match the remote player | Use cast play state and cast position while casting |
| Timed lyrics are treated as plain text | The display cannot follow the active line | Detect timed entries before building the lyrics list |
| A queue item is removed without a matching undo position | Undo restores the item in the wrong place or not at all | Preserve the removed item and its queue position until the undo window closes |
| A localized action string is missing or has the wrong meaning | An action is unclear or falls back to another locale | Keep resource keys and action meaning aligned across locale files |
| The playback service is not running during a widget refresh | The widget keeps its default or last known view | Refresh through the running service and show a safe idle state otherwise |
Key files
| File | Why to read it |
|---|---|
| app/…/MainActivity.kt | Shows how the Compose shell, player state, navigation, widgets, and external intents meet. |
| app/…/NavigationBuilder.kt | Maps user-facing routes to the main screens and companion entry screens. |
| app/…/HomeScreen.kt | Shows how browsing choices become playback queues. |
| app/…/PlayerConnection.kt | Defines the shared playback state used by the app and companion surfaces. |
| app/…/Player.kt | Shows the full player, lyrics mode, queue entry, casting behavior, and shared-listening controls. |
| app/…/Queue.kt | Shows queue editing, selection, shuffle, repeat, and role-based restrictions. |
| app/…/QueueMenu.kt | Shows song actions available from the active queue. |
| app/…/LyricsHelper.kt | Explains the user-facing lyrics lookup and fallback behavior. |
| app/…/MetrolistWidgetManager.kt | Shows how current playback becomes home-screen widget content. |
| app/…/MusicRecognizerWidgetReceiver.kt | Shows the recognizer widget states and entry actions. |
| app/…/RecognitionForegroundService.kt | Shows the background recognition lifecycle and result handoff. |
| app/…/ListenTogetherManager.kt | Shows how shared room events affect playback synchronization. |
| app/…/strings.xml | Defines the base user-facing labels for browsing, queue actions, playback, and lyrics. |
| app/…/strings.xml | Defines the locale-specific labels for destinations, browsing, playback actions, lyrics, and account-aware browsing. |