Replace usage of "vector<>" with "std::vector<>"
This change is needed so we can remove the last instances
of "using std::vector" statements in hardware/libhardware.
Test: code compilation
Change-Id: I6a9fc62152371d1bba6ead71e7ff8c2610799637
diff --git a/service/gatt_server.cc b/service/gatt_server.cc
index 1d59773..e4a6ec5 100644
--- a/service/gatt_server.cc
+++ b/service/gatt_server.cc
@@ -297,7 +297,7 @@
void GattServer::ServiceAddedCallback(hal::BluetoothGattInterface* gatt_iface,
int status, int server_id,
- vector<btgatt_db_element_t> svc) {
+ std::vector<btgatt_db_element_t> svc) {
lock_guard<mutex> lock(mutex_);
if (server_id != server_id_) return;
@@ -407,7 +407,7 @@
void GattServer::RequestWriteCharacteristicCallback(
hal::BluetoothGattInterface* /* gatt_iface */, int conn_id, int trans_id,
const bt_bdaddr_t& bda, int attr_handle, int offset, bool need_rsp,
- bool is_prep, vector<uint8_t> value) {
+ bool is_prep, std::vector<uint8_t> value) {
lock_guard<mutex> lock(mutex_);
// Check to see if we know about this connection. Otherwise ignore the
@@ -446,7 +446,7 @@
void GattServer::RequestWriteDescriptorCallback(
hal::BluetoothGattInterface* /* gatt_iface */, int conn_id, int trans_id,
const bt_bdaddr_t& bda, int attr_handle, int offset, bool need_rsp,
- bool is_prep, vector<uint8_t> value) {
+ bool is_prep, std::vector<uint8_t> value) {
lock_guard<mutex> lock(mutex_);
// Check to see if we know about this connection. Otherwise ignore the
diff --git a/service/gatt_server.h b/service/gatt_server.h
index 86dd0db..84ee165 100644
--- a/service/gatt_server.h
+++ b/service/gatt_server.h
@@ -196,7 +196,7 @@
const bt_bdaddr_t& bda) override;
void ServiceAddedCallback(hal::BluetoothGattInterface* gatt_iface, int status,
int server_if,
- vector<btgatt_db_element_t>) override;
+ std::vector<btgatt_db_element_t>) override;
void ServiceStoppedCallback(hal::BluetoothGattInterface* gatt_iface,
int status, int server_id,
int service_handle) override;
@@ -212,12 +212,12 @@
void RequestWriteCharacteristicCallback(
hal::BluetoothGattInterface* gatt_iface, int conn_id, int trans_id,
const bt_bdaddr_t& bda, int attr_handle, int offset, bool need_rsp,
- bool is_prep, vector<uint8_t> value) override;
+ bool is_prep, std::vector<uint8_t> value) override;
void RequestWriteDescriptorCallback(hal::BluetoothGattInterface* gatt_iface,
int conn_id, int trans_id,
const bt_bdaddr_t& bda, int attr_handle,
int offset, bool need_rsp, bool is_prep,
- vector<uint8_t> value) override;
+ std::vector<uint8_t> value) override;
void RequestExecWriteCallback(hal::BluetoothGattInterface* gatt_iface,
int conn_id, int trans_id,
const bt_bdaddr_t& bda,
diff --git a/service/gatt_server_old.cc b/service/gatt_server_old.cc
index ec5f8ff..c71ceda 100644
--- a/service/gatt_server_old.cc
+++ b/service/gatt_server_old.cc
@@ -139,7 +139,7 @@
}
void ServiceAddedCallback(int status, int server_if,
- vector<btgatt_db_element_t> service) {
+ std::vector<btgatt_db_element_t> service) {
LOG_INFO(LOG_TAG, "%s: status:%d server_if:%d count:%zu svc_handle:%d",
__func__, status, server_if, service.size(),
service[0].attribute_handle);
@@ -248,7 +248,7 @@
void RequestWriteCallback(int conn_id, int trans_id, bt_bdaddr_t* bda,
int attr_handle, int attribute_offset, bool need_rsp,
- bool is_prep, vector<uint8_t> value) {
+ bool is_prep, std::vector<uint8_t> value) {
std::string addr(BtAddrString(bda));
LOG_INFO(LOG_TAG,
"%s: connection:%d (%s:trans:%d) write attr:%d attribute_offset:%d "
@@ -374,7 +374,8 @@
g_internal->api_synchronize.notify_one();
}
-void ScanResultCallback(bt_bdaddr_t* bda, int rssi, vector<uint8_t> adv_data) {
+void ScanResultCallback(bt_bdaddr_t* bda, int rssi,
+ std::vector<uint8_t> adv_data) {
std::string addr(BtAddrString(bda));
(void)adv_data;
std::lock_guard<std::mutex> lock(g_internal->lock);
diff --git a/service/hal/bluetooth_gatt_interface.cc b/service/hal/bluetooth_gatt_interface.cc
index ecabc57..ff54b63 100644
--- a/service/hal/bluetooth_gatt_interface.cc
+++ b/service/hal/bluetooth_gatt_interface.cc
@@ -99,8 +99,9 @@
RegisterScannerCallback(g_interface, status, scanner_id, *app_uuid));
}
-void ScanResultCallback(bt_bdaddr_t* bda, int rssi,
- vector<uint8_t> adv_data) { // NOLINT(pass-by-value)
+void ScanResultCallback(
+ bt_bdaddr_t* bda, int rssi,
+ std::vector<uint8_t> adv_data) { // NOLINT(pass-by-value)
shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
CHECK(bda);
@@ -252,7 +253,7 @@
void ServiceAddedCallback(
int status, int server_if,
- vector<btgatt_db_element_t> service) { // NOLINT(pass-by-value)
+ std::vector<btgatt_db_element_t> service) { // NOLINT(pass-by-value)
shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " server_if: " << server_if
<< " count: " << service.size();
@@ -313,7 +314,7 @@
void RequestWriteCharacteristicCallback(int conn_id, int trans_id,
bt_bdaddr_t* bda, int attr_handle,
int offset, bool need_rsp, bool is_prep,
- vector<uint8_t> value) {
+ std::vector<uint8_t> value) {
shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " attr_handle: " << attr_handle << " offset: " << offset
@@ -330,7 +331,7 @@
void RequestWriteDescriptorCallback(
int conn_id, int trans_id, bt_bdaddr_t* bda, int attr_handle, int offset,
bool need_rsp, bool is_prep,
- vector<uint8_t> value) { // NOLINT(pass-by-value)
+ std::vector<uint8_t> value) { // NOLINT(pass-by-value)
shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " attr_handle: " << attr_handle << " offset: " << offset
@@ -581,7 +582,8 @@
void BluetoothGattInterface::ScannerObserver::ScanResultCallback(
BluetoothGattInterface* /* gatt_iface */, const bt_bdaddr_t& /* bda */,
- int /* rssi */, vector<uint8_t> /* adv_data */) { // NOLINT(pass-by-value)
+ int /* rssi */,
+ std::vector<uint8_t> /* adv_data */) { // NOLINT(pass-by-value)
// Do Nothing.
}
@@ -672,7 +674,7 @@
void BluetoothGattInterface::ServerObserver::ServiceAddedCallback(
BluetoothGattInterface* /* gatt_iface */, int /* status */,
int /* server_if */,
- vector<btgatt_db_element_t> /* service */) { // NOLINT(pass-by-value)
+ std::vector<btgatt_db_element_t> /* service */) { // NOLINT(pass-by-value)
// Do nothing.
}
@@ -706,7 +708,7 @@
BluetoothGattInterface* /* gatt_iface */, int /* conn_id */,
int /* trans_id */, const bt_bdaddr_t& /* bda */, int /* attr_handle */,
int /* offset */, bool /* need_rsp */, bool /* is_prep */,
- vector<uint8_t> /* value */) { // NOLINT(pass-by-value)
+ std::vector<uint8_t> /* value */) { // NOLINT(pass-by-value)
// Do nothing.
}
@@ -714,7 +716,7 @@
BluetoothGattInterface* /* gatt_iface */, int /* conn_id */,
int /* trans_id */, const bt_bdaddr_t& /* bda */, int /* attr_handle */,
int /* offset */, bool /* need_rsp */, bool /* is_prep */,
- vector<uint8_t> /* value */) { // NOLINT(pass-by-value)
+ std::vector<uint8_t> /* value */) { // NOLINT(pass-by-value)
// Do nothing.
}
diff --git a/service/hal/bluetooth_gatt_interface.h b/service/hal/bluetooth_gatt_interface.h
index a4ad084..72ac823 100644
--- a/service/hal/bluetooth_gatt_interface.h
+++ b/service/hal/bluetooth_gatt_interface.h
@@ -58,7 +58,7 @@
virtual void ScanResultCallback(
BluetoothGattInterface* gatt_iface, const bt_bdaddr_t& bda, int rssi,
- vector<uint8_t> adv_data); // NOLINT(pass-by-value)
+ std::vector<uint8_t> adv_data); // NOLINT(pass-by-value)
};
// The standard BT-GATT client callback interface.
@@ -130,7 +130,7 @@
virtual void ServiceAddedCallback(
BluetoothGattInterface* gatt_iface, int status, int server_if,
- vector<btgatt_db_element_t> service); // NOLINT(pass-by-value)
+ std::vector<btgatt_db_element_t> service); // NOLINT(pass-by-value)
virtual void ServiceStoppedCallback(BluetoothGattInterface* gatt_iface,
int status, int server_if,
@@ -152,13 +152,13 @@
BluetoothGattInterface* gatt_iface, int conn_id, int trans_id,
const bt_bdaddr_t& bda, int attr_handle, int offset, bool need_rsp,
bool is_prep,
- vector<uint8_t> value); // NOLINT(pass-by-value)
+ std::vector<uint8_t> value); // NOLINT(pass-by-value)
virtual void RequestWriteDescriptorCallback(
BluetoothGattInterface* gatt_iface, int conn_id, int trans_id,
const bt_bdaddr_t& bda, int attr_handle, int offset, bool need_rsp,
bool is_prep,
- vector<uint8_t> value); // NOLINT(pass-by-alue)
+ std::vector<uint8_t> value); // NOLINT(pass-by-alue)
virtual void RequestExecWriteCallback(BluetoothGattInterface* gatt_iface,
int conn_id, int trans_id,
diff --git a/service/hal/fake_bluetooth_gatt_interface.cc b/service/hal/fake_bluetooth_gatt_interface.cc
index 911de2e..d7d84d7 100644
--- a/service/hal/fake_bluetooth_gatt_interface.cc
+++ b/service/hal/fake_bluetooth_gatt_interface.cc
@@ -87,7 +87,8 @@
return BT_STATUS_FAIL;
}
-bt_status_t FakeAddService(int server_if, vector<btgatt_db_element_t> service) {
+bt_status_t FakeAddService(int server_if,
+ std::vector<btgatt_db_element_t> service) {
if (g_server_handler)
return g_server_handler->AddService(server_if, std::move(service));
@@ -102,7 +103,7 @@
}
bt_status_t FakeSendIndication(int server_if, int attribute_handle, int conn_id,
- int confirm, vector<uint8_t> value) {
+ int confirm, std::vector<uint8_t> value) {
if (g_server_handler)
return g_server_handler->SendIndication(server_if, attribute_handle,
conn_id, confirm, std::move(value));
@@ -209,7 +210,7 @@
}
void FakeBluetoothGattInterface::NotifyScanResultCallback(
- const bt_bdaddr_t& bda, int rssi, vector<uint8_t> adv_data) {
+ const bt_bdaddr_t& bda, int rssi, std::vector<uint8_t> adv_data) {
FOR_EACH_OBSERVER(ScannerObserver, scanner_observers_,
ScanResultCallback(this, bda, rssi, adv_data));
}
@@ -247,7 +248,7 @@
}
void FakeBluetoothGattInterface::NotifyServiceAddedCallback(
- int status, int server_if, vector<btgatt_db_element_t> service) {
+ int status, int server_if, std::vector<btgatt_db_element_t> service) {
FOR_EACH_OBSERVER(ServerObserver, server_observers_,
ServiceAddedCallback(this, status, server_if, service));
}
@@ -272,7 +273,7 @@
void FakeBluetoothGattInterface::NotifyRequestWriteCharacteristicCallback(
int conn_id, int trans_id, const bt_bdaddr_t& bda, int attr_handle,
- int offset, bool need_rsp, bool is_prep, vector<uint8_t> value) {
+ int offset, bool need_rsp, bool is_prep, std::vector<uint8_t> value) {
FOR_EACH_OBSERVER(ServerObserver, server_observers_,
RequestWriteCharacteristicCallback(
this, conn_id, trans_id, bda, attr_handle, offset,
@@ -281,7 +282,7 @@
void FakeBluetoothGattInterface::NotifyRequestWriteDescriptorCallback(
int conn_id, int trans_id, const bt_bdaddr_t& bda, int attr_handle,
- int offset, bool need_rsp, bool is_prep, vector<uint8_t> value) {
+ int offset, bool need_rsp, bool is_prep, std::vector<uint8_t> value) {
FOR_EACH_OBSERVER(
ServerObserver, server_observers_,
RequestWriteDescriptorCallback(this, conn_id, trans_id, bda, attr_handle,
diff --git a/service/hal/fake_bluetooth_gatt_interface.h b/service/hal/fake_bluetooth_gatt_interface.h
index 5d4005b..3e79f52 100644
--- a/service/hal/fake_bluetooth_gatt_interface.h
+++ b/service/hal/fake_bluetooth_gatt_interface.h
@@ -64,12 +64,12 @@
virtual bt_status_t RegisterServer(bt_uuid_t* app_uuid) = 0;
virtual bt_status_t UnregisterServer(int server_if) = 0;
- virtual bt_status_t AddService(int server_if,
- vector<btgatt_db_element_t> service) = 0;
+ virtual bt_status_t AddService(
+ int server_if, std::vector<btgatt_db_element_t> service) = 0;
virtual bt_status_t DeleteService(int server_if, int srvc_handle) = 0;
virtual bt_status_t SendIndication(int server_if, int attribute_handle,
int conn_id, int confirm,
- vector<uint8_t> value) = 0;
+ std::vector<uint8_t> value) = 0;
virtual bt_status_t SendResponse(int conn_id, int trans_id, int status,
btgatt_response_t* response) = 0;
};
@@ -90,7 +90,7 @@
void NotifyRegisterScannerCallback(int status, int client_if,
const bt_uuid_t& app_uuid);
void NotifyScanResultCallback(const bt_bdaddr_t& bda, int rssi,
- vector<uint8_t> adv_data);
+ std::vector<uint8_t> adv_data);
// Client callbacks:
void NotifyRegisterClientCallback(int status, int client_if,
@@ -106,7 +106,7 @@
void NotifyServerConnectionCallback(int conn_id, int server_if, int connected,
const bt_bdaddr_t& bda);
void NotifyServiceAddedCallback(int status, int server_if,
- vector<btgatt_db_element_t> srvc);
+ std::vector<btgatt_db_element_t> srvc);
void NotifyCharacteristicAddedCallback(int status, int server_if,
const bt_uuid_t& uuid, int srvc_handle,
int char_handle);
@@ -126,12 +126,12 @@
const bt_bdaddr_t& bda,
int attr_handle, int offset,
bool need_rsp, bool is_prep,
- vector<uint8_t> value);
+ std::vector<uint8_t> value);
void NotifyRequestWriteDescriptorCallback(int conn_id, int trans_id,
const bt_bdaddr_t& bda,
int attr_handle, int offset,
bool need_rsp, bool is_prep,
- vector<uint8_t> value);
+ std::vector<uint8_t> value);
void NotifyRequestExecWriteCallback(int conn_id, int trans_id,
const bt_bdaddr_t& bda, int exec_write);
void NotifyIndicationSentCallback(int conn_id, int status);
diff --git a/service/low_energy_scanner.cc b/service/low_energy_scanner.cc
index b1d937a..c51ef3d 100644
--- a/service/low_energy_scanner.cc
+++ b/service/low_energy_scanner.cc
@@ -41,7 +41,7 @@
// Returns the length of the given scan record array. We have to calculate this
// based on the maximum possible data length and the TLV data. See TODO above
// |kScanRecordLength|.
-size_t GetScanRecordLength(vector<uint8_t> bytes) {
+size_t GetScanRecordLength(std::vector<uint8_t> bytes) {
for (size_t i = 0, field_len = 0; i < kScanRecordLength;
i += (field_len + 1)) {
field_len = bytes[i];
@@ -141,7 +141,7 @@
void LowEnergyScanner::ScanResultCallback(
hal::BluetoothGattInterface* gatt_iface, const bt_bdaddr_t& bda, int rssi,
- vector<uint8_t> adv_data) {
+ std::vector<uint8_t> adv_data) {
// Ignore scan results if this client didn't start a scan.
if (!scan_started_.load()) return;
diff --git a/service/low_energy_scanner.h b/service/low_energy_scanner.h
index 3d5cf13..f80e484 100644
--- a/service/low_energy_scanner.h
+++ b/service/low_energy_scanner.h
@@ -86,7 +86,7 @@
void ScanResultCallback(hal::BluetoothGattInterface* gatt_iface,
const bt_bdaddr_t& bda, int rssi,
- vector<uint8_t> adv_data) override;
+ std::vector<uint8_t> adv_data) override;
private:
friend class LowEnergyScannerFactory;
diff --git a/service/test/gatt_server_unittest.cc b/service/test/gatt_server_unittest.cc
index 3a3fbaf..ee88b99 100644
--- a/service/test/gatt_server_unittest.cc
+++ b/service/test/gatt_server_unittest.cc
@@ -35,13 +35,13 @@
MOCK_METHOD1(RegisterServer, bt_status_t(bt_uuid_t*));
MOCK_METHOD1(UnregisterServer, bt_status_t(int));
- MOCK_METHOD2(AddService, bt_status_t(int, vector<btgatt_db_element_t>));
+ MOCK_METHOD2(AddService, bt_status_t(int, std::vector<btgatt_db_element_t>));
MOCK_METHOD5(AddCharacteristic, bt_status_t(int, int, bt_uuid_t*, int, int));
MOCK_METHOD4(AddDescriptor, bt_status_t(int, int, bt_uuid_t*, int));
MOCK_METHOD3(StartService, bt_status_t(int, int, int));
MOCK_METHOD2(DeleteService, bt_status_t(int, int));
MOCK_METHOD5(SendIndication,
- bt_status_t(int, int, int, int, vector<uint8_t>));
+ bt_status_t(int, int, int, int, std::vector<uint8_t>));
MOCK_METHOD4(SendResponse, bt_status_t(int, int, int, btgatt_response_t*));
private:
@@ -266,7 +266,7 @@
char_handle_ = 0x0002;
desc_handle_ = 0x0004;
- vector<btgatt_db_element_t> service_with_handles = {
+ std::vector<btgatt_db_element_t> service_with_handles = {
{.type = BTGATT_DB_PRIMARY_SERVICE,
.uuid = uuid0.GetBlueDroid(),
.attribute_handle = srvc_handle_},
diff --git a/service/test/low_energy_advertiser_unittest.cc b/service/test/low_energy_advertiser_unittest.cc
index 9175755..dea7296 100644
--- a/service/test/low_energy_advertiser_unittest.cc
+++ b/service/test/low_energy_advertiser_unittest.cc
@@ -53,7 +53,7 @@
void(int advertiser_id, int min_interval, int max_interval,
int adv_type, int chnl_map, int tx_power, Callback cb));
MOCK_METHOD4(SetData, void(int advertiser_id, bool set_scan_rsp,
- vector<uint8_t> data, Callback cb));
+ std::vector<uint8_t> data, Callback cb));
MOCK_METHOD5(Enable, void(uint8_t advertiser_id, bool enable, Callback cb,
int timeout_s, Callback timeout_cb));
MOCK_METHOD7(StartAdvertising,
diff --git a/service/test/low_energy_scanner_unittest.cc b/service/test/low_energy_scanner_unittest.cc
index a56cf3f..9f592c2 100644
--- a/service/test/low_energy_scanner_unittest.cc
+++ b/service/test/low_energy_scanner_unittest.cc
@@ -281,9 +281,9 @@
EXPECT_EQ(0, delegate.scan_result_count());
- vector<uint8_t> kTestRecord0({0x02, 0x01, 0x00, 0x00});
- vector<uint8_t> kTestRecord1({0x00});
- vector<uint8_t> kTestRecord2(
+ std::vector<uint8_t> kTestRecord0({0x02, 0x01, 0x00, 0x00});
+ std::vector<uint8_t> kTestRecord1({0x00});
+ std::vector<uint8_t> kTestRecord2(
{0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
diff --git a/test/suite/gatt/gatt_test.cc b/test/suite/gatt/gatt_test.cc
index eec3040..7700cd9 100644
--- a/test/suite/gatt/gatt_test.cc
+++ b/test/suite/gatt/gatt_test.cc
@@ -100,7 +100,7 @@
void GattTest::ScanResultCallback(
bluetooth::hal::BluetoothGattInterface* /* unused */,
- const bt_bdaddr_t& bda, int rssi, vector<uint8_t> adv_data) {
+ const bt_bdaddr_t& bda, int rssi, std::vector<uint8_t> adv_data) {
semaphore_post(scan_result_callback_sem_);
}
@@ -115,7 +115,7 @@
void GattTest::ServiceAddedCallback(
bluetooth::hal::BluetoothGattInterface* /* unused */, int status,
- int server_if, vector<btgatt_db_element_t> service) {
+ int server_if, std::vector<btgatt_db_element_t> service) {
status_ = status;
server_interface_id_ = server_if;
service_handle_ = service[0].attribute_handle;
diff --git a/test/suite/gatt/gatt_test.h b/test/suite/gatt/gatt_test.h
index 5a1905b..038ca2b 100644
--- a/test/suite/gatt/gatt_test.h
+++ b/test/suite/gatt/gatt_test.h
@@ -62,7 +62,7 @@
int clientIf, const bt_uuid_t& app_uuid) override;
void ScanResultCallback(bluetooth::hal::BluetoothGattInterface* /* unused */,
const bt_bdaddr_t& bda, int rssi,
- vector<uint8_t> adv_data) override;
+ std::vector<uint8_t> adv_data) override;
// bluetooth::hal::BluetoothGattInterface::ServerObserver overrides
void RegisterServerCallback(
@@ -70,7 +70,7 @@
int server_if, const bt_uuid_t& uuid) override;
void ServiceAddedCallback(
bluetooth::hal::BluetoothGattInterface* /* unused */, int status,
- int server_if, vector<btgatt_db_element_t> service) override;
+ int server_if, std::vector<btgatt_db_element_t> service) override;
void ServiceStoppedCallback(
bluetooth::hal::BluetoothGattInterface* /* unused */, int status,
int server_if, int srvc_handle) override;
diff --git a/test/suite/gatt/gatt_unittest.cc b/test/suite/gatt/gatt_unittest.cc
index 5de9628..598ae41 100644
--- a/test/suite/gatt/gatt_unittest.cc
+++ b/test/suite/gatt/gatt_unittest.cc
@@ -87,7 +87,7 @@
// Adds service.
int server_if = server_interface_id();
- vector<btgatt_db_element_t> service = {
+ std::vector<btgatt_db_element_t> service = {
{.type = BTGATT_DB_PRIMARY_SERVICE, .uuid = srvc_uuid},
{.type = BTGATT_DB_CHARACTERISTIC,
.uuid = char_uuid,