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

Unified Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java

Issue 2244693002: bluetooth: Refactor how we update based on Advertising Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java
index d487ad9805b7b1ff7f862bf21725a7bea8b099af..683de40ea8ece0091db574b8f141aac1bd61468a 100644
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java
@@ -19,7 +19,6 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.components.location.LocationUtils;
-import java.util.HashSet;
import java.util.List;
/**
@@ -243,18 +242,20 @@ final class ChromeBluetoothAdapter extends BroadcastReceiver {
Log.v(TAG, "onScanResult %d %s %s", callbackType, result.getDevice().getAddress(),
result.getDevice().getName());
- HashSet<String> uuid_strings = new HashSet<>();
+ String[] uuid_strings;
List<ParcelUuid> uuids = result.getScanRecord_getServiceUuids();
- if (uuids != null) {
- for (ParcelUuid uuid : uuids) {
- uuid_strings.add(uuid.toString());
+ if (uuids == null) {
+ uuid_strings = new String[] {};
+ } else {
+ uuid_strings = new String[uuids.size()];
+ for (int i = 0; i < uuids.size(); i++) {
+ uuid_strings[i] = uuids.get(i).toString();
}
}
nativeCreateOrUpdateDeviceOnScan(mNativeBluetoothAdapterAndroid,
- result.getDevice().getAddress(), result.getDevice(),
- uuid_strings.toArray(new String[uuid_strings.size()]));
+ result.getDevice().getAddress(), result.getDevice(), uuid_strings);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698