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

Commit f858a509 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5954522 from 15b6ad02 to rvc-release

Change-Id: I01cfa4d518f35cea6ac32c6a68b61ac315dc4bf5
parents a1da5801 15b6ad02
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -195,7 +195,14 @@ bt_status_t btif_queue_connect_next(void) {

  LOG_INFO(LOG_TAG, "%s: executing connection request: %s", __func__,
           head.ToString().c_str());
  return head.connect();
  bt_status_t b_status = head.connect();
  if (b_status != BT_STATUS_SUCCESS) {
    LOG_INFO(LOG_TAG,
             "%s: connect %s failed, advance to next scheduled connection.",
             __func__, head.ToString().c_str());
    btif_queue_advance();
  }
  return b_status;
}

/*******************************************************************************
+43 −0
Original line number Diff line number Diff line
@@ -97,6 +97,49 @@ TEST_F(BtifProfileQueueTest, test_connect) {
  EXPECT_EQ(sResult, UUID1_ADDR1);
}

static bt_status_t test_connect_cb_fail(RawAddress* bda, uint16_t uuid) {
  sResult = UNKNOWN;
  if (*bda == BtifProfileQueueTest::kTestAddr1) {
    if (uuid == BtifProfileQueueTest::kTestUuid1) {
      sResult = UUID1_ADDR1;
    } else if (uuid == BtifProfileQueueTest::kTestUuid2) {
      sResult = UUID2_ADDR1;
    }
  } else if (*bda == BtifProfileQueueTest::kTestAddr2) {
    if (uuid == BtifProfileQueueTest::kTestUuid1) {
      sResult = UUID1_ADDR2;
    } else if (uuid == BtifProfileQueueTest::kTestUuid2) {
      sResult = UUID2_ADDR2;
    }
  }
  return BT_STATUS_BUSY;
}

TEST_F(BtifProfileQueueTest, test_connect_fail_still_can_advance_the_queue) {
  sResult = NOT_SET;
  // First connect-message for UUID1-ADDR1 is executed, but does not be removed
  // from connect-queue yet.
  btif_queue_connect(kTestUuid1, &kTestAddr1, test_connect_cb);
  EXPECT_EQ(sResult, UUID1_ADDR1);
  sResult = NOT_SET;
  // Second connect-message for UUID2-ADDR1 be pushed into connect-queue, but is
  // not executed
  btif_queue_connect(kTestUuid2, &kTestAddr1, test_connect_cb_fail);
  EXPECT_EQ(sResult, NOT_SET);
  // Third connect-message for UUID1-ADDR2 be pushed into connect-queue, but is
  // not executed
  btif_queue_connect(kTestUuid1, &kTestAddr2, test_connect_cb_fail);
  EXPECT_EQ(sResult, NOT_SET);
  // Fourth connect-message for UUID2-ADDR2 be pushed into connect-queue, but is
  // not executed
  btif_queue_connect(kTestUuid2, &kTestAddr2, test_connect_cb_fail);
  EXPECT_EQ(sResult, NOT_SET);
  // removed First connect-message from connect-queue, check it can advance to
  // subsequent connect-message.
  btif_queue_advance();
  EXPECT_EQ(sResult, UUID2_ADDR2);
}

TEST_F(BtifProfileQueueTest, test_connect_same_uuid_do_not_repeat) {
  sResult = NOT_SET;
  btif_queue_connect(kTestUuid1, &kTestAddr1, test_connect_cb);
+32 −2
Original line number Diff line number Diff line
@@ -109,9 +109,10 @@ cc_library {
        ":BluetoothHalSources",
        ":BluetoothHciSources",
        ":BluetoothL2capSources",
        ":BluetoothNeighborSources",
        ":BluetoothPacketSources",
        ":BluetoothShimSources",
        ":BluetoothSmpSources",
        ":BluetoothSecuritySources",
    ],
    generated_headers: [
        "BluetoothGeneratedPackets_h",
@@ -246,8 +247,9 @@ cc_test {
        ":BluetoothCryptoToolboxTestSources",
        ":BluetoothHciTestSources",
        ":BluetoothL2capTestSources",
        ":BluetoothNeighborTestSources",
        ":BluetoothPacketTestSources",
        ":BluetoothSmpTestSources",
        ":BluetoothSecurityTestSources",
    ],
    generated_headers: [
        "BluetoothGeneratedPackets_h",
@@ -285,6 +287,34 @@ cc_test {
    },
}

cc_fuzz {
  name: "bluetooth_gd_fuzz_test",
  defaults: ["gd_defaults"],
  srcs: [
    "fuzz_test.cc",
    ":BluetoothL2capFuzzTestSources",
  ],
  static_libs: [
    "libbluetooth_gd",
    "libchrome",
    "libgmock",
    "libgtest",
  ],
  host_supported: true,
  generated_headers: [
    "BluetoothGeneratedPackets_h",
  ],
  target: {
    android: {
        shared_libs: [
            "android.hardware.bluetooth@1.0",
            "libhidlbase",
            "libutils",
        ],
    },
  },
}

cc_benchmark {
    name: "bluetooth_benchmark_gd",
    defaults: ["gd_defaults"],

system/gd/fuzz_test.cc

0 → 100644
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <stddef.h>
#include <stdint.h>

extern void RunL2capClassicDynamicChannelAllocatorFuzzTest(const uint8_t* data, size_t size);

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  RunL2capClassicDynamicChannelAllocatorFuzzTest(data, size);
  return 0;
}
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -281,7 +281,8 @@ struct AclManager::impl {
    if (acl_connections_.size() == 1 && packet_to_send_ == nullptr) {
      start_round_robin();
    }
    std::unique_ptr<AclConnection> connection_proxy(new AclConnection(&acl_manager_, handle, address));
    std::unique_ptr<AclConnection> connection_proxy(
        new AclConnection(&acl_manager_, handle, address, peer_address_type));
    le_client_handler_->Post(common::BindOnce(&LeConnectionCallbacks::OnLeConnectSuccess,
                                              common::Unretained(le_client_callbacks_), std::move(connection_proxy)));
  }
@@ -306,7 +307,8 @@ struct AclManager::impl {
    if (acl_connections_.size() == 1 && packet_to_send_ == nullptr) {
      start_round_robin();
    }
    std::unique_ptr<AclConnection> connection_proxy(new AclConnection(&acl_manager_, handle, address));
    std::unique_ptr<AclConnection> connection_proxy(
        new AclConnection(&acl_manager_, handle, address, peer_address_type));
    le_client_handler_->Post(common::BindOnce(&LeConnectionCallbacks::OnLeConnectSuccess,
                                              common::Unretained(le_client_callbacks_), std::move(connection_proxy)));
  }
Loading