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-16 16:30:41 +08:00
parent ac61c92192
commit 39359ecf3a
2 changed files with 3 additions and 8 deletions

View File

@ -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"));
}

View File

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