Bug 889730 - Switch states of Headphone are not only On/Off but Headset/Headphone. r=baku

This commit is contained in:
Marco Chen 2013-07-17 14:21:00 +08:00
Родитель 54595a2f9d
Коммит df04ea4684
2 изменённых файлов: 3 добавлений и 8 удалений

Просмотреть файл

@ -41,13 +41,7 @@ AudioChannelManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
void
AudioChannelManager::Notify(const SwitchEvent& aEvent)
{
if (aEvent.status() == SWITCH_STATE_ON ||
aEvent.status() == SWITCH_STATE_HEADSET ||
aEvent.status() == SWITCH_STATE_HEADPHONE) {
mState = SWITCH_STATE_ON;
} else {
mState = SWITCH_STATE_OFF;
}
mState = aEvent.status();
DispatchTrustedEvent(NS_LITERAL_STRING("headphoneschange"));
}

Просмотреть файл

@ -43,7 +43,8 @@ public:
bool Headphones() const
{
return mState == hal::SWITCH_STATE_ON;
MOZ_ASSERT(mState != hal::SWITCH_STATE_UNKNOWN);
return mState != hal::SWITCH_STATE_OFF;
}
IMPL_EVENT_HANDLER(headphoneschange)