Automatically register the existing media button receiver on API 21+

On devices running API 21 or later, developers are required to call
MediaSession.setMediaButtonReceiver to revive their playback service on
the media button press. As of today, only a small number of media apps
currently call this method properly where many popular music streaming
apps never use the API. This leads to the very problem where we pick a
wrong music app on the media button press, as it's the only app that
sets the button receiver in the right way although it's not the lastly
played one.

This change automatically registers the existing media button receiver
in the MediaSessionCompat constructor, removing the need to call
setMediaButtonReceiver explicitly.

Bug: 34253301
Test: Manual
Change-Id: Ic202975e2a52892f81184410547d99800893b7a2
1 file changed