Commit 0c8c5dae authored by Anton Bershanskiy's avatar Anton Bershanskiy Committed by Commit Bot

Bluetooth: propagate advertising flags on Android

Added getScanRecord_getAdvertiseFlags() to ScanResultWrapper to be
called by ScanCallback.onScanResult to pass to
ChromeBluetoothAdapterJni.get().createOrUpdateDeviceOnScan() which
sends them to UpdateAdvertisementData().

Bug: 661814
Change-Id: Iad8c49936a796d4ca4ec39782c0f28ea66286271
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144153Reviewed-by: default avatarOvidio de Jesús Ruiz-Henríquez <odejesush@chromium.org>
Commit-Queue: Ovidio de Jesús Ruiz-Henríquez <odejesush@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758541}
parent 8519ac7c
...@@ -96,6 +96,7 @@ Anna Henningsen <anna@addaleax.net> ...@@ -96,6 +96,7 @@ Anna Henningsen <anna@addaleax.net>
Anne Kao <annekao94@gmail.com> Anne Kao <annekao94@gmail.com>
Anssi Hannula <anssi.hannula@iki.fi> Anssi Hannula <anssi.hannula@iki.fi>
Anthony Halliday <anth.halliday12@gmail.com> Anthony Halliday <anth.halliday12@gmail.com>
Anton Bershanskiy <bershanskiy@pm.me>
Anton Obzhirov <a.obzhirov@samsung.com> Anton Obzhirov <a.obzhirov@samsung.com>
Antonin Hildebrand <antonin.hildebrand@gmail.com> Antonin Hildebrand <antonin.hildebrand@gmail.com>
Antonio Gomes <a1.gomes@sisa.samsung.com> Antonio Gomes <a1.gomes@sisa.samsung.com>
......
...@@ -296,7 +296,8 @@ final class ChromeBluetoothAdapter extends BroadcastReceiver { ...@@ -296,7 +296,8 @@ final class ChromeBluetoothAdapter extends BroadcastReceiver {
result.getDevice().getAddress(), result.getDevice(), result.getDevice().getAddress(), result.getDevice(),
result.getScanRecord_getDeviceName(), result.getRssi(), uuid_strings, result.getScanRecord_getDeviceName(), result.getRssi(), uuid_strings,
result.getScanRecord_getTxPowerLevel(), serviceDataKeys, serviceDataValues, result.getScanRecord_getTxPowerLevel(), serviceDataKeys, serviceDataValues,
manufacturerDataKeys, manufacturerDataValues); manufacturerDataKeys, manufacturerDataValues,
result.getScanRecord_getAdvertiseFlags());
} }
} }
...@@ -360,7 +361,7 @@ final class ChromeBluetoothAdapter extends BroadcastReceiver { ...@@ -360,7 +361,7 @@ final class ChromeBluetoothAdapter extends BroadcastReceiver {
Wrappers.BluetoothDeviceWrapper deviceWrapper, String localName, int rssi, Wrappers.BluetoothDeviceWrapper deviceWrapper, String localName, int rssi,
String[] advertisedUuids, int txPower, String[] serviceDataKeys, String[] advertisedUuids, int txPower, String[] serviceDataKeys,
Object[] serviceDataValues, int[] manufacturerDataKeys, Object[] serviceDataValues, int[] manufacturerDataKeys,
Object[] manufacturerDataValues); Object[] manufacturerDataValues, int advertiseFlags);
// Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged // Binds to BluetoothAdapterAndroid::nativeOnAdapterStateChanged
void onAdapterStateChanged( void onAdapterStateChanged(
......
...@@ -314,6 +314,10 @@ class Wrappers { ...@@ -314,6 +314,10 @@ class Wrappers {
public String getScanRecord_getDeviceName() { public String getScanRecord_getDeviceName() {
return mScanResult.getScanRecord().getDeviceName(); return mScanResult.getScanRecord().getDeviceName();
} }
public int getScanRecord_getAdvertiseFlags() {
return mScanResult.getScanRecord().getAdvertiseFlags();
}
} }
/** /**
......
...@@ -178,8 +178,8 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan( ...@@ -178,8 +178,8 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan(
const JavaParamRef<jobjectArray>& service_data_values, // Java Type: byte[] const JavaParamRef<jobjectArray>& service_data_values, // Java Type: byte[]
const JavaParamRef<jintArray>& manufacturer_data_keys, // Java Type: int[] const JavaParamRef<jintArray>& manufacturer_data_keys, // Java Type: int[]
const JavaParamRef<jobjectArray>& const JavaParamRef<jobjectArray>&
manufacturer_data_values // Java Type: byte[] manufacturer_data_values, // Java Type: byte[]
) { int32_t advertisement_flags) {
std::string device_address = ConvertJavaStringToUTF8(env, address); std::string device_address = ConvertJavaStringToUTF8(env, address);
auto iter = devices_.find(device_address); auto iter = devices_.find(device_address);
...@@ -235,7 +235,11 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan( ...@@ -235,7 +235,11 @@ void BluetoothAdapterAndroid::CreateOrUpdateDeviceOnScan(
int8_t clamped_tx_power = BluetoothDevice::ClampPower(tx_power); int8_t clamped_tx_power = BluetoothDevice::ClampPower(tx_power);
device_android->UpdateAdvertisementData( device_android->UpdateAdvertisementData(
BluetoothDevice::ClampPower(rssi), base::nullopt /* flags */, BluetoothDevice::ClampPower(rssi),
// Android uses -1 to indicate no advertising flags.
// https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html#getAdvertiseFlags()
advertisement_flags == -1 ? base::nullopt
: base::make_optional(advertisement_flags),
advertised_bluetooth_uuids, advertised_bluetooth_uuids,
// Android uses INT32_MIN to indicate no Advertised Tx Power. // Android uses INT32_MIN to indicate no Advertised Tx Power.
// https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html#getTxPowerLevel() // https://developer.android.com/reference/android/bluetooth/le/ScanRecord.html#getTxPowerLevel()
......
...@@ -104,8 +104,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterAndroid final ...@@ -104,8 +104,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterAndroid final
const base::android::JavaParamRef<jintArray>& const base::android::JavaParamRef<jintArray>&
manufacturer_data_keys, // Java Type: int[] manufacturer_data_keys, // Java Type: int[]
const base::android::JavaParamRef<jobjectArray>& const base::android::JavaParamRef<jobjectArray>&
manufacturer_data_values // Java Type: byte[] manufacturer_data_values, // Java Type: byte[]
); int32_t advertisement_flags);
protected: protected:
BluetoothAdapterAndroid(); BluetoothAdapterAndroid();
......
...@@ -365,7 +365,7 @@ TEST_F(BluetoothTest, MAYBE_GetServiceDataUUIDs_GetServiceDataForUUID) { ...@@ -365,7 +365,7 @@ TEST_F(BluetoothTest, MAYBE_GetServiceDataUUIDs_GetServiceDataForUUID) {
// Receive Advertisement with service data. // Receive Advertisement with service data.
BluetoothDevice* device2 = SimulateLowEnergyDevice(1); BluetoothDevice* device2 = SimulateLowEnergyDevice(1);
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device2->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device2->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x04, device2->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x04, device2->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -405,7 +405,7 @@ TEST_F(BluetoothTest, MAYBE_GetServiceDataUUIDs_GetServiceDataForUUID) { ...@@ -405,7 +405,7 @@ TEST_F(BluetoothTest, MAYBE_GetServiceDataUUIDs_GetServiceDataForUUID) {
// Receive Advertisement with new service data and empty manufacturer data. // Receive Advertisement with new service data and empty manufacturer data.
SimulateLowEnergyDevice(2); SimulateLowEnergyDevice(2);
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device2->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device2->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x05, device2->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x05, device2->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -476,7 +476,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_Discovery) { ...@@ -476,7 +476,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_Discovery) {
EXPECT_EQ(0, observer.device_changed_count()); EXPECT_EQ(0, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -517,7 +517,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_Discovery) { ...@@ -517,7 +517,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_Discovery) {
EXPECT_EQ(2, observer.device_changed_count()); EXPECT_EQ(2, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -570,7 +570,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_Discovery) { ...@@ -570,7 +570,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_Discovery) {
EXPECT_EQ(4, observer.device_changed_count()); EXPECT_EQ(4, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -870,7 +870,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_DiscoveryDuringConnection) { ...@@ -870,7 +870,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_DiscoveryDuringConnection) {
EXPECT_EQ(UUIDSet({BluetoothUUID(kTestUUIDGenericAccess), EXPECT_EQ(UUIDSet({BluetoothUUID(kTestUUIDGenericAccess),
BluetoothUUID(kTestUUIDGenericAttribute)}), BluetoothUUID(kTestUUIDGenericAttribute)}),
device->GetUUIDs()); device->GetUUIDs());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -902,7 +902,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_DiscoveryDuringConnection) { ...@@ -902,7 +902,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_DiscoveryDuringConnection) {
EXPECT_EQ(3, observer.device_changed_count()); EXPECT_EQ(3, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -987,7 +987,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) { ...@@ -987,7 +987,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) {
EXPECT_EQ(0, observer.device_changed_count()); EXPECT_EQ(0, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -1018,7 +1018,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) { ...@@ -1018,7 +1018,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) {
EXPECT_EQ(1, observer.device_changed_count()); EXPECT_EQ(1, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -1058,7 +1058,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) { ...@@ -1058,7 +1058,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) {
EXPECT_EQ(3, observer.device_changed_count()); EXPECT_EQ(3, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWER), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x05, device->GetAdvertisingDataFlags().value());
#endif #endif
...@@ -1082,7 +1082,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) { ...@@ -1082,7 +1082,7 @@ TEST_F(BluetoothTest, MAYBE_AdvertisementData_ConnectionDuringDiscovery) {
EXPECT_EQ(4, observer.device_changed_count()); EXPECT_EQ(4, observer.device_changed_count());
EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value()); EXPECT_EQ(ToInt8(TestRSSI::LOWEST), device->GetInquiryRSSI().value());
#if defined(OS_WIN) #if defined(OS_WIN) || defined(OS_ANDROID)
EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value());
EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value()); EXPECT_EQ(0x04, device->GetAdvertisingDataFlags().value());
#endif #endif
......
...@@ -152,7 +152,7 @@ class Fakes { ...@@ -152,7 +152,7 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult(new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", new FakeScanResult(new FakeBluetoothDevice(this, "01:00:00:90:1E:BE",
"FakeBluetoothDevice"), "FakeBluetoothDevice"),
"FakeBluetoothDevice", TestRSSI.LOWEST, uuids, "FakeBluetoothDevice", TestRSSI.LOWEST, 4, uuids,
TestTxPower.LOWEST, serviceData, manufacturerData)); TestTxPower.LOWEST, serviceData, manufacturerData));
break; break;
} }
...@@ -173,8 +173,8 @@ class Fakes { ...@@ -173,8 +173,8 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult(new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", new FakeScanResult(new FakeBluetoothDevice(this, "01:00:00:90:1E:BE",
"FakeBluetoothDevice"), "FakeBluetoothDevice"),
"Local Device Name", TestRSSI.LOWER, uuids, TestTxPower.LOWER, "Local Device Name", TestRSSI.LOWER, 5, uuids,
serviceData, manufacturerData)); TestTxPower.LOWER, serviceData, manufacturerData));
break; break;
} }
case 3: { case 3: {
...@@ -182,7 +182,7 @@ class Fakes { ...@@ -182,7 +182,7 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult( new FakeScanResult(
new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", ""), new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", ""),
"Local Device Name", TestRSSI.LOW, uuids, NO_TX_POWER, null, "Local Device Name", TestRSSI.LOW, -1, uuids, NO_TX_POWER, null,
null)); null));
break; break;
...@@ -192,8 +192,8 @@ class Fakes { ...@@ -192,8 +192,8 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult( new FakeScanResult(
new FakeBluetoothDevice(this, "02:00:00:8B:74:63", ""), new FakeBluetoothDevice(this, "02:00:00:8B:74:63", ""),
"Local Device Name", TestRSSI.MEDIUM, uuids, NO_TX_POWER, null, "Local Device Name", TestRSSI.MEDIUM, -1, uuids, NO_TX_POWER,
null)); null, null));
break; break;
} }
...@@ -202,8 +202,8 @@ class Fakes { ...@@ -202,8 +202,8 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult( new FakeScanResult(
new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", null), new FakeBluetoothDevice(this, "01:00:00:90:1E:BE", null),
"Local Device Name", TestRSSI.HIGH, uuids, NO_TX_POWER, null, "Local Device Name", TestRSSI.HIGH, -1, uuids, NO_TX_POWER,
null)); null, null));
break; break;
} }
case 6: { case 6: {
...@@ -211,8 +211,8 @@ class Fakes { ...@@ -211,8 +211,8 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult( new FakeScanResult(
new FakeBluetoothDevice(this, "02:00:00:8B:74:63", null), new FakeBluetoothDevice(this, "02:00:00:8B:74:63", null),
"Local Device Name", TestRSSI.LOWEST, uuids, NO_TX_POWER, null, "Local Device Name", TestRSSI.LOWEST, -1, uuids, NO_TX_POWER,
null)); null, null));
break; break;
} }
case 7: { case 7: {
...@@ -226,7 +226,7 @@ class Fakes { ...@@ -226,7 +226,7 @@ class Fakes {
mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES, mFakeScanner.mScanCallback.onScanResult(ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
new FakeScanResult(new FakeBluetoothDevice( new FakeScanResult(new FakeBluetoothDevice(
this, "01:00:00:90:1E:BE", "U2F FakeDevice"), this, "01:00:00:90:1E:BE", "U2F FakeDevice"),
"Local Device Name", TestRSSI.LOWEST, uuids, NO_TX_POWER, "Local Device Name", TestRSSI.LOWEST, -1, uuids, NO_TX_POWER,
serviceData, null)); serviceData, null));
break; break;
} }
...@@ -370,17 +370,19 @@ class Fakes { ...@@ -370,17 +370,19 @@ class Fakes {
private final String mLocalName; private final String mLocalName;
private final int mRssi; private final int mRssi;
private final int mTxPower; private final int mTxPower;
private final int mAdvertisementFlags;
private final ArrayList<ParcelUuid> mUuids; private final ArrayList<ParcelUuid> mUuids;
private final Map<ParcelUuid, byte[]> mServiceData; private final Map<ParcelUuid, byte[]> mServiceData;
private final SparseArray<byte[]> mManufacturerData; private final SparseArray<byte[]> mManufacturerData;
FakeScanResult(FakeBluetoothDevice device, String localName, int rssi, FakeScanResult(FakeBluetoothDevice device, String localName, int rssi,
ArrayList<ParcelUuid> uuids, int txPower, Map<ParcelUuid, byte[]> serviceData, int advertisementFlags, ArrayList<ParcelUuid> uuids, int txPower,
SparseArray<byte[]> manufacturerData) { Map<ParcelUuid, byte[]> serviceData, SparseArray<byte[]> manufacturerData) {
super(null); super(null);
mDevice = device; mDevice = device;
mLocalName = localName; mLocalName = localName;
mRssi = rssi; mRssi = rssi;
mAdvertisementFlags = advertisementFlags;
mUuids = uuids; mUuids = uuids;
mTxPower = txPower; mTxPower = txPower;
mServiceData = serviceData; mServiceData = serviceData;
...@@ -421,6 +423,11 @@ class Fakes { ...@@ -421,6 +423,11 @@ class Fakes {
public String getScanRecord_getDeviceName() { public String getScanRecord_getDeviceName() {
return mLocalName; return mLocalName;
} }
@Override
public int getScanRecord_getAdvertiseFlags() {
return mAdvertisementFlags;
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment