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 196541 fd7b28405e87f46da5cfb3b8da16c4990c813ad7
parent 196540 c949331218cdb6d3e6c1f3bd79a1f5411d75ed72
child 196542 447914859ecd0122876c476c38813fd82d9bd081
push id27219
push userkwierso@gmail.com
push dateTue, 29 Jul 2014 23:42:32 +0000
treeherdermozilla-central@3b682051f3ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang
bugs1045461
milestone34.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 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();