void FMRadio::Notify(const SwitchEvent& aEvent) { if (mHeadphoneState != aEvent.status()) { LOG("Antenna state is changed!"); mHeadphoneState = aEvent.status(); DispatchTrustedEvent(ANTENNA_STATE_CHANGED_EVENT_NAME); } }
void FMRadio::Notify(const SwitchEvent& aEvent) { MOZ_ASSERT(!mHasInternalAntenna); if (mHeadphoneState != aEvent.status()) { mHeadphoneState = aEvent.status(); DispatchTrustedEvent(NS_LITERAL_STRING("antennaavailablechange")); } }
void Notify(const SwitchEvent& aEvent) { NotifyHeadphonesStatus(aEvent.status()); // When user pulled out the headset, a delay of routing here can avoid the leakage of audio from speaker. if (aEvent.status() == SWITCH_STATE_OFF && sSwitchDone) { MessageLoop::current()->PostDelayedTask( FROM_HERE, NewRunnableFunction(&ProcessDelayedAudioRoute, SWITCH_STATE_OFF), 1000); sSwitchDone = false; } else if (aEvent.status() != SWITCH_STATE_OFF) { InternalSetAudioRoutes(aEvent.status()); sSwitchDone = true; } }
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; } DispatchTrustedEvent(NS_LITERAL_STRING("headphoneschange")); }
void Notify(const SwitchEvent& aEvent) { NotifyHeadphonesStatus(aEvent.status()); // When user pulled out the headset, a delay of routing here can avoid the leakage of audio from speaker. if (aEvent.status() == SWITCH_STATE_OFF && sSwitchDone) { MessageLoop::current()->PostDelayedTask( FROM_HERE, NewRunnableFunction(&ProcessDelayedAudioRoute, SWITCH_STATE_OFF), 1000); sSwitchDone = false; } else if (aEvent.status() != SWITCH_STATE_OFF) { InternalSetAudioRoutes(aEvent.status()); sSwitchDone = true; } // Handle the coexistence of a2dp / headset device, latest one wins. #if ANDROID_VERSION >= 17 int32_t forceUse = 0; mAudioManager->GetForceForUse(AUDIO_POLICY_FORCE_FOR_MEDIA, &forceUse); if (aEvent.status() != SWITCH_STATE_OFF && sBluetoothA2dpEnabled) { mAudioManager->SetForceForUse(AUDIO_POLICY_FORCE_FOR_MEDIA, AUDIO_POLICY_FORCE_NO_BT_A2DP); } else if (forceUse == AUDIO_POLICY_FORCE_NO_BT_A2DP) { mAudioManager->SetForceForUse(AUDIO_POLICY_FORCE_FOR_MEDIA, AUDIO_POLICY_FORCE_NONE); } #endif }
void Notify(const SwitchEvent& aEvent) { InternalSetAudioRoutes(aEvent.status()); NotifyHeadphonesStatus(aEvent.status()); }