Start voice-based interactions from headsethook key

Implement the interception of long-press on keys that
 can be used to trigger voice-based interactions (here
 only HEADSETHOOK) only if the long-press hasn't been
 trapped by the foreground application:
 - if the key is not one that is used for voice input, handle
   the event as before.
 - if the key press wasn't long enough, simulate a delayed
   key press.
 - if long press is detected, send
   RecognizerIntent.ACTION_WEB_SEARCH. Long press duration
   is set to 300ms (a typical key press is under 100ms).

Bug 3225090

Change-Id: I5b3adeb91d3c41ccd54d23fdb93d7eaec496eee7
1 file changed