ukhsa-collaboration / COVID-19-app-iOS-BETA

Source code of the Beta of the NHS COVID-19 iOS app

Home Page:https://covid19.nhs.uk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android device supporting BLE receive only

freddychoi opened this issue · comments

Android devices may only support BLE receive, not broadcast. The current BLE data exchange protocol in the COVID-19 app will result in a "receive only Android device" recording the broadcast payload, but the other device will not detect or record the contact.

Steps to reproduce the behaviour

  1. Install app on Samsung J6 (supports BLE scan, connect but not broadcast)
  2. Install app on iPhone (supports both)
  3. Run app
  4. J6 should detect iPhone, but not the other way around

Expected behaviour
Both phones should detect each other to generate similar records on both phones, otherwise if the iPhone user becomes ill, the J6 user will not be notified. This is also necessary if there are any plans to switch to a decentralised model in the future.

Mitigations

  1. Add write-only characteristic to enable receive only devices to submit broadcast payload via data channel (preferred option that also enable decentralisation in the future).
  2. Infer symmetric contact records in central server. If the iPhone user becomes unwell and shares his/her contact records (not showing contacts with the J6), and the J6 user has already shared his/her records (showing contacts with the iPhone), the server can infer that the J6 should have been in contact with the iPhone (from the J6 records), and therefore notify the J6 user. This is a risky option, as the J6 user would not be notified if he/she has never submitted their records, i.e. they were never ill and therefore not notified.

Thanks for this detailed report. Can I just clarify two things?

  1. Are you seeing this behaviour on a physical device or an emulator?
  2. Is this an issue specific to the J6?
commented

thank you @freddychoi, is there a repository to check your code?

Good morning @lp74 , my code is not in a public repo yet as I'm still making changes, but the beacon code is relatively stable and entirely compatible with the iOS beacon code I've passed to Terence. Please find attached the relevant source files for the beacon transmitter and receiver code, apologies in advance for the sparse comments. I've been using a TestActivity (see "gui/TestActivity.java" to run a simple beacon for iOS compatibility testing.

The code specific to this issue can be found in "beacon/ble3/BLETransmitter.java", specifically the line in the constructor ...

this.bluetoothLeAdvertiser = (bluetoothAdapter != null && bluetoothAdapter.isMultipleAdvertisementSupported() ? bluetoothAdapter.getBluetoothLeAdvertiser() : null);

... even if you change it to ...

this.bluetoothLeAdvertiser = (bluetoothAdapter != null ? bluetoothAdapter.getBluetoothLeAdvertiser() : null);

... the outcome is still the same ... bluetoothLeAdvertiser is null, thus making it impossible to advertise (bluetoothAdapter is definitely not null). The same code works fine on devices that supports both transmit and receive.

C19X-BeaconExtract-20200521.zip

commented

Thank you @freddychoi,
I've checked very quickly.

When the bluetoothLeAdvertiser is null do you use the GATT? Right? I should read more carefully but I haven't seen yet the point of choice.

Good morning @lp74
That is correct. When bluetoothLeAdvertiser is null, it will use GATT instead to send the beacon code and RSSI as data. The decision point is in the file "beacon/ble3/BLEReceiver.java" on the line ... if (!C19XApplication.getBeaconTransmitter().isSupported()) { ...

I'm pasting this message in every active GitHub issue, so you may receive duplicate notifications.

Today, I'm happy to announce that NHSX has released the full git commit history for the Isle of Wight Beta apps.

As discussed, we have redacted API keys, sensitive domain names, and some of the developers' personal details. I am still waiting on final approval to publish the server-side code.

I would like to personally thank the community for your comments, bug reports, and vulnerability disclosures. They all went into helping the development process.

The beta trial of this app has now ended and we've moved to the next phase of app development. It is our intention to publish the source code of future apps as the binaries are released to the public.

Once again, thank you for being part of this.

Terence Eden
Head of Open Technology - NHSX