diff options
author | Myles Watson <mylesgw@google.com> | 2023-03-03 17:35:25 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-03-03 17:35:25 +0000 |
commit | 596346b2428bec0215e4bb83af28e04cb2f1de02 (patch) | |
tree | 2a6d8499221d20d58eb5ec5c0867f04e5124b1ee | |
parent | 1794913d24a6886d0fa316ea94ff15f26ed0eb89 (diff) | |
parent | 596557ff32a02d9456ff51a40e64484d978aaf19 (diff) | |
download | interfaces-596346b2428bec0215e4bb83af28e04cb2f1de02.tar.gz |
Merge "VtsHalBluetoothV1: Always wait for completed packets" am: 5d57ab1a45 am: 1b3643dd0f am: 596557ff32
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2467840
Change-Id: I1a125b24f45e7102528d6c827ecc24f5d6903f1a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp | 15 | ||||
-rw-r--r-- | bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp | 15 |
2 files changed, 18 insertions, 12 deletions
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp index 8ea1ddd085..945108796a 100644 --- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp +++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp @@ -516,12 +516,15 @@ void BluetoothHidlTest::sendAndCheckACL(int num_packets, size_t size, // Return the number of completed packets reported by the controller. int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) { int packets_processed = 0; - wait_for_event(false); - if (event_queue.size() == 0) { - ALOGW("%s: WaitForCallback timed out.", __func__); - return packets_processed; - } - while (event_queue.size() > 0) { + while (true) { + // There should be at least one event. + wait_for_event(packets_processed == 0); + if (event_queue.empty()) { + if (packets_processed == 0) { + ALOGW("%s: WaitForCallback timed out.", __func__); + } + return packets_processed; + } hidl_vec<uint8_t> event = event_queue.front(); event_queue.pop(); diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp index 9ae3837c15..28ac6034cf 100644 --- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp +++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp @@ -539,12 +539,15 @@ void BluetoothHidlTest::sendAndCheckACL(int num_packets, size_t size, // Return the number of completed packets reported by the controller. int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) { int packets_processed = 0; - wait_for_event(false); - if (event_queue.size() == 0) { - ALOGW("%s: WaitForCallback timed out.", __func__); - return packets_processed; - } - while (event_queue.size() > 0) { + while (true) { + // There should be at least one event. + wait_for_event(packets_processed == 0); + if (event_queue.empty()) { + if (packets_processed == 0) { + ALOGW("%s: WaitForCallback timed out.", __func__); + } + return packets_processed; + } hidl_vec<uint8_t> event = event_queue.front(); event_queue.pop(); |