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

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

Issue 1215303006: bluetooth: android: Initial BluetoothDeviceAndroid implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-discovery-
Patch Set: Created 5 years, 5 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 b11e7d22c74eb1f6d57a1e87f7a25554fef4ae26..53d2010b539dcd2c4d4418f6533a6128a171a2c9 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
@@ -8,6 +8,7 @@ import android.annotation.TargetApi;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.le.ScanSettings;
import android.os.Build;
+import android.os.ParcelUuid;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
@@ -19,6 +20,8 @@ import java.util.List;
* Exposes android.bluetooth.BluetoothAdapter as necessary for C++
* device::BluetoothAdapterAndroid, which implements the cross platform
* device::BluetoothAdapter.
+ *
+ * Lifetime is controlled by device::BluetoothAdapterAndroid.
*/
@JNINamespace("device")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@@ -219,6 +222,11 @@ final class ChromeBluetoothAdapter {
public void onScanResultWrapper(int callbackType, Wrappers.ScanResultWrapper result) {
Log.v(TAG, "onScanResult %d %s %s", callbackType, result.getDevice().getAddress(),
result.getDevice().getName());
+
+ List<ParcelUuid> uuids = result.getScanRecord_getServiceUuids();
+
+ nativeCreateOrUpdateDeviceOnScan(mNativeBluetoothAdapterAndroid,
+ result.getDevice().getAddress(), result.getDevice(), uuids);
}
@Override
@@ -234,4 +242,10 @@ final class ChromeBluetoothAdapter {
// Binds to BluetoothAdapterAndroid::OnScanFailed.
private native void nativeOnScanFailed(long nativeBluetoothAdapterAndroid);
+
+ // Binds to BluetoothAdapterAndroid::GetChromeBluetoothDevice.
Jeffrey Yasskin 2015/07/07 00:11:13 Why does "CreateOrUpdateDeviceOnScan" bind to "Get
scheib 2015/07/08 00:49:10 Done. - failed to update comment after updating me
+ // 'Object' type must be used because inner class Wrappers.BluetoothDeviceWrapper reference is
Jeffrey Yasskin 2015/07/07 00:11:13 "must be used for |bluetoothDeviceWrapper| because
scheib 2015/07/08 00:49:10 Done.
+ // not handled by jni_generator.py JavaToJni. http://crbug.com/505554
+ private native void nativeCreateOrUpdateDeviceOnScan(long nativeBluetoothAdapterAndroid,
+ String jaddress, Object bluetoothDeviceWrapper, List<ParcelUuid> advertisedUuids);
Jeffrey Yasskin 2015/07/07 00:11:13 "jaddress"?
scheib 2015/07/08 00:49:10 Done.
}

Powered by Google App Engine
This is Rietveld 408576698