Commit 9aaea1f8 authored by Alastor Wu's avatar Alastor Wu
Browse files

Bug 1187195 - Remove all agents with null window. r=baku

parent ddd1dd82
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -676,32 +676,6 @@ AudioManager::SetPhoneState(int32_t aState)
  }

  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;
}

+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include "nsAutoPtr.h"
#include "nsIAudioManager.h"
#include "nsIObserver.h"
#include "AudioChannelAgent.h"
#include "android_audio/AudioSystem.h"

// {b2b51423-502d-4d77-89b3-7786b562b084}
@@ -107,7 +106,6 @@ protected:

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.