| Index: device/bluetooth/bluetooth_adapter_android.cc
|
| diff --git a/device/bluetooth/bluetooth_adapter_android.cc b/device/bluetooth/bluetooth_adapter_android.cc
|
| index 41228bb635bae3ac24c26c8b50bb22d539a22013..b435ce1677982d603487e35ce94ca5a2b6614ff1 100644
|
| --- a/device/bluetooth/bluetooth_adapter_android.cc
|
| +++ b/device/bluetooth/bluetooth_adapter_android.cc
|
| @@ -180,6 +180,7 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan(
|
| const JavaParamRef<jobject>&
|
| bluetooth_device_wrapper, // Java Type: bluetoothDeviceWrapper
|
| int32_t rssi,
|
| + const JavaParamRef<jstring>& device_name,
|
| const JavaParamRef<jobjectArray>& advertised_uuids, // Java Type: String[]
|
| int32_t tx_power) {
|
| std::string device_address = ConvertJavaStringToUTF8(env, address);
|
| @@ -201,6 +202,11 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan(
|
| }
|
| DCHECK(device_android);
|
|
|
| + base::Optional<std::string> name =
|
| + device_name.is_null() ? base::nullopt
|
| + : base::make_optional<std::string>(
|
| + ConvertJavaStringToUTF8(env, device_name));
|
| +
|
| std::vector<std::string> advertised_uuids_strings;
|
| AppendJavaStringArrayToStringVector(env, advertised_uuids,
|
| &advertised_uuids_strings);
|
| @@ -212,8 +218,8 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan(
|
| int8_t clamped_tx_power = BluetoothDevice::ClampPower(tx_power);
|
|
|
| device_android->UpdateAdvertisementData(
|
| - BluetoothDevice::ClampPower(rssi), std::move(advertised_bluetooth_uuids),
|
| - {} /* service_data */,
|
| + BluetoothDevice::ClampPower(rssi), name ? &name.value() : nullptr,
|
| + std::move(advertised_bluetooth_uuids), {} /* service_data */,
|
| // Android uses INT32_MIN to indicate no Advertised Tx Power.
|
| // https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html#getTxPowerLevel()
|
| tx_power == INT32_MIN ? nullptr : &clamped_tx_power);
|
|
|