OSDN Git Service

Revert "Remove A2DP Source/Sink startup calls during A2DP initialization"
authorAndre Eisenbach <eisenbach@google.com>
Wed, 21 Feb 2018 02:38:52 +0000 (02:38 +0000)
committerandroid-build-team Robot <android-build-team-robot@google.com>
Wed, 21 Feb 2018 20:00:30 +0000 (20:00 +0000)
This reverts commit 83255478b0457f291d6a78795444ff3b895d4a90.

Reason for revert:
Prevents audio routing due to stale active device record if
Bluetooth is toggled without the process stopping completely
(ex. LE-only mode).

Bug: 72701090
Change-Id: Ifa798e63df14855b5bf0bd45e1557315cd51034d
Fixes: 73601288
(cherry picked from commit 57bb0b493470c09ff2bdbf78a2e80070c827e35c)

btif/src/btif_av.cc

index 813687a..d0c650e 100644 (file)
@@ -822,6 +822,9 @@ bt_status_t BtifAvSource::Init(
   codec_priorities_ = codec_priorities;
   bta_av_co_init(codec_priorities_);
 
+  if (!btif_a2dp_source_startup()) {
+    return BT_STATUS_FAIL;  // Already running
+  }
   btif_enable_service(BTA_A2DP_SOURCE_SERVICE_ID);
   enabled_ = true;
   return BT_STATUS_SUCCESS;
@@ -990,6 +993,9 @@ bt_status_t BtifAvSink::Init(btav_sink_callbacks_t* callbacks) {
                              kDefaultMaxConnectedAudioDevices);
   callbacks_ = callbacks;
 
+  if (!btif_a2dp_sink_startup()) {
+    return BT_STATUS_FAIL;  // Already running
+  }
   btif_enable_service(BTA_A2DP_SINK_SERVICE_ID);
   enabled_ = true;
   return BT_STATUS_SUCCESS;