OSDN Git Service

RootCanal: Open network ports only if there is a console
authorMyles Watson <mylesgw@google.com>
Fri, 12 Apr 2019 21:30:51 +0000 (14:30 -0700)
committerMyles Watson <mylesgw@google.com>
Sat, 13 Apr 2019 00:23:14 +0000 (00:23 +0000)
Fixes: 128355308
Test: toggle airplane mode and check for opening sockets
Change-Id: I8c4581b708c05a8c72dba3604c02adea97c1653b

test/rootcanal/bluetooth_hci.cc

index f57f538..3e4297b 100644 (file)
@@ -122,9 +122,11 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) {
 
   if (BtTestConsoleEnabled()) {
     SetUpTestChannel(6111);
+    SetUpHciServer(6211,
+                   [this](int fd) { test_model_.IncomingHciConnection(fd); });
+    SetUpLinkLayerServer(
+        6311, [this](int fd) { test_model_.IncomingLinkLayerConnection(fd); });
   }
-  SetUpHciServer(6211, [this](int fd) { test_model_.IncomingHciConnection(fd); });
-  SetUpLinkLayerServer(6311, [this](int fd) { test_model_.IncomingLinkLayerConnection(fd); });
 
   unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
     if (death_recipient->getHasDied())