Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cbf0658 authored by Jorge Moreira Broche's avatar Jorge Moreira Broche Committed by Gerrit Code Review
Browse files

Merge "Allow to disable the rootcanal test console with a property"

parents e2b5a8a9 4d231f50
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include "bluetooth_hci.h"
#include "bluetooth_hci.h"


#include <base/logging.h>
#include <base/logging.h>
#include <cutils/properties.h>
#include <string.h>
#include <string.h>
#include <utils/Log.h>
#include <utils/Log.h>


@@ -44,6 +45,15 @@ using test_vendor_lib::ScoPacket;
using test_vendor_lib::TaskCallback;
using test_vendor_lib::TaskCallback;
using test_vendor_lib::TestChannelTransport;
using test_vendor_lib::TestChannelTransport;


namespace {

bool BtTestConsoleEnabled() {
  // Assume enabled by default.
  return property_get_bool("bt.rootcanal_test_console", true);
}

}  // namespace

class BluetoothDeathRecipient : public hidl_death_recipient {
class BluetoothDeathRecipient : public hidl_death_recipient {
 public:
 public:
  BluetoothDeathRecipient(const sp<IBluetoothHci> hci) : mHci(hci) {}
  BluetoothDeathRecipient(const sp<IBluetoothHci> hci) : mHci(hci) {}
@@ -130,7 +140,9 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) {
  controller_.RegisterTaskCancel(
  controller_.RegisterTaskCancel(
      [this](AsyncTaskId task) { async_manager_.CancelAsyncTask(task); });
      [this](AsyncTaskId task) { async_manager_.CancelAsyncTask(task); });


  if (BtTestConsoleEnabled()) {
    SetUpTestChannel(6111);
    SetUpTestChannel(6111);
  }


  unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
  unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
    if (death_recipient->getHasDied())
    if (death_recipient->getHasDied())