Bug 1187195 - Remove all agents with null window. r=baku
authorAlastor Wu <alwu@mozilla.com>
Fri, 24 Jul 2015 12:29:26 +0800
changeset 254757 8bb069f2ec5f85162d98506f35cf464380a4736f
parent 254756 69d0fee7d878518927a2c3c3ea48b8f74dd97523
child 254758 45f4511509749d1b90a2e4e9ea3936ef1e275278
push id14250
push userryanvm@gmail.com
push dateMon, 27 Jul 2015 19:44:33 +0000
treeherderfx-team@7d5d2d96f19b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1187195
milestone42.0a1
Bug 1187195 - Remove all agents with null window. r=baku
dom/system/gonk/AudioManager.cpp
dom/system/gonk/AudioManager.h
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -671,42 +671,16 @@ AudioManager::SetPhoneState(int32_t aSta
   if (AudioSystem::setPhoneState(aState)) {
 #else
   if (AudioSystem::setPhoneState(static_cast<audio_mode_t>(aState))) {
 #endif
     return NS_ERROR_FAILURE;
   }
 
   mPhoneState = aState;
-
-  if (mPhoneAudioAgent) {
-    mPhoneAudioAgent->NotifyStoppedPlaying();
-    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(nullptr, (int32_t)AudioChannel::Telephony, nullptr);
-    } else {
-      mPhoneAudioAgent->Init(nullptr, (int32_t)AudioChannel::Ringer, nullptr);
-    }
-
-    // Telephony can always play.
-    float volume = 0.0;
-    bool muted = true;
-
-    nsresult rv = mPhoneAudioAgent->NotifyStartedPlaying(&volume, &muted);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-  }
-
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AudioManager::SetForceForUse(int32_t aUsage, int32_t aForce)
 {
   if (static_cast<
              status_t (*)(audio_policy_force_use_t, audio_policy_forced_cfg_t)
--- a/dom/system/gonk/AudioManager.h
+++ b/dom/system/gonk/AudioManager.h
@@ -15,17 +15,16 @@
 
 #ifndef mozilla_dom_system_b2g_audiomanager_h__
 #define mozilla_dom_system_b2g_audiomanager_h__
 
 #include "mozilla/Observer.h"
 #include "nsAutoPtr.h"
 #include "nsIAudioManager.h"
 #include "nsIObserver.h"
-#include "AudioChannelAgent.h"
 #include "android_audio/AudioSystem.h"
 
 // {b2b51423-502d-4d77-89b3-7786b562b084}
 #define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \
       {0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}}
 #define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
 
 namespace mozilla {
@@ -102,17 +101,16 @@ protected:
   int32_t mPhoneState;
   uint32_t mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT];
 
   nsresult SetStreamVolumeIndex(int32_t aStream, uint32_t aIndex);
   nsresult GetStreamVolumeIndex(int32_t aStream, uint32_t *aIndex);
 
 private:
   nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
-  nsCOMPtr<nsIAudioChannelAgent>          mPhoneAudioAgent;
 #ifdef MOZ_B2G_RIL
   bool                                    mMuteCallToRIL;
   // mIsMicMuted is only used for toggling mute call to RIL.
   bool                                    mIsMicMuted;
 #endif
   nsTArray<nsAutoPtr<AudioProfileData>>   mAudioProfiles;
   AudioOutputProfiles mPresentProfile;