зеркало из https://github.com/mozilla/gecko-dev.git
Bug 834200 - [Audio] Hook AudioManager::SetPhoneState for getting ring & in_call then register into AudioChannelService. r=baku, a=tef+
This commit is contained in:
Родитель
de6a8e9191
Коммит
2aa2cbcc4e
|
@ -306,22 +306,26 @@ AudioManager::SetPhoneState(int32_t aState)
|
|||
|
||||
mPhoneState = aState;
|
||||
|
||||
if (aState == PHONE_STATE_IN_CALL) {
|
||||
if (!mPhoneAudioAgent) {
|
||||
mPhoneAudioAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1");
|
||||
MOZ_ASSERT(mPhoneAudioAgent);
|
||||
// Telephony doesn't be paused by any other channels.
|
||||
mPhoneAudioAgent->Init(AUDIO_CHANNEL_TELEPHONY, nullptr);
|
||||
|
||||
// Telephony can always play.
|
||||
bool canPlay;
|
||||
mPhoneAudioAgent->StartPlaying(&canPlay);
|
||||
}
|
||||
} else if (mPhoneAudioAgent) {
|
||||
if (mPhoneAudioAgent) {
|
||||
mPhoneAudioAgent->StopPlaying();
|
||||
mPhoneAudioAgent = nullptr;
|
||||
}
|
||||
|
||||
if (aState == PHONE_STATE_IN_CALL || aState == PHONE_STATE_RINGTONE) {
|
||||
mPhoneAudioAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1");
|
||||
MOZ_ASSERT(mPhoneAudioAgent);
|
||||
if (aState == PHONE_STATE_IN_CALL) {
|
||||
// Telephony doesn't be paused by any other channels.
|
||||
mPhoneAudioAgent->Init(AUDIO_CHANNEL_TELEPHONY, nullptr);
|
||||
} else {
|
||||
mPhoneAudioAgent->Init(AUDIO_CHANNEL_RINGER, nullptr);
|
||||
}
|
||||
|
||||
// Telephony can always play.
|
||||
bool canPlay;
|
||||
mPhoneAudioAgent->StartPlaying(&canPlay);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче