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

Commit 4d231f50 authored by Jorge E. Moreira's avatar Jorge E. Moreira
Browse files

Allow to disable the rootcanal test console with a property

Rootcanal's test console is in a tcp socket which is forbiden for HALs
by the Android security policy.

Bug: 128355308
Test: run in cuttlefish, ensure no 'avc: denied' messages show up
Change-Id: I74bf07c34166d2df399f33194cbb41e57178edc2
parent a2b7dce6
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "bluetooth_hci.h"

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

@@ -44,6 +45,15 @@ using test_vendor_lib::ScoPacket;
using test_vendor_lib::TaskCallback;
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 {
 public:
  BluetoothDeathRecipient(const sp<IBluetoothHci> hci) : mHci(hci) {}
@@ -130,7 +140,9 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) {
  controller_.RegisterTaskCancel(
      [this](AsyncTaskId task) { async_manager_.CancelAsyncTask(task); });

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

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