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

Commit bcb4004b authored by Myles Watson's avatar Myles Watson Committed by android-build-merger
Browse files

DO NOT MERGE RootCanal: Always add default devices

am: d15b5edb

Change-Id: I11a3328b78eb69c85ab98038aa2558c442d659cb
parents 690d89d4 d15b5edb
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -120,6 +120,11 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) {
  // Add the controller as a device in the model.
  test_model_.Add(controller_);

  // Send responses to logcat if the test channel is not configured.
  test_channel_.RegisterSendResponse([](const std::string& response) {
    ALOGI("No test channel yet: %s", response.c_str());
  });

  if (BtTestConsoleEnabled()) {
    SetUpTestChannel(6111);
    SetUpHciServer(6211,
@@ -128,6 +133,16 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) {
        6311, [this](int fd) { test_model_.IncomingLinkLayerConnection(fd); });
  }

  // Add some default devices for easier debugging
  test_channel_.AddDefaults();

  // This should be configurable in the future.
  ALOGI("Adding Beacons so the scan list is not empty.");
  test_channel_.Add({"beacon", "be:ac:10:00:00:01", "1000"});
  test_channel_.AddDeviceToPhy({"1", "0"});
  test_channel_.Add({"beacon", "be:ac:10:00:00:02", "1000"});
  test_channel_.AddDeviceToPhy({"2", "0"});

  unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
    if (death_recipient->getHasDied())
      ALOGI("Skipping unlink call, service died.");
@@ -261,16 +276,6 @@ void BluetoothHci::SetUpTestChannel(int port) {
  test_channel_.RegisterSendResponse(
      [](const std::string& response) { ALOGI("No test channel: %s", response.c_str()); });

  // Add some default devices for easier debugging
  test_channel_.AddDefaults();

  // This should be configurable in the future.
  ALOGI("Adding Beacons so the scan list is not empty.");
  test_channel_.Add({"beacon", "be:ac:10:00:00:01", "1000"});
  test_channel_.AddDeviceToPhy({"1", "0"});
  test_channel_.Add({"beacon", "be:ac:10:00:00:02", "1000"});
  test_channel_.AddDeviceToPhy({"2", "0"});

  if (socket_fd == -1) {
    ALOGE("Test channel SetUp(%d) failed.", port);
    return;