Bug 834554 - Support Bluetooth AVRCP 1.0, r=fabrice

This commit is contained in:
Gina Yeh 2013-06-14 11:58:09 +08:00
parent c557365d57
commit 0feb8904a1

View File

@ -379,8 +379,27 @@ var shell = {
case evt.DOM_VK_F1: // headset button
type = 'headset-button';
break;
default: // Anything else is a real key
return; // Don't filter it at all; let it propagate to Gaia
}
let mediaKeys = {
'MediaNextTrack': 'media-next-track-button',
'MediaPreviousTrack': 'media-previous-track-button',
'MediaPause': 'media-pause-button',
'MediaPlay': 'media-play-button',
'MediaPlayPause': 'media-play-pause-button',
'MediaStop': 'media-stop-button',
'MediaRewind': 'media-rewind-button',
'FastFwd': 'media-fast-forward-button'
};
let isMediaKey = false;
if (mediaKeys[evt.key]) {
isMediaKey = true;
type = mediaKeys[evt.key];
}
if (!type) {
return;
}
// If we didn't return, then the key event represents a hardware key
@ -408,6 +427,12 @@ var shell = {
return;
}
if (isMediaKey) {
this.lastHardwareButtonEventType = type;
gSystemMessenger.broadcastMessage('media-button', type);
return;
}
// On my device, the physical hardware buttons (sleep and volume)
// send multiple events (press press release release), but the
// soft home button just sends one. This hack is to manually