Bug 929139 - Remove assert check for impossible unknow state because some devices (ex: emulator) may not have sys node for headset switch state. r=dougt
authorMarco Chen <mchen@mozilla.com>
Fri, 25 Oct 2013 14:03:27 +0800
changeset 167155 7b130ccf80f4b381c6bfda8656d280060602f4b2
parent 167154 fcf4875ad29eafff9b9e9c057c2ea07a1f01df23
child 167156 5a3d9f7a528ed7d1db7898207da61897680d50a8
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt
bugs929139
milestone27.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
Bug 929139 - Remove assert check for impossible unknow state because some devices (ex: emulator) may not have sys node for headset switch state. r=dougt
dom/system/gonk/AudioChannelManager.h
--- a/dom/system/gonk/AudioChannelManager.h
+++ b/dom/system/gonk/AudioChannelManager.h
@@ -44,18 +44,22 @@ public:
      return GetOwner();
   }
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   bool Headphones() const
   {
-    MOZ_ASSERT(mState != hal::SWITCH_STATE_UNKNOWN);
-    return mState != hal::SWITCH_STATE_OFF;
+    // Bug 929139 - Remove the assert check for SWITCH_STATE_UNKNOWN.
+    // If any devices (ex: emulator) didn't have the corresponding sys node for
+    // headset switch state then GonkSwitch will report the unknown state.
+    // So it is possible to get unknown state here.
+    return mState != hal::SWITCH_STATE_OFF &&
+           mState != hal::SWITCH_STATE_UNKNOWN;
   }
 
   bool SetVolumeControlChannel(const nsAString& aChannel);
 
   bool GetVolumeControlChannel(nsAString& aChannel);
 
   IMPL_EVENT_HANDLER(headphoneschange)