Skip to content
Commit 8907455e authored by Oliver Woodman's avatar Oliver Woodman
Browse files

Fix SysUI volume controls not appearing

SysUI listens to volume change events to trigger showing its
volume control overlay UI. Normally when a hardware volume
key is pressed, a volume (either locally or for a session
corresponding to a remote playback) is changed, SysUI receives
an event and the UI is displayed.

In the case that a remote session doesn't allow volume
adjustment, the key event is still routed to the session if
that session is top of the stack. However, since the volume is
not adjusted and an event is not dispatched, the SysUI volume
control overlay doesn't appear. To the user it seems like the
volume hardware key is broken, neither adjusting a volume or
displaying the volume control overlay UI.

This change fires volume change events for sessions that
don't support actually changing the volume, to ensure that
the SysUI is still displayed. It also seems more consistent,
since there are other existing cases where the volume doesn't
actually change for which an event is still fired (e.g.,
adjusting up when already at max volume).

An alternative would be to change MediaSessionRecord's
canHandleVolumeKey to return false for sessions that don't
support volume adjustment, which would mean the key event
would be handled by the next session in the stack (or, in
most cases, to make a local volume adjustment). This is likely
more confusing, since the user will generally expect the top
session to be adjusted (surfacing that it could not is less
confusing than just adjusting some other volume instead).

Bug: 197586676
Bug: 202500642
Test: manual
Change-Id: Ic44b48bb5605699b476af05407b90f2be5d70cd3
parent f68e7fb4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment