Bug 872890:Reset HFP call array when RIL reports NotifyError(), r=echou
authorShawn Huang <shuang@mozilla.com>
Sat, 01 Jun 2013 10:07:24 +0800
changeset 133799 bfae538a757d47446283d653429c3a8d253d70c1
parent 133798 6eac1d68757510c03c699f8a1d6f47f73b292a53
child 133800 8792c49874b82a94a14d6e9033a64329736059ae
push id28905
push userryanvm@gmail.com
push dateMon, 03 Jun 2013 15:58:12 +0000
treeherdermozilla-inbound@d2eabe8e27b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs872890
milestone24.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 872890:Reset HFP call array when RIL reports NotifyError(), r=echou
dom/bluetooth/BluetoothTelephonyListener.cpp
--- a/dom/bluetooth/BluetoothTelephonyListener.cpp
+++ b/dom/bluetooth/BluetoothTelephonyListener.cpp
@@ -62,16 +62,27 @@ TelephonyListener::EnumerateCallState(ui
   *aResult = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyListener::NotifyError(int32_t aCallIndex,
                                const nsAString& aError)
 {
+  BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
+  // In order to not miss any related call state transition.
+  // It's possible that 3G network signal lost for unknown reason.
+  // If a call is released abnormally, NotifyError() will be called,
+  // instead of CallStateChanged(). We need to reset the call array state
+  // via setting CALL_STATE_DISCONNECTED
+  hfp->HandleCallStateChanged(aCallIndex,
+                              nsITelephonyProvider::CALL_STATE_DISCONNECTED,
+                              EmptyString(), false, true);
+  NS_WARNING("Reset the call state due to call transition ends abnormally");
+  NS_WARNING(NS_ConvertUTF16toUTF8(aError).get());
   return NS_OK;
 }
 
 } // anonymous namespace
 
 BluetoothTelephonyListener::BluetoothTelephonyListener()
 {
   mTelephonyListener = new TelephonyListener();