home-assistant / home-assistant/android

Media notification shows "This phone" instead of the media player name

Open
#7,483 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
3.9k
Forks
1.1k
Avg merge
1d 12h
Merged PRs (30d)
81

Description

### Description

When a Home Assistant media player is shown in the notification shade https://github.com/home-assistant/android/pull/6626, the output switcher chip in the top right says "This phone". It should say which media player is actually playing, for example "Living Room TV".

Image

The controls themselves work. Only the label is wrong.

## Why

SystemUI names that chip from a routing session id. We build our player state with `DeviceInfo.PLAYBACK_TYPE_REMOTE` but no `routingControllerId` (`HaRemoteMediaPlayer.REMOTE_DEVICE_INFO`), so there is no session to name and SystemUI falls back to the phone.

Media3 passes that id straight through to the platform: `MediaSessionLegacyStub` -> `VolumeProviderCompat` -> `VolumeProvider(..., controlId)`.

## Why we can't just set it

`routingControllerId` has to be a real `MediaRouter2.RoutingController` id. A made up string would point at nothing, and the platform also uses that id for the volume slider, so it could break volume control.

## What would fix it

Publish the configured media players to the system as routes, with a `MediaRoute2ProviderService`, and play through them. That is how Cast gets the device name in that chip.

Bonus: it would also let users pick a Home Assistant media player from the output switcher of other apps.

## Notes

- Needs checking this investigation has been made by Claude while looking at the sources.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing HaRemoteMediaPlayer.REMOTE_DEVICE_INFO through MediaSessionLegacyStub and VolumeProviderCompat, then read the MediaRoute2ProviderService requirements. Implement route publication for configured media players using real routing controller IDs. Done means the notification output switcher shows the active player name, other apps can select the routes, and existing volume controls still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.