Bug 796733 - Re-order the calling sequence of disable FM radio and change audio state. r=mwu, a=blocking-basecamp
authorSteven Lee <slee@mozilla.com>
Thu, 11 Oct 2012 21:31:39 -0400
changeset 113339 70984805f3ecf5131441a627ddf1968d2618c18c
parent 113338 690a3827c4658ce4f119567621bee6bd78464323
child 113340 e9e79d0ed99550eeb2e190f87d70676bfb888cf1
push id2292
push userryanvm@gmail.com
push dateSat, 13 Oct 2012 19:19:53 +0000
treeherdermozilla-aurora@c0b49817915d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu, blocking-basecamp
bugs796733
milestone18.0a2
Bug 796733 - Re-order the calling sequence of disable FM radio and change audio state. r=mwu, a=blocking-basecamp
dom/fm/FMRadio.cpp
--- a/dom/fm/FMRadio.cpp
+++ b/dom/fm/FMRadio.cpp
@@ -139,24 +139,26 @@ NS_IMETHODIMP FMRadio::Enable(nsIFMRadio
   audioManager->SetFmRadioAudioEnabled(true);
 
   return NS_OK;
 }
 
 /* void disableRadio (); */
 NS_IMETHODIMP FMRadio::Disable()
 {
+  // Fix Bug 796733. 
+  // DisableFMRadio should be called before SetFmRadioAudioEnabled to prevent
+  // the annoying beep sound.
+  DisableFMRadio();
+  
   nsCOMPtr<nsIAudioManager> audioManager =
     do_GetService(NS_AUDIOMANAGER_CONTRACTID);
   NS_ENSURE_TRUE(audioManager, NS_OK);
 
   audioManager->SetFmRadioAudioEnabled(false);
-
-  DisableFMRadio();
-
   return NS_OK;
 }
 
 /* void cancelSeek */
 NS_IMETHODIMP FMRadio::CancelSeek()
 {
   CancelFMRadioSeek();
   return NS_OK;