Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2163)

Unified Diff: device/bluetooth/bluetooth_device_android.cc

Issue 2205693003: bluetooth: Replace old advertised uuids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Mac test and docs Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_device_android.cc
diff --git a/device/bluetooth/bluetooth_device_android.cc b/device/bluetooth/bluetooth_device_android.cc
index ca182ca18f09b692630b76785e8fea4ac9fb162b..bfd2ea642e2b0fe986f81ee2c3da181c455f43c0 100644
--- a/device/bluetooth/bluetooth_device_android.cc
+++ b/device/bluetooth/bluetooth_device_android.cc
@@ -51,9 +51,13 @@ BluetoothDeviceAndroid::~BluetoothDeviceAndroid() {
AttachCurrentThread(), j_device_.obj());
}
-bool BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(jobject advertised_uuids) {
- return Java_ChromeBluetoothDevice_updateAdvertisedUUIDs(
- AttachCurrentThread(), j_device_.obj(), advertised_uuids);
+void BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(
+ jobjectArray advertised_uuids) {
+ JNIEnv* env = AttachCurrentThread();
+ std::vector<std::string> uuid_strings;
+ AppendJavaStringArrayToStringVector(env, advertised_uuids, &uuid_strings);
+
+ advertised_uuids_ = UUIDList(uuid_strings.begin(), uuid_strings.end());
}
// static
@@ -135,20 +139,6 @@ bool BluetoothDeviceAndroid::IsConnecting() const {
return false;
}
-BluetoothDevice::UUIDList BluetoothDeviceAndroid::GetUUIDs() const {
- JNIEnv* env = AttachCurrentThread();
- std::vector<std::string> uuid_strings;
- AppendJavaStringArrayToStringVector(
- env, Java_ChromeBluetoothDevice_getUuids(env, j_device_.obj()).obj(),
- &uuid_strings);
- BluetoothDevice::UUIDList uuids;
- uuids.reserve(uuid_strings.size());
- for (auto uuid_string : uuid_strings) {
- uuids.push_back(BluetoothUUID(uuid_string));
- }
- return uuids;
-}
-
int16_t BluetoothDeviceAndroid::GetInquiryRSSI() const {
NOTIMPLEMENTED();
return kUnknownPower;
@@ -252,6 +242,7 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(
// Otherwise an existing connection was terminated.
RecordConnectionTerminatedResult(status);
gatt_services_.clear();
+ service_uuids_.clear();
SetGattServicesDiscoveryComplete(false);
DidDisconnectGatt();
}
@@ -260,6 +251,7 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(
void BluetoothDeviceAndroid::OnGattServicesDiscovered(
JNIEnv* env,
const JavaParamRef<jobject>& jcaller) {
+ UpdateServiceUUIDs();
SetGattServicesDiscoveryComplete(true);
adapter_->NotifyGattServicesDiscovered(this);
}

Powered by Google App Engine
This is Rietveld 408576698