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
diff --git a/test/rootcanal/bluetooth_hci.cc b/test/rootcanal/bluetooth_hci.cc
index b0281a0..d0866f5 100644
--- a/test/rootcanal/bluetooth_hci.cc
+++ b/test/rootcanal/bluetooth_hci.cc
@@ -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::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 @@
controller_.RegisterTaskCancel(
[this](AsyncTaskId task) { async_manager_.CancelAsyncTask(task); });
- SetUpTestChannel(6111);
+ if (BtTestConsoleEnabled()) {
+ SetUpTestChannel(6111);
+ }
unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
if (death_recipient->getHasDied())