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

Unified Diff: device/bluetooth/bluetooth_device_android.cc

Issue 2244693002: bluetooth: Refactor how we update based on Advertising Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo 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 bdc8f3b619d248050cafa530471fbc49331fbce4..df8725a295cd9516514c4256c529850b4e2ddc9d 100644
--- a/device/bluetooth/bluetooth_device_android.cc
+++ b/device/bluetooth/bluetooth_device_android.cc
@@ -6,7 +6,6 @@
#include "base/android/context_utils.h"
#include "base/android/jni_android.h"
-#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/metrics/sparse_histogram.h"
#include "base/strings/stringprintf.h"
@@ -15,7 +14,6 @@
#include "jni/ChromeBluetoothDevice_jni.h"
using base::android::AttachCurrentThread;
-using base::android::AppendJavaStringArrayToStringVector;
using base::android::JavaParamRef;
namespace device {
@@ -51,15 +49,6 @@ BluetoothDeviceAndroid::~BluetoothDeviceAndroid() {
AttachCurrentThread(), j_device_);
}
-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
bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) {
return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h
@@ -241,7 +230,7 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(
// Otherwise an existing connection was terminated.
RecordConnectionTerminatedResult(status);
gatt_services_.clear();
- service_uuids_.clear();
+ device_uuids_.ClearServiceUUIDs();
SetGattServicesDiscoveryComplete(false);
DidDisconnectGatt();
}
@@ -250,9 +239,10 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(
void BluetoothDeviceAndroid::OnGattServicesDiscovered(
JNIEnv* env,
const JavaParamRef<jobject>& jcaller) {
- UpdateServiceUUIDs();
+ device_uuids_.ReplaceServiceUUIDs(gatt_services_);
SetGattServicesDiscoveryComplete(true);
adapter_->NotifyGattServicesDiscovered(this);
+ adapter_->NotifyDeviceChanged(this);
}
void BluetoothDeviceAndroid::CreateGattRemoteService(

Powered by Google App Engine
This is Rietveld 408576698