author | Marco Chen <mchen@mozilla.com> |
Mon, 04 Feb 2013 11:23:06 +0800 | |
changeset 120742 | e0cdaff13f73db91c6613f74123f04d14212e4c4 |
parent 120741 | 3d2d50b222e927e45e8420e5481e54df4818912f |
child 120743 | 01361f5fda963e3dbc2f58366450d6f728ba837e |
push id | 22389 |
push user | amarchesini@mozilla.com |
push date | Mon, 04 Feb 2013 12:37:44 +0000 |
treeherder | mozilla-inbound@e0cdaff13f73 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | baku, tef |
bugs | 834200 |
milestone | 21.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -303,30 +303,34 @@ AudioManager::SetPhoneState(int32_t aSta } if (AudioSystem::setPhoneState(aState)) { return NS_ERROR_FAILURE; } mPhoneState = aState; - if (aState == PHONE_STATE_IN_CALL) { - if (!mPhoneAudioAgent) { - mPhoneAudioAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1"); - MOZ_ASSERT(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); - } - } else if (mPhoneAudioAgent) { - mPhoneAudioAgent->StopPlaying(); - mPhoneAudioAgent = nullptr; + // Telephony can always play. + bool canPlay; + mPhoneAudioAgent->StartPlaying(&canPlay); } return NS_OK; } // // Kids, don't try this at home. We want this to link and work on // both GB and ICS. Problem is, the symbol exported by audioflinger