Bug 1045461: Fix HFP fallback code to work with latest Bluetooth changes, r=shuang
authorThomas Zimmermann <tdz@users.sourceforge.net>
Tue, 29 Jul 2014 10:47:09 +0200
changeset 196526 fd7b28405e87f46da5cfb3b8da16c4990c813ad7
parent 196525 c949331218cdb6d3e6c1f3bd79a1f5411d75ed72
child 196527 447914859ecd0122876c476c38813fd82d9bd081
push id9269
push usertdz@users.sourceforge.net
push dateTue, 29 Jul 2014 15:33:45 +0000
treeherderb2g-inbound@447914859ecd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang
bugs1045461
milestone34.0a1
Bug 1045461: Fix HFP fallback code to work with latest Bluetooth changes, r=shuang Recent patches to Bluetooth introduced asynchronous initialization of profile manager. The code in hfp-fallback was not adapted then. This patch updates the broken code.
dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp
dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.h
--- a/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.cpp
@@ -143,38 +143,46 @@ BluetoothHfpManager::Init()
     return false;
   }
 
   return true;
 }
 
 // static
 void
-BluetoothHfpManager::InitHfpInterface()
+BluetoothHfpManager::InitHfpInterface(BluetoothProfileResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   /**
    * TODO:
    *   Implement InitHfpInterface() for applications that want to create SCO
    *   link without a HFP connection (e.g., VoIP).
    */
+
+  if (aRes) {
+    aRes->Init();
+  }
 }
 
 // static
 void
-BluetoothHfpManager::DeinitHfpInterface()
+BluetoothHfpManager::DeinitHfpInterface(BluetoothProfileResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   /**
    * TODO:
    *   Implement DeinitHfpInterface() for applications that want to create SCO
    *   link without a HFP connection (e.g., VoIP).
    */
+
+  if (aRes) {
+    aRes->Deinit();
+  }
 }
 
 void
 BluetoothHfpManager::HandleShutdown()
 {
   MOZ_ASSERT(NS_IsMainThread());
   sInShutdown = true;
   sBluetoothHfpManager = nullptr;
--- a/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.h
+++ b/dom/bluetooth/bluedroid/hfp-fallback/BluetoothHfpManager.h
@@ -25,18 +25,18 @@ public:
   BT_DECL_HFP_MGR_BASE
   virtual void GetName(nsACString& aName)
   {
     aName.AssignLiteral("Fallback HFP/HSP");
   }
 
   static BluetoothHfpManager* Get();
   virtual ~BluetoothHfpManager() { }
-  static void InitHfpInterface();
-  static void DeinitHfpInterface();
+  static void InitHfpInterface(BluetoothProfileResultHandler* aRes);
+  static void DeinitHfpInterface(BluetoothProfileResultHandler* aRes);
 
   bool ConnectSco();
   bool DisconnectSco();
 
 private:
   BluetoothHfpManager() { }
   bool Init();
   void HandleShutdown();