diff options
20 files changed, 230 insertions, 195 deletions
diff --git a/bluetooth/.clang-format b/bluetooth/.clang-format new file mode 100644 index 00000000..95649942 --- /dev/null +++ b/bluetooth/.clang-format | |||
@@ -0,0 +1,20 @@ | |||
1 | # | ||
2 | # Copyright 2018 The Android Open Source Project | ||
3 | # | ||
4 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | # you may not use this file except in compliance with the License. | ||
6 | # You may obtain a copy of the License at | ||
7 | # | ||
8 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | # | ||
10 | # Unless required by applicable law or agreed to in writing, software | ||
11 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | # See the License for the specific language governing permissions and | ||
14 | # limitations under the License. | ||
15 | # | ||
16 | |||
17 | BasedOnStyle: Google | ||
18 | CommentPragmas: NOLINT:.* | ||
19 | DerivePointerAlignment: false | ||
20 | |||
diff --git a/bluetooth/1.0/default/async_fd_watcher.cc b/bluetooth/1.0/default/async_fd_watcher.cc index 7c746438..18098ca1 100644 --- a/bluetooth/1.0/default/async_fd_watcher.cc +++ b/bluetooth/1.0/default/async_fd_watcher.cc | |||
@@ -18,13 +18,13 @@ | |||
18 | 18 | ||
19 | #include "async_fd_watcher.h" | 19 | #include "async_fd_watcher.h" |
20 | 20 | ||
21 | #include <log/log.h> | ||
21 | #include <algorithm> | 22 | #include <algorithm> |
22 | #include <atomic> | 23 | #include <atomic> |
23 | #include <condition_variable> | 24 | #include <condition_variable> |
24 | #include <map> | 25 | #include <map> |
25 | #include <mutex> | 26 | #include <mutex> |
26 | #include <thread> | 27 | #include <thread> |
27 | #include <log/log.h> | ||
28 | #include <vector> | 28 | #include <vector> |
29 | #include "fcntl.h" | 29 | #include "fcntl.h" |
30 | #include "sys/select.h" | 30 | #include "sys/select.h" |
@@ -159,11 +159,9 @@ void AsyncFdWatcher::ThreadRoutine() { | |||
159 | TimeoutCallback saved_cb; | 159 | TimeoutCallback saved_cb; |
160 | { | 160 | { |
161 | std::unique_lock<std::mutex> guard(timeout_mutex_); | 161 | std::unique_lock<std::mutex> guard(timeout_mutex_); |
162 | if (timeout_ms_ > std::chrono::milliseconds(0)) | 162 | if (timeout_ms_ > std::chrono::milliseconds(0)) saved_cb = timeout_cb_; |
163 | saved_cb = timeout_cb_; | ||
164 | } | 163 | } |
165 | if (saved_cb != nullptr) | 164 | if (saved_cb != nullptr) saved_cb(); |
166 | saved_cb(); | ||
167 | continue; | 165 | continue; |
168 | } | 166 | } |
169 | 167 | ||
@@ -180,14 +178,14 @@ void AsyncFdWatcher::ThreadRoutine() { | |||
180 | std::unique_lock<std::mutex> guard(internal_mutex_); | 178 | std::unique_lock<std::mutex> guard(internal_mutex_); |
181 | for (auto& it : watched_fds_) { | 179 | for (auto& it : watched_fds_) { |
182 | if (FD_ISSET(it.first, &read_fds)) { | 180 | if (FD_ISSET(it.first, &read_fds)) { |
183 | it.second(it.first); | 181 | it.second(it.first); |
184 | } | 182 | } |
185 | } | 183 | } |
186 | } | 184 | } |
187 | } | 185 | } |
188 | } | 186 | } |
189 | 187 | ||
190 | } // namespace async | 188 | } // namespace async |
191 | } // namespace bluetooth | 189 | } // namespace bluetooth |
192 | } // namespace hardware | 190 | } // namespace hardware |
193 | } // namespace android | 191 | } // namespace android |
diff --git a/bluetooth/1.0/default/async_fd_watcher.h b/bluetooth/1.0/default/async_fd_watcher.h index 358cbc3d..b51f9211 100644 --- a/bluetooth/1.0/default/async_fd_watcher.h +++ b/bluetooth/1.0/default/async_fd_watcher.h | |||
@@ -60,8 +60,7 @@ class AsyncFdWatcher { | |||
60 | std::chrono::milliseconds timeout_ms_; | 60 | std::chrono::milliseconds timeout_ms_; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | 63 | } // namespace async | |
64 | } // namespace async | 64 | } // namespace bluetooth |
65 | } // namespace bluetooth | 65 | } // namespace hardware |
66 | } // namespace hardware | 66 | } // namespace android |
67 | } // namespace android | ||
diff --git a/bluetooth/1.0/default/bluetooth_address.h b/bluetooth/1.0/default/bluetooth_address.h index 94bf6161..010a1132 100644 --- a/bluetooth/1.0/default/bluetooth_address.h +++ b/bluetooth/1.0/default/bluetooth_address.h | |||
@@ -54,8 +54,8 @@ class BluetoothAddress { | |||
54 | static bool get_local_address(uint8_t* addr); | 54 | static bool get_local_address(uint8_t* addr); |
55 | }; | 55 | }; |
56 | 56 | ||
57 | } // namespace implementation | 57 | } // namespace implementation |
58 | } // namespace V1_0 | 58 | } // namespace V1_0 |
59 | } // namespace bluetooth | 59 | } // namespace bluetooth |
60 | } // namespace hardware | 60 | } // namespace hardware |
61 | } // namespace android | 61 | } // namespace android |
diff --git a/bluetooth/1.0/default/bluetooth_hci.h b/bluetooth/1.0/default/bluetooth_hci.h index e2797b11..c9669900 100644 --- a/bluetooth/1.0/default/bluetooth_hci.h +++ b/bluetooth/1.0/default/bluetooth_hci.h | |||
@@ -29,8 +29,8 @@ namespace bluetooth { | |||
29 | namespace V1_0 { | 29 | namespace V1_0 { |
30 | namespace implementation { | 30 | namespace implementation { |
31 | 31 | ||
32 | using ::android::hardware::Return; | ||
33 | using ::android::hardware::hidl_vec; | 32 | using ::android::hardware::hidl_vec; |
33 | using ::android::hardware::Return; | ||
34 | 34 | ||
35 | class BluetoothDeathRecipient; | 35 | class BluetoothDeathRecipient; |
36 | 36 | ||
diff --git a/bluetooth/1.0/default/bt_vendor_lib.h b/bluetooth/1.0/default/bt_vendor_lib.h index c140e522..c4035b70 100644 --- a/bluetooth/1.0/default/bt_vendor_lib.h +++ b/bluetooth/1.0/default/bt_vendor_lib.h | |||
@@ -418,13 +418,12 @@ extern const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE; | |||
418 | // DIRECTORIES. | 418 | // DIRECTORIES. |
419 | // ONLY USED INSIDE transmit_cb. | 419 | // ONLY USED INSIDE transmit_cb. |
420 | // DO NOT USE IN NEW HAL IMPLEMENTATIONS GOING FORWARD | 420 | // DO NOT USE IN NEW HAL IMPLEMENTATIONS GOING FORWARD |
421 | typedef struct | 421 | typedef struct { |
422 | { | 422 | uint16_t event; |
423 | uint16_t event; | 423 | uint16_t len; |
424 | uint16_t len; | 424 | uint16_t offset; |
425 | uint16_t offset; | 425 | uint16_t layer_specific; |
426 | uint16_t layer_specific; | 426 | uint8_t data[]; |
427 | uint8_t data[]; | ||
428 | } HC_BT_HDR; | 427 | } HC_BT_HDR; |
429 | // /MODIFICATION | 428 | // /MODIFICATION |
430 | 429 | ||
diff --git a/bluetooth/1.0/default/h4_protocol.cc b/bluetooth/1.0/default/h4_protocol.cc index df405077..98e3273f 100644 --- a/bluetooth/1.0/default/h4_protocol.cc +++ b/bluetooth/1.0/default/h4_protocol.cc | |||
@@ -34,7 +34,8 @@ size_t H4Protocol::Send(uint8_t type, const uint8_t* data, size_t length) { | |||
34 | {const_cast<uint8_t*>(data), length}}; | 34 | {const_cast<uint8_t*>(data), length}}; |
35 | ssize_t ret = 0; | 35 | ssize_t ret = 0; |
36 | do { | 36 | do { |
37 | ret = TEMP_FAILURE_RETRY(writev(uart_fd_, iov, sizeof(iov) / sizeof(iov[0]))); | 37 | ret = |
38 | TEMP_FAILURE_RETRY(writev(uart_fd_, iov, sizeof(iov) / sizeof(iov[0]))); | ||
38 | } while (-1 == ret && EAGAIN == errno); | 39 | } while (-1 == ret && EAGAIN == errno); |
39 | 40 | ||
40 | if (ret == -1) { | 41 | if (ret == -1) { |
diff --git a/bluetooth/1.0/default/hci_packetizer.cc b/bluetooth/1.0/default/hci_packetizer.cc index 71f43284..7cb3a113 100644 --- a/bluetooth/1.0/default/hci_packetizer.cc +++ b/bluetooth/1.0/default/hci_packetizer.cc | |||
@@ -46,9 +46,7 @@ namespace hardware { | |||
46 | namespace bluetooth { | 46 | namespace bluetooth { |
47 | namespace hci { | 47 | namespace hci { |
48 | 48 | ||
49 | const hidl_vec<uint8_t>& HciPacketizer::GetPacket() const { | 49 | const hidl_vec<uint8_t>& HciPacketizer::GetPacket() const { return packet_; } |
50 | return packet_; | ||
51 | } | ||
52 | 50 | ||
53 | void HciPacketizer::OnDataReady(int fd, HciPacketType packet_type) { | 51 | void HciPacketizer::OnDataReady(int fd, HciPacketType packet_type) { |
54 | switch (state_) { | 52 | switch (state_) { |
diff --git a/bluetooth/1.0/default/hci_protocol.cc b/bluetooth/1.0/default/hci_protocol.cc index bf94dfe8..7e88dc44 100644 --- a/bluetooth/1.0/default/hci_protocol.cc +++ b/bluetooth/1.0/default/hci_protocol.cc | |||
@@ -20,8 +20,8 @@ | |||
20 | #include <assert.h> | 20 | #include <assert.h> |
21 | #include <errno.h> | 21 | #include <errno.h> |
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <unistd.h> | ||
24 | #include <log/log.h> | 23 | #include <log/log.h> |
24 | #include <unistd.h> | ||
25 | 25 | ||
26 | namespace android { | 26 | namespace android { |
27 | namespace hardware { | 27 | namespace hardware { |
diff --git a/bluetooth/1.0/default/service.cpp b/bluetooth/1.0/default/service.cpp index 3a7aad02..dd3f6a9d 100644 --- a/bluetooth/1.0/default/service.cpp +++ b/bluetooth/1.0/default/service.cpp | |||
@@ -24,9 +24,9 @@ | |||
24 | static const size_t kMaxThreads = 5; | 24 | static const size_t kMaxThreads = 5; |
25 | 25 | ||
26 | // Generated HIDL files | 26 | // Generated HIDL files |
27 | using android::hardware::bluetooth::V1_0::IBluetoothHci; | ||
28 | using android::hardware::defaultPassthroughServiceImplementation; | 27 | using android::hardware::defaultPassthroughServiceImplementation; |
28 | using android::hardware::bluetooth::V1_0::IBluetoothHci; | ||
29 | 29 | ||
30 | int main() { | 30 | int main() { |
31 | return defaultPassthroughServiceImplementation<IBluetoothHci>(kMaxThreads); | 31 | return defaultPassthroughServiceImplementation<IBluetoothHci>(kMaxThreads); |
32 | } | 32 | } |
diff --git a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc index ee7d8d13..07d8d543 100644 --- a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc +++ b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc | |||
@@ -252,13 +252,13 @@ TEST_F(AsyncFdWatcherSocketTest, TimedOutSchedulesTimeout) { | |||
252 | }); | 252 | }); |
253 | 253 | ||
254 | // Set a timeout flag in each callback. | 254 | // Set a timeout flag in each callback. |
255 | conn_watcher.ConfigureTimeout( | 255 | conn_watcher.ConfigureTimeout(std::chrono::milliseconds(500), |
256 | std::chrono::milliseconds(500), | 256 | [&conn_watcher, &timed_out, &timed_out2]() { |
257 | [&conn_watcher, &timed_out, &timed_out2]() { | 257 | timed_out = true; |
258 | timed_out = true; | 258 | conn_watcher.ConfigureTimeout( |
259 | conn_watcher.ConfigureTimeout(std::chrono::seconds(1), | 259 | std::chrono::seconds(1), |
260 | [&timed_out2]() { timed_out2 = true; }); | 260 | [&timed_out2]() { timed_out2 = true; }); |
261 | }); | 261 | }); |
262 | EXPECT_FALSE(timed_out); | 262 | EXPECT_FALSE(timed_out); |
263 | EXPECT_FALSE(timed_out2); | 263 | EXPECT_FALSE(timed_out2); |
264 | sleep(1); | 264 | sleep(1); |
@@ -385,8 +385,8 @@ TEST_F(AsyncFdWatcherSocketTest, RepeatedTimeOutTest) { | |||
385 | CleanUpServer(); | 385 | CleanUpServer(); |
386 | } | 386 | } |
387 | 387 | ||
388 | } // namespace implementation | 388 | } // namespace implementation |
389 | } // namespace V1_0 | 389 | } // namespace V1_0 |
390 | } // namespace bluetooth | 390 | } // namespace bluetooth |
391 | } // namespace hardware | 391 | } // namespace hardware |
392 | } // namespace android | 392 | } // namespace android |
diff --git a/bluetooth/1.0/default/test/h4_protocol_unittest.cc b/bluetooth/1.0/default/test/h4_protocol_unittest.cc index ad08086c..ba56c0d6 100644 --- a/bluetooth/1.0/default/test/h4_protocol_unittest.cc +++ b/bluetooth/1.0/default/test/h4_protocol_unittest.cc | |||
@@ -36,8 +36,8 @@ namespace bluetooth { | |||
36 | namespace V1_0 { | 36 | namespace V1_0 { |
37 | namespace implementation { | 37 | namespace implementation { |
38 | 38 | ||
39 | using ::testing::Eq; | ||
40 | using hci::H4Protocol; | 39 | using hci::H4Protocol; |
40 | using ::testing::Eq; | ||
41 | 41 | ||
42 | static char sample_data1[100] = "A point is that which has no part."; | 42 | static char sample_data1[100] = "A point is that which has no part."; |
43 | static char sample_data2[100] = "A line is breadthless length."; | 43 | static char sample_data2[100] = "A line is breadthless length."; |
diff --git a/bluetooth/1.0/default/test/mct_protocol_unittest.cc b/bluetooth/1.0/default/test/mct_protocol_unittest.cc index d45058e2..60dbc880 100644 --- a/bluetooth/1.0/default/test/mct_protocol_unittest.cc +++ b/bluetooth/1.0/default/test/mct_protocol_unittest.cc | |||
@@ -36,8 +36,8 @@ namespace bluetooth { | |||
36 | namespace V1_0 { | 36 | namespace V1_0 { |
37 | namespace implementation { | 37 | namespace implementation { |
38 | 38 | ||
39 | using ::testing::Eq; | ||
40 | using hci::MctProtocol; | 39 | using hci::MctProtocol; |
40 | using ::testing::Eq; | ||
41 | 41 | ||
42 | static char sample_data1[100] = "A point is that which has no part."; | 42 | static char sample_data1[100] = "A point is that which has no part."; |
43 | static char sample_data2[100] = "A line is breadthless length."; | 43 | static char sample_data2[100] = "A line is breadthless length."; |
diff --git a/bluetooth/1.0/default/test/properties.cc b/bluetooth/1.0/default/test/properties.cc index 6ac4fb42..70de01e0 100644 --- a/bluetooth/1.0/default/test/properties.cc +++ b/bluetooth/1.0/default/test/properties.cc | |||
@@ -36,7 +36,7 @@ int num_properties = 0; | |||
36 | struct property properties[MAX_PROPERTIES]; | 36 | struct property properties[MAX_PROPERTIES]; |
37 | 37 | ||
38 | // Find the correct entry. | 38 | // Find the correct entry. |
39 | static int property_find(const char *key) { | 39 | static int property_find(const char* key) { |
40 | for (int i = 0; i < num_properties; i++) { | 40 | for (int i = 0; i < num_properties; i++) { |
41 | if (strncmp(properties[i].key, key, PROP_KEY_MAX) == 0) { | 41 | if (strncmp(properties[i].key, key, PROP_KEY_MAX) == 0) { |
42 | return i; | 42 | return i; |
@@ -45,7 +45,7 @@ static int property_find(const char *key) { | |||
45 | return MAX_PROPERTIES; | 45 | return MAX_PROPERTIES; |
46 | } | 46 | } |
47 | 47 | ||
48 | int property_set(const char *key, const char *value) { | 48 | int property_set(const char* key, const char* value) { |
49 | if (strnlen(value, PROP_VALUE_MAX) > PROP_VALUE_MAX) return -1; | 49 | if (strnlen(value, PROP_VALUE_MAX) > PROP_VALUE_MAX) return -1; |
50 | 50 | ||
51 | // Check to see if the property exists. | 51 | // Check to see if the property exists. |
@@ -63,7 +63,7 @@ int property_set(const char *key, const char *value) { | |||
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | int property_get(const char *key, char *value, const char *default_value) { | 66 | int property_get(const char* key, char* value, const char* default_value) { |
67 | // This doesn't mock the behavior of default value | 67 | // This doesn't mock the behavior of default value |
68 | if (default_value != NULL) ALOGE("%s: default_value is ignored!", __func__); | 68 | if (default_value != NULL) ALOGE("%s: default_value is ignored!", __func__); |
69 | 69 | ||
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc index a8f5bb40..e5f02f37 100644 --- a/bluetooth/1.0/default/vendor_interface.cc +++ b/bluetooth/1.0/default/vendor_interface.cc | |||
@@ -35,8 +35,8 @@ static const int INVALID_FD = -1; | |||
35 | 35 | ||
36 | namespace { | 36 | namespace { |
37 | 37 | ||
38 | using android::hardware::bluetooth::V1_0::implementation::VendorInterface; | ||
39 | using android::hardware::hidl_vec; | 38 | using android::hardware::hidl_vec; |
39 | using android::hardware::bluetooth::V1_0::implementation::VendorInterface; | ||
40 | 40 | ||
41 | struct { | 41 | struct { |
42 | tINT_CMD_CBACK cb; | 42 | tINT_CMD_CBACK cb; |
@@ -258,8 +258,7 @@ bool VendorInterface::Open(InitializeCompleteCallback initialize_complete_cb, | |||
258 | fd_watcher_.WatchFdForNonBlockingReads( | 258 | fd_watcher_.WatchFdForNonBlockingReads( |
259 | fd_list[CH_EVT], [mct_hci](int fd) { mct_hci->OnEventDataReady(fd); }); | 259 | fd_list[CH_EVT], [mct_hci](int fd) { mct_hci->OnEventDataReady(fd); }); |
260 | fd_watcher_.WatchFdForNonBlockingReads( | 260 | fd_watcher_.WatchFdForNonBlockingReads( |
261 | fd_list[CH_ACL_IN], | 261 | fd_list[CH_ACL_IN], [mct_hci](int fd) { mct_hci->OnAclDataReady(fd); }); |
262 | [mct_hci](int fd) { mct_hci->OnAclDataReady(fd); }); | ||
263 | hci_ = mct_hci; | 262 | hci_ = mct_hci; |
264 | } | 263 | } |
265 | 264 | ||
diff --git a/bluetooth/1.0/default/vendor_interface.h b/bluetooth/1.0/default/vendor_interface.h index a401ee6e..36f4e1b0 100644 --- a/bluetooth/1.0/default/vendor_interface.h +++ b/bluetooth/1.0/default/vendor_interface.h | |||
@@ -40,9 +40,9 @@ class VendorInterface { | |||
40 | PacketReadCallback event_cb, PacketReadCallback acl_cb, | 40 | PacketReadCallback event_cb, PacketReadCallback acl_cb, |
41 | PacketReadCallback sco_cb); | 41 | PacketReadCallback sco_cb); |
42 | static void Shutdown(); | 42 | static void Shutdown(); |
43 | static VendorInterface *get(); | 43 | static VendorInterface* get(); |
44 | 44 | ||
45 | size_t Send(uint8_t type, const uint8_t *data, size_t length); | 45 | size_t Send(uint8_t type, const uint8_t* data, size_t length); |
46 | 46 | ||
47 | void OnFirmwareConfigured(uint8_t result); | 47 | void OnFirmwareConfigured(uint8_t result); |
48 | 48 | ||
@@ -58,15 +58,15 @@ class VendorInterface { | |||
58 | 58 | ||
59 | void HandleIncomingEvent(const hidl_vec<uint8_t>& hci_packet); | 59 | void HandleIncomingEvent(const hidl_vec<uint8_t>& hci_packet); |
60 | 60 | ||
61 | void *lib_handle_; | 61 | void* lib_handle_; |
62 | bt_vendor_interface_t *lib_interface_; | 62 | bt_vendor_interface_t* lib_interface_; |
63 | async::AsyncFdWatcher fd_watcher_; | 63 | async::AsyncFdWatcher fd_watcher_; |
64 | InitializeCompleteCallback initialize_complete_cb_; | 64 | InitializeCompleteCallback initialize_complete_cb_; |
65 | hci::HciProtocol* hci_; | 65 | hci::HciProtocol* hci_; |
66 | 66 | ||
67 | PacketReadCallback event_cb_; | 67 | PacketReadCallback event_cb_; |
68 | 68 | ||
69 | FirmwareStartupTimer *firmware_startup_timer_; | 69 | FirmwareStartupTimer* firmware_startup_timer_; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | } // namespace implementation | 72 | } // namespace implementation |
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp index 439c5fb1..ae84ec2b 100644 --- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp +++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp | |||
@@ -28,13 +28,13 @@ | |||
28 | #include <VtsHalHidlTargetTestEnvBase.h> | 28 | #include <VtsHalHidlTargetTestEnvBase.h> |
29 | #include <queue> | 29 | #include <queue> |
30 | 30 | ||
31 | using ::android::hardware::bluetooth::V1_0::IBluetoothHci; | 31 | using ::android::sp; |
32 | using ::android::hardware::bluetooth::V1_0::IBluetoothHciCallbacks; | ||
33 | using ::android::hardware::bluetooth::V1_0::Status; | ||
34 | using ::android::hardware::hidl_vec; | 32 | using ::android::hardware::hidl_vec; |
35 | using ::android::hardware::Return; | 33 | using ::android::hardware::Return; |
36 | using ::android::hardware::Void; | 34 | using ::android::hardware::Void; |
37 | using ::android::sp; | 35 | using ::android::hardware::bluetooth::V1_0::IBluetoothHci; |
36 | using ::android::hardware::bluetooth::V1_0::IBluetoothHciCallbacks; | ||
37 | using ::android::hardware::bluetooth::V1_0::Status; | ||
38 | 38 | ||
39 | #define HCI_MINIMUM_HCI_VERSION 5 // Bluetooth Core Specification 3.0 + HS | 39 | #define HCI_MINIMUM_HCI_VERSION 5 // Bluetooth Core Specification 3.0 + HS |
40 | #define HCI_MINIMUM_LMP_VERSION 5 // Bluetooth Core Specification 3.0 + HS | 40 | #define HCI_MINIMUM_LMP_VERSION 5 // Bluetooth Core Specification 3.0 + HS |
@@ -191,12 +191,12 @@ class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase { | |||
191 | } | 191 | } |
192 | 192 | ||
193 | virtual void TearDown() override { | 193 | virtual void TearDown() override { |
194 | // Should not be checked in production code | 194 | // Should not be checked in production code |
195 | ASSERT_TRUE(bluetooth->close().isOk()); | 195 | ASSERT_TRUE(bluetooth->close().isOk()); |
196 | handle_no_ops(); | 196 | handle_no_ops(); |
197 | EXPECT_EQ(static_cast<size_t>(0), event_queue.size()); | 197 | EXPECT_EQ(static_cast<size_t>(0), event_queue.size()); |
198 | EXPECT_EQ(static_cast<size_t>(0), sco_queue.size()); | 198 | EXPECT_EQ(static_cast<size_t>(0), sco_queue.size()); |
199 | EXPECT_EQ(static_cast<size_t>(0), acl_queue.size()); | 199 | EXPECT_EQ(static_cast<size_t>(0), acl_queue.size()); |
200 | } | 200 | } |
201 | 201 | ||
202 | void setBufferSizes(); | 202 | void setBufferSizes(); |
@@ -659,10 +659,11 @@ TEST_F(BluetoothHidlTest, LoopbackModeSinglePackets) { | |||
659 | EXPECT_LT(0, max_sco_data_packet_length); | 659 | EXPECT_LT(0, max_sco_data_packet_length); |
660 | sendAndCheckSCO(1, max_sco_data_packet_length, sco_connection_handles[0]); | 660 | sendAndCheckSCO(1, max_sco_data_packet_length, sco_connection_handles[0]); |
661 | int sco_packets_sent = 1; | 661 | int sco_packets_sent = 1; |
662 | int completed_packets = wait_for_completed_packets_event(sco_connection_handles[0]); | 662 | int completed_packets = |
663 | wait_for_completed_packets_event(sco_connection_handles[0]); | ||
663 | if (sco_packets_sent != completed_packets) { | 664 | if (sco_packets_sent != completed_packets) { |
664 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, sco_packets_sent, | 665 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, |
665 | completed_packets); | 666 | sco_packets_sent, completed_packets); |
666 | } | 667 | } |
667 | } | 668 | } |
668 | 669 | ||
@@ -670,10 +671,11 @@ TEST_F(BluetoothHidlTest, LoopbackModeSinglePackets) { | |||
670 | EXPECT_LT(0, max_acl_data_packet_length); | 671 | EXPECT_LT(0, max_acl_data_packet_length); |
671 | sendAndCheckACL(1, max_acl_data_packet_length, acl_connection_handles[0]); | 672 | sendAndCheckACL(1, max_acl_data_packet_length, acl_connection_handles[0]); |
672 | int acl_packets_sent = 1; | 673 | int acl_packets_sent = 1; |
673 | int completed_packets = wait_for_completed_packets_event(acl_connection_handles[0]); | 674 | int completed_packets = |
675 | wait_for_completed_packets_event(acl_connection_handles[0]); | ||
674 | if (acl_packets_sent != completed_packets) { | 676 | if (acl_packets_sent != completed_packets) { |
675 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, acl_packets_sent, | 677 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, |
676 | completed_packets); | 678 | acl_packets_sent, completed_packets); |
677 | } | 679 | } |
678 | } | 680 | } |
679 | } | 681 | } |
@@ -695,10 +697,11 @@ TEST_F(BluetoothHidlTest, LoopbackModeBandwidth) { | |||
695 | sendAndCheckSCO(NUM_SCO_PACKETS_BANDWIDTH, max_sco_data_packet_length, | 697 | sendAndCheckSCO(NUM_SCO_PACKETS_BANDWIDTH, max_sco_data_packet_length, |
696 | sco_connection_handles[0]); | 698 | sco_connection_handles[0]); |
697 | int sco_packets_sent = NUM_SCO_PACKETS_BANDWIDTH; | 699 | int sco_packets_sent = NUM_SCO_PACKETS_BANDWIDTH; |
698 | int completed_packets = wait_for_completed_packets_event(sco_connection_handles[0]); | 700 | int completed_packets = |
701 | wait_for_completed_packets_event(sco_connection_handles[0]); | ||
699 | if (sco_packets_sent != completed_packets) { | 702 | if (sco_packets_sent != completed_packets) { |
700 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, sco_packets_sent, | 703 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, |
701 | completed_packets); | 704 | sco_packets_sent, completed_packets); |
702 | } | 705 | } |
703 | } | 706 | } |
704 | 707 | ||
@@ -707,10 +710,11 @@ TEST_F(BluetoothHidlTest, LoopbackModeBandwidth) { | |||
707 | sendAndCheckACL(NUM_ACL_PACKETS_BANDWIDTH, max_acl_data_packet_length, | 710 | sendAndCheckACL(NUM_ACL_PACKETS_BANDWIDTH, max_acl_data_packet_length, |
708 | acl_connection_handles[0]); | 711 | acl_connection_handles[0]); |
709 | int acl_packets_sent = NUM_ACL_PACKETS_BANDWIDTH; | 712 | int acl_packets_sent = NUM_ACL_PACKETS_BANDWIDTH; |
710 | int completed_packets = wait_for_completed_packets_event(acl_connection_handles[0]); | 713 | int completed_packets = |
714 | wait_for_completed_packets_event(acl_connection_handles[0]); | ||
711 | if (acl_packets_sent != completed_packets) { | 715 | if (acl_packets_sent != completed_packets) { |
712 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, acl_packets_sent, | 716 | ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, |
713 | completed_packets); | 717 | acl_packets_sent, completed_packets); |
714 | } | 718 | } |
715 | } | 719 | } |
716 | } | 720 | } |
diff --git a/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.cpp b/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.cpp index 2a66abe6..9abb88d5 100644 --- a/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.cpp +++ b/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.cpp | |||
@@ -23,47 +23,52 @@ namespace a2dp { | |||
23 | namespace V1_0 { | 23 | namespace V1_0 { |
24 | namespace implementation { | 24 | namespace implementation { |
25 | 25 | ||
26 | IBluetoothAudioOffload* HIDL_FETCH_IBluetoothAudioOffload(const char* /* name */) { | 26 | IBluetoothAudioOffload* HIDL_FETCH_IBluetoothAudioOffload( |
27 | return new BluetoothAudioOffload(); | 27 | const char* /* name */) { |
28 | return new BluetoothAudioOffload(); | ||
28 | } | 29 | } |
29 | 30 | ||
30 | // Methods from ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload follow. | 31 | // Methods from |
31 | Return<::android::hardware::bluetooth::a2dp::V1_0::Status> BluetoothAudioOffload::startSession( | 32 | // ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload follow. |
32 | const sp<::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost>& hostIf __unused, | 33 | Return<::android::hardware::bluetooth::a2dp::V1_0::Status> |
33 | const ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration& codecConfig __unused) { | 34 | BluetoothAudioOffload::startSession( |
34 | /** | 35 | const sp<::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost>& |
35 | * Initialize the audio platform if codecConfiguration is supported. | 36 | hostIf __unused, |
36 | * Save the the IBluetoothAudioHost interface, so that it can be used | 37 | const ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration& |
37 | * later to send stream control commands to the HAL client, based on | 38 | codecConfig __unused) { |
38 | * interaction with Audio framework. | 39 | /** |
39 | */ | 40 | * Initialize the audio platform if codecConfiguration is supported. |
40 | return ::android::hardware::bluetooth::a2dp::V1_0::Status::FAILURE; | 41 | * Save the the IBluetoothAudioHost interface, so that it can be used |
42 | * later to send stream control commands to the HAL client, based on | ||
43 | * interaction with Audio framework. | ||
44 | */ | ||
45 | return ::android::hardware::bluetooth::a2dp::V1_0::Status::FAILURE; | ||
41 | } | 46 | } |
42 | 47 | ||
43 | Return<void> BluetoothAudioOffload::streamStarted( | 48 | Return<void> BluetoothAudioOffload::streamStarted( |
44 | ::android::hardware::bluetooth::a2dp::V1_0::Status status __unused) { | 49 | ::android::hardware::bluetooth::a2dp::V1_0::Status status __unused) { |
45 | /** | 50 | /** |
46 | * Streaming on control path has started, | 51 | * Streaming on control path has started, |
47 | * HAL server should start the streaming on data path. | 52 | * HAL server should start the streaming on data path. |
48 | */ | 53 | */ |
49 | return Void(); | 54 | return Void(); |
50 | } | 55 | } |
51 | 56 | ||
52 | Return<void> BluetoothAudioOffload::streamSuspended( | 57 | Return<void> BluetoothAudioOffload::streamSuspended( |
53 | ::android::hardware::bluetooth::a2dp::V1_0::Status status __unused) { | 58 | ::android::hardware::bluetooth::a2dp::V1_0::Status status __unused) { |
54 | /** | 59 | /** |
55 | * Streaming on control path has suspend, | 60 | * Streaming on control path has suspend, |
56 | * HAL server should suspend the streaming on data path. | 61 | * HAL server should suspend the streaming on data path. |
57 | */ | 62 | */ |
58 | return Void(); | 63 | return Void(); |
59 | } | 64 | } |
60 | 65 | ||
61 | Return<void> BluetoothAudioOffload::endSession() { | 66 | Return<void> BluetoothAudioOffload::endSession() { |
62 | /** | 67 | /** |
63 | * Cleanup the audio platform as remote A2DP Sink device is no | 68 | * Cleanup the audio platform as remote A2DP Sink device is no |
64 | * longer active | 69 | * longer active |
65 | */ | 70 | */ |
66 | return Void(); | 71 | return Void(); |
67 | } | 72 | } |
68 | 73 | ||
69 | } // namespace implementation | 74 | } // namespace implementation |
diff --git a/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.h b/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.h index 5d07b5bc..16a83c2a 100644 --- a/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.h +++ b/bluetooth/a2dp/1.0/default/BluetoothAudioOffload.h | |||
@@ -28,27 +28,32 @@ namespace a2dp { | |||
28 | namespace V1_0 { | 28 | namespace V1_0 { |
29 | namespace implementation { | 29 | namespace implementation { |
30 | 30 | ||
31 | using ::android::sp; | ||
31 | using ::android::hardware::hidl_array; | 32 | using ::android::hardware::hidl_array; |
32 | using ::android::hardware::hidl_memory; | 33 | using ::android::hardware::hidl_memory; |
33 | using ::android::hardware::hidl_string; | 34 | using ::android::hardware::hidl_string; |
34 | using ::android::hardware::hidl_vec; | 35 | using ::android::hardware::hidl_vec; |
35 | using ::android::hardware::Return; | 36 | using ::android::hardware::Return; |
36 | using ::android::hardware::Void; | 37 | using ::android::hardware::Void; |
37 | using ::android::sp; | ||
38 | 38 | ||
39 | struct BluetoothAudioOffload : public IBluetoothAudioOffload { | 39 | struct BluetoothAudioOffload : public IBluetoothAudioOffload { |
40 | BluetoothAudioOffload() {} | 40 | BluetoothAudioOffload() {} |
41 | // Methods from ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload follow. | 41 | // Methods from |
42 | Return<::android::hardware::bluetooth::a2dp::V1_0::Status> startSession( | 42 | // ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload follow. |
43 | const sp<::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost>& hostIf, | 43 | Return<::android::hardware::bluetooth::a2dp::V1_0::Status> startSession( |
44 | const ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration& codecConfig) override; | 44 | const sp<::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost>& |
45 | Return<void> streamStarted(::android::hardware::bluetooth::a2dp::V1_0::Status status) override; | 45 | hostIf, |
46 | Return<void> streamSuspended( | 46 | const ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration& |
47 | ::android::hardware::bluetooth::a2dp::V1_0::Status status) override; | 47 | codecConfig) override; |
48 | Return<void> endSession() override; | 48 | Return<void> streamStarted( |
49 | ::android::hardware::bluetooth::a2dp::V1_0::Status status) override; | ||
50 | Return<void> streamSuspended( | ||
51 | ::android::hardware::bluetooth::a2dp::V1_0::Status status) override; | ||
52 | Return<void> endSession() override; | ||
49 | }; | 53 | }; |
50 | 54 | ||
51 | extern "C" IBluetoothAudioOffload* HIDL_FETCH_IBluetoothAudioOffload(const char* name); | 55 | extern "C" IBluetoothAudioOffload* HIDL_FETCH_IBluetoothAudioOffload( |
56 | const char* name); | ||
52 | 57 | ||
53 | } // namespace implementation | 58 | } // namespace implementation |
54 | } // namespace V1_0 | 59 | } // namespace V1_0 |
diff --git a/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp b/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp index 1a0342f3..d8d0c298 100644 --- a/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp +++ b/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp | |||
@@ -26,85 +26,92 @@ | |||
26 | #include <VtsHalHidlTargetTestBase.h> | 26 | #include <VtsHalHidlTargetTestBase.h> |
27 | #include <VtsHalHidlTargetTestEnvBase.h> | 27 | #include <VtsHalHidlTargetTestEnvBase.h> |
28 | 28 | ||
29 | using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost; | 29 | using ::android::sp; |
30 | using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload; | 30 | using ::android::hardware::Return; |
31 | using ::android::hardware::bluetooth::a2dp::V1_0::Status; | 31 | using ::android::hardware::Void; |
32 | using ::android::hardware::bluetooth::a2dp::V1_0::CodecType; | ||
33 | using ::android::hardware::bluetooth::a2dp::V1_0::SampleRate; | ||
34 | using ::android::hardware::bluetooth::a2dp::V1_0::BitsPerSample; | 32 | using ::android::hardware::bluetooth::a2dp::V1_0::BitsPerSample; |
35 | using ::android::hardware::bluetooth::a2dp::V1_0::ChannelMode; | 33 | using ::android::hardware::bluetooth::a2dp::V1_0::ChannelMode; |
36 | using ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration; | 34 | using ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration; |
37 | using ::android::hardware::Return; | 35 | using ::android::hardware::bluetooth::a2dp::V1_0::CodecType; |
38 | using ::android::hardware::Void; | 36 | using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost; |
39 | using ::android::sp; | 37 | using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload; |
38 | using ::android::hardware::bluetooth::a2dp::V1_0::SampleRate; | ||
39 | using ::android::hardware::bluetooth::a2dp::V1_0::Status; | ||
40 | 40 | ||
41 | // Test environment for Bluetooth HIDL A2DP HAL. | 41 | // Test environment for Bluetooth HIDL A2DP HAL. |
42 | class BluetoothA2dpHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { | 42 | class BluetoothA2dpHidlEnvironment |
43 | public: | 43 | : public ::testing::VtsHalHidlTargetTestEnvBase { |
44 | // get the test environment singleton | 44 | public: |
45 | static BluetoothA2dpHidlEnvironment* Instance() { | 45 | // get the test environment singleton |
46 | static BluetoothA2dpHidlEnvironment* instance = new BluetoothA2dpHidlEnvironment; | 46 | static BluetoothA2dpHidlEnvironment* Instance() { |
47 | return instance; | 47 | static BluetoothA2dpHidlEnvironment* instance = |
48 | } | 48 | new BluetoothA2dpHidlEnvironment; |
49 | 49 | return instance; | |
50 | virtual void registerTestServices() override { registerTestService<IBluetoothAudioOffload>(); } | 50 | } |
51 | 51 | ||
52 | private: | 52 | virtual void registerTestServices() override { |
53 | BluetoothA2dpHidlEnvironment() {} | 53 | registerTestService<IBluetoothAudioOffload>(); |
54 | } | ||
55 | |||
56 | private: | ||
57 | BluetoothA2dpHidlEnvironment() {} | ||
54 | }; | 58 | }; |
55 | 59 | ||
56 | // The main test class for Bluetooth A2DP HIDL HAL. | 60 | // The main test class for Bluetooth A2DP HIDL HAL. |
57 | class BluetoothA2dpHidlTest : public ::testing::VtsHalHidlTargetTestBase { | 61 | class BluetoothA2dpHidlTest : public ::testing::VtsHalHidlTargetTestBase { |
62 | public: | ||
63 | virtual void SetUp() override { | ||
64 | // currently test passthrough mode only | ||
65 | audio_offload = | ||
66 | ::testing::VtsHalHidlTargetTestBase::getService<IBluetoothAudioOffload>( | ||
67 | BluetoothA2dpHidlEnvironment::Instance() | ||
68 | ->getServiceName<IBluetoothAudioOffload>()); | ||
69 | ASSERT_NE(audio_offload, nullptr); | ||
70 | |||
71 | audio_host = new BluetoothAudioHost(*this); | ||
72 | ASSERT_NE(audio_host, nullptr); | ||
73 | |||
74 | codec.codecType = CodecType::AAC; | ||
75 | codec.sampleRate = SampleRate::RATE_44100; | ||
76 | codec.bitsPerSample = BitsPerSample::BITS_16; | ||
77 | codec.channelMode = ChannelMode::STEREO; | ||
78 | codec.encodedAudioBitrate = 320000; | ||
79 | codec.peerMtu = 1000; | ||
80 | } | ||
81 | |||
82 | virtual void TearDown() override {} | ||
83 | |||
84 | // A simple test implementation of IBluetoothAudioHost. | ||
85 | class BluetoothAudioHost | ||
86 | : public ::testing::VtsHalHidlTargetCallbackBase<BluetoothA2dpHidlTest>, | ||
87 | public IBluetoothAudioHost { | ||
88 | BluetoothA2dpHidlTest& parent_; | ||
89 | |||
58 | public: | 90 | public: |
59 | virtual void SetUp() override { | 91 | BluetoothAudioHost(BluetoothA2dpHidlTest& parent) : parent_(parent){}; |
60 | // currently test passthrough mode only | 92 | virtual ~BluetoothAudioHost() = default; |
61 | audio_offload = ::testing::VtsHalHidlTargetTestBase::getService<IBluetoothAudioOffload>( | 93 | |
62 | BluetoothA2dpHidlEnvironment::Instance()->getServiceName<IBluetoothAudioOffload>()); | 94 | Return<void> startStream() override { |
63 | ASSERT_NE(audio_offload, nullptr); | 95 | parent_.audio_offload->streamStarted(Status::SUCCESS); |
64 | 96 | return Void(); | |
65 | audio_host = new BluetoothAudioHost(*this); | 97 | }; |
66 | ASSERT_NE(audio_host, nullptr); | 98 | |
67 | 99 | Return<void> suspendStream() override { | |
68 | codec.codecType = CodecType::AAC; | 100 | parent_.audio_offload->streamSuspended(Status::SUCCESS); |
69 | codec.sampleRate = SampleRate::RATE_44100; | 101 | return Void(); |
70 | codec.bitsPerSample = BitsPerSample::BITS_16; | ||
71 | codec.channelMode = ChannelMode::STEREO; | ||
72 | codec.encodedAudioBitrate = 320000; | ||
73 | codec.peerMtu = 1000; | ||
74 | } | ||
75 | |||
76 | virtual void TearDown() override {} | ||
77 | |||
78 | // A simple test implementation of IBluetoothAudioHost. | ||
79 | class BluetoothAudioHost | ||
80 | : public ::testing::VtsHalHidlTargetCallbackBase<BluetoothA2dpHidlTest>, | ||
81 | public IBluetoothAudioHost { | ||
82 | BluetoothA2dpHidlTest& parent_; | ||
83 | |||
84 | public: | ||
85 | BluetoothAudioHost(BluetoothA2dpHidlTest& parent) : parent_(parent){}; | ||
86 | virtual ~BluetoothAudioHost() = default; | ||
87 | |||
88 | Return<void> startStream() override { | ||
89 | parent_.audio_offload->streamStarted(Status::SUCCESS); | ||
90 | return Void(); | ||
91 | }; | ||
92 | |||
93 | Return<void> suspendStream() override { | ||
94 | parent_.audio_offload->streamSuspended(Status::SUCCESS); | ||
95 | return Void(); | ||
96 | }; | ||
97 | |||
98 | Return<void> stopStream() override { return Void(); }; | ||
99 | }; | 102 | }; |
100 | 103 | ||
101 | // audio_host is for the Audio HAL to send stream start/suspend/stop commands to Bluetooth | 104 | Return<void> stopStream() override { return Void(); }; |
102 | sp<IBluetoothAudioHost> audio_host; | 105 | }; |
103 | // audio_offload is for the Bluetooth HAL to report session started/ended and handled audio | 106 | |
104 | // stream started/suspended | 107 | // audio_host is for the Audio HAL to send stream start/suspend/stop commands |
105 | sp<IBluetoothAudioOffload> audio_offload; | 108 | // to Bluetooth |
106 | // codec is the currently used codec | 109 | sp<IBluetoothAudioHost> audio_host; |
107 | CodecConfiguration codec; | 110 | // audio_offload is for the Bluetooth HAL to report session started/ended and |
111 | // handled audio stream started/suspended | ||
112 | sp<IBluetoothAudioOffload> audio_offload; | ||
113 | // codec is the currently used codec | ||
114 | CodecConfiguration codec; | ||
108 | }; | 115 | }; |
109 | 116 | ||
110 | // Empty test: Initialize()/Close() are called in SetUp()/TearDown(). | 117 | // Empty test: Initialize()/Close() are called in SetUp()/TearDown(). |
@@ -112,15 +119,15 @@ TEST_F(BluetoothA2dpHidlTest, InitializeAndClose) {} | |||
112 | 119 | ||
113 | // Test start and end session | 120 | // Test start and end session |
114 | TEST_F(BluetoothA2dpHidlTest, StartAndEndSession) { | 121 | TEST_F(BluetoothA2dpHidlTest, StartAndEndSession) { |
115 | EXPECT_EQ(Status::SUCCESS, audio_offload->startSession(audio_host, codec)); | 122 | EXPECT_EQ(Status::SUCCESS, audio_offload->startSession(audio_host, codec)); |
116 | audio_offload->endSession(); | 123 | audio_offload->endSession(); |
117 | } | 124 | } |
118 | 125 | ||
119 | int main(int argc, char** argv) { | 126 | int main(int argc, char** argv) { |
120 | ::testing::AddGlobalTestEnvironment(BluetoothA2dpHidlEnvironment::Instance()); | 127 | ::testing::AddGlobalTestEnvironment(BluetoothA2dpHidlEnvironment::Instance()); |
121 | ::testing::InitGoogleTest(&argc, argv); | 128 | ::testing::InitGoogleTest(&argc, argv); |
122 | BluetoothA2dpHidlEnvironment::Instance()->init(&argc, argv); | 129 | BluetoothA2dpHidlEnvironment::Instance()->init(&argc, argv); |
123 | int status = RUN_ALL_TESTS(); | 130 | int status = RUN_ALL_TESTS(); |
124 | LOG(INFO) << "Test result = " << status; | 131 | LOG(INFO) << "Test result = " << status; |
125 | return status; | 132 | return status; |
126 | } | 133 | } |