Send long-press of KEYCODE_HEADSETHOOK to the media key listener

For the key events with the code KEYCODE_HEADSETHOOK, the
MediaSessionService always starts the voice input for long-presses
regardless of the media key listener, and only short-presses can be sent
to the media key listener.

This CL sends all media key events to the media key listener first
if the listener is set. If the key event isn't consumed, short-presses
will be sent to the media session and long-presses will start the voice
input.

Bug: 35348856
Test: Manual test (Install the OnMediaKeyListener test app and confirm
that the app can consume the media key long-press)
Change-Id: I82f8e5f355efe16867e6f4345c46470c690e1f80
2 files changed