Skip to content

Enable seeking via Android Auto steering wheel controls

Description

This MR updates MediaSessionCallback to handle long press events which are currently not handled directly by Android Auto. In theory, the onRewind() and onFastForward() methods have been implemented, and it would be ideal if the system invoked those methods upon receipt of a long key press; however, no such support has been built into the system.

Instead of invoking the previous()/next() methods on the key down event, this MR inverts the behavior and invokes those methods on the key up event after a short key press is received. This works only in car mode, as the same events are not generated by the media control UI--it only generates key down events, with no corresponding key up events. When a long key press is received, the fast forward/rewind methods are invoked, and a flag is set to ignore the key up event.

Motivation and Context

It is useful to quickly fast forward or rewind using either the steering wheel or android auto bezel buttons (hard keys).

How Has This Been Tested?

Tested on Android Auto Head Unit. Does not appear to be testable on the emulator.

Screenshots / GIFs (if appropriate):

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING section of the README document.

Merge request reports