From 50aa8610a36a3ed5e786a76d9ffa626bed7541b7 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Thu, 6 Sep 2012 13:47:58 -0700 Subject: [PATCH] Bug 782289 - Forward headphone status changed notification from gonk to chrome. r=philikon The wrong patch was applied previously. This changeset rolls back the previous change and applies the correct one. --- b2g/chrome/content/shell.js | 4 ++-- dom/system/gonk/AudioManager.cpp | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index 2c8ff687a82..42cbdd6238d 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -709,10 +709,10 @@ window.addEventListener('ContentStart', function ss_onContentStart() { (function headphonesStatusTracker() { Services.obs.addObserver(function(aSubject, aTopic, aData) { shell.sendChromeEvent({ - type: 'headphones-status', + type: 'headphones-status-changed', state: aData }); -}, "headphones-status", false); +}, "headphones-status-changed", false); })(); (function recordingStatusTracker() { diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index 70d5d40da7f..6db2163bf31 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -18,8 +18,6 @@ #include "mozilla/Hal.h" #include "AudioManager.h" #include "gonk/AudioSystem.h" -#include "nsIObserverService.h" -#include "mozilla/Services.h" using namespace mozilla::dom::gonk; using namespace android; @@ -55,27 +53,11 @@ InternalSetAudioRoutes(SwitchState aState) } } -static void -NotifyHeadphonesStatus(SwitchState aState) -{ - nsCOMPtr obs = mozilla::services::GetObserverService(); - if (obs) { - if (aState == SWITCH_STATE_ON) { - obs->NotifyObservers(nullptr, "headphones-status", NS_LITERAL_STRING("on").get()); - } else if (aState == SWITCH_STATE_OFF) { - obs->NotifyObservers(nullptr, "headphones-status", NS_LITERAL_STRING("off").get()); - } else { - obs->NotifyObservers(nullptr, "headphones-status", NS_LITERAL_STRING("unknown").get()); - } - } -} - class HeadphoneSwitchObserver : public SwitchObserver { public: void Notify(const SwitchEvent& aEvent) { InternalSetAudioRoutes(aEvent.status()); - NotifyHeadphonesStatus(aEvent.status()); } };