Bug 1203046 - Call |NRECNotification| once RFCOMM is connected. r=shuang
authorWill Wang <wiwang@mozilla.com>
Tue, 15 Sep 2015 18:19:25 +0800
changeset 295189 d20763c242e8a42e0f993c2d6016d4d442d1d8c7
parent 295188 0634d9d4ab5dcdbe4790dedaaa0deabc4267ef65
child 295190 801236c3b685831d1fd6add4c5d89a34e438ea4e
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang
bugs1203046
milestone43.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 1203046 - Call |NRECNotification| once RFCOMM is connected. r=shuang
dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
--- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
@@ -1394,19 +1394,17 @@ BluetoothHfpManager::ConnectionStateNoti
 
   } else if (aState == HFP_CONNECTION_STATE_DISCONNECTED) {
     DisconnectSco();
     NotifyConnectionStateChanged(
       NS_LITERAL_STRING(BLUETOOTH_HFP_STATUS_CHANGED_ID));
 
   } else if (aState == HFP_CONNECTION_STATE_CONNECTED) {
     // Once RFCOMM is connected, enable NREC before each new SLC connection
-    mNrecEnabled = HFP_NREC_STARTED;
-    NotifyConnectionStateChanged(
-      NS_LITERAL_STRING(BLUETOOTH_HFP_NREC_STATUS_CHANGED_ID));
+    NRECNotification(HFP_NREC_STARTED, mDeviceAddress);
   }
 }
 
 void
 BluetoothHfpManager::AudioStateNotification(
   BluetoothHandsfreeAudioState aState, const nsAString& aBdAddress)
 {
   MOZ_ASSERT(NS_IsMainThread());
@@ -1473,27 +1471,32 @@ BluetoothHfpManager::DtmfNotification(ch
 
   NS_ENSURE_TRUE_VOID(IsValidDtmf(aDtmf));
 
   nsAutoCString message("VTS=");
   message += aDtmf;
   NotifyDialer(NS_ConvertUTF8toUTF16(message));
 }
 
+/**
+ * NREC status will be set when:
+ * 1. Get an AT command from HF device.
+ *    (Bluetooth HFP spec v1.6 merely defines for the "Disable" part.)
+ * 2. Once RFCOMM is connected, enable NREC before each new SLC connection.
+ */
 void
 BluetoothHfpManager::NRECNotification(BluetoothHandsfreeNRECState aNrec,
                                       const nsAString& aBdAddr)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   // Notify Gecko observers
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   NS_ENSURE_TRUE_VOID(obs);
 
-  // Set NREC status once getting AT command
   mNrecEnabled = static_cast<bool>(aNrec);
 
   // Notify audio manager
   if (NS_FAILED(obs->NotifyObservers(this,
                                      BLUETOOTH_HFP_NREC_STATUS_CHANGED_ID,
                                      mDeviceAddress.get()))) {
     BT_WARNING("Failed to notify bluetooth-hfp-nrec-status-changed observsers!");
   }