Contrac

Rating: 
5
Your rating: None Average: 5 (13 votes)

Contrac is a beta-quality Corona-Warn-App compatible exposure notification app. It uses the Google/Apple Exposure Notification protocol and Germany's Corona-Warn-App backend servers.

The app supports sending/receiving exposure notification Bluetooth beacons, downloading and checking diagnosis keys from the servers and uploading positive test results using a TeleTAN.

The implementation is fully separate from the official implementations, so I can't offer any guarantee that it will necessarily work as expected. If you enter a TeleTAN it'll be officially registered (assuming the code works) so please only use it with real test results.

The app doesn't support the automatic download of test results using a QR code and it also requires nudging daily to download the diagnosis keys from the server. Both of these are being worked on.

The earlier alpha version of the app (thanks everyone for testing it) ran against a test instance of the official cwa test server. However, in practice the test server works slightly differently to the real thing. Therefore I'm afraid I can't offer any guarantee that the app will work as expected; please bear this in mind. It's also likely to affect your phone's battery life.

You use it at your own risk I'm afraid.

Having said that, if you discover it's not working as expected, or even if it is working as expected, please let me know or file a bug report.

Because the app requires Bluetooth 4.1 or later, it's unfortunately not compatible with Jolla 1 or Jolla C devices. I've also had reports it has problems on the Xperia X, but it should work on the later X devices.

Installing the app will install a background service that will continue to scan/broadcast even if you close the app. The service is stopped and uninstalled when you remove the app.

The source is available on github. PRs are welcome!

The 0.7.5-1 version of the app in the repo is built to be compatible with Sailfish OS 3.4.0. If you're running 3.3.0 or CBeta you'll need a different build, which you can download from here.

Screenshots: 
Application versions: 
AttachmentSizeDate
File harbour-contrac-0.0.1-1.armv7hl.rpm229.23 KB30/07/2020 - 22:54
File harbour-contrac-0.1.1-1.armv7hl.rpm236.98 KB09/08/2020 - 14:54
File harbour-contrac-0.2.1-1.armv7hl.rpm242.29 KB22/08/2020 - 16:52
File harbour-contrac-0.3.1-1.armv7hl.rpm244.41 KB24/08/2020 - 16:06
File harbour-contrac-0.4.1-1.armv7hl.rpm251.26 KB01/09/2020 - 18:49
File harbour-contrac-0.5.1-1.armv7hl.rpm274.71 KB07/09/2020 - 00:11
File harbour-contrac-0.6.1-1.armv7hl.rpm607.78 KB14/09/2020 - 23:10
File harbour-contrac-0.6.2-1.armv7hl.rpm607.89 KB16/09/2020 - 23:27
File harbour-contrac-0.7.1-1.armv7hl.rpm615.53 KB04/10/2020 - 18:54
File harbour-contrac-0.7.2-1.armv7hl.rpm622.56 KB05/10/2020 - 00:54
File harbour-contrac-0.7.3-1.armv7hl.rpm622.98 KB08/10/2020 - 20:30
File harbour-contrac-0.7.4-1.armv7hl.rpm622.87 KB08/10/2020 - 23:28
File harbour-contrac-0.7.4-2.armv7hl.rpm624.79 KB14/10/2020 - 00:08
File harbour-contrac-0.7.5-1.armv7hl.rpm619.87 KB02/01/2021 - 01:58
Changelog: 

* Tue July 7 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.0.1-1
- Initial alpha release.
- Supports beacon scan and send.

* Sun Aug 9 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.1.1-1
- Supports diagnosis key downloads from the test server.
- Supports diagnosis key upload to the test server.
- Adds a setting page for configurating the sever to use.

* Sat Aug 22 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.2.1-1
- Adds TeleTAN submission by the user.
- Adds separate pages to show upload and download progress.
- Improves error reporting for uploads and downloads.
- Streamlines the main page to remove progress indicators and add a status line.

* Mon Aug 24 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.3.1-1
- Adds persistent state to contracd.
- Send/received counts are now persistent.
- The enabled state of scanning/advertising is now persistent.
- The SIGINT signal is now handled by contracd.
- Diagnosis keys are now available for upload without needing to enable scan/receive.

* Tue Sep 1 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.4.1-1
- Adds encrypted beacon metadata send/receive.
- Refines the data aggregation algorithm to give improved results.
- Adds unit tests for metadata, metadata validity and data aggregation.
- Improves the beacon matching unit tests.

* Sun Sep 6 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.5.1-1
- Diagnosis key files are now tested directly after download.
- The risk status is shown in the UI, along with other useful info.

* Mon Sep 14 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.6.1-1
- Adds new Chinese translations.
- Adds an improved cover page with status and actions.
- Improves the About page, which now includes contributors.
- Adds support for configuring the device attenuation values.
- The risk configuration is downloaded from the Corona Warn App servers.

* Wed Sep 16 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.6.2-1
- Updates the Chinese translations.
- Fixes a timing bug so that an update can now be performed every day.

* Sun Oct 4 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.7.1-1
- Updates the Chinese translations, thanks to dashinfantry.
- Updates the German translations, thanks to spodermenpls.
- Switches to using the official Corona-Warn-App servers.
- Uses the server REST API rather than the S3 protocol for diagnosis key downloads.
- Allows network errors to be cleared by clicking on the label.
- Adds an info banner to the main app, warning that functionality isn't guaranteed.
- Old diagnosis key downloads are cleaned up if they're over 15 days old.
- Calculates the need for fresh downloads at startup based on cached folders.
- Performs the Corona-Warn-App specific "combined risk score" calculation.
- Uses the low/high risk threshold configuration downloaded from the server.

* Sun Oct 4 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.7.2-1
- Attempt to download data only from last 14 days (to avoid an error from day 15).

* Thu Oct 8 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.7.3-1
- Fix BLE state machine to allow graceful shutdown when filtering isn't supported.

* Thu Oct 8 2020 David Llewellyn-Jones <david@flypig.co.uk> 0.7.4-1
- Fix BLE state machine to allow graceful restart when filtering isn't supported.

* Fri Jan 1 2021 David Llewellyn-Jones <david@flypig.co.uk> 0.7.5-1
- Move risk calculation to a separate thread.
- Fix calculation to improve accuracy.
- Decouple calculation update from user interface app.
- Note the calculation now takes considerably longer.

 

Comments

Juna's picture

@flypig @tmojo thank you both. I now spent some time in the darkroom, some hours, when I could use the pbone again, it was done. So it might have needed something between an hour and three, but it's done. Very happy, thank you!

tmojo's picture

@Juna for me it tiok less than an hour. Unfortunately I didn't observe it constantly, I just realised that the update took significantly longer after I initiated it and forgot about it until I checked it again after one hour to find out that it had already finished updating.
If the duration of the update is related to the number of keys, I currently have aprox 7500 sent and 1200 received keys.

flypig's picture

In case it's of interest to you or others, the update is largely independent of how many keys you've sent/received and depends primarily on the number of keys downloaded from the server. In other words, the more postive test results recieved by the health authority, the longer it will take.

Juna's picture

How long would you mean as "considerably longer"? It's calculating over an hour now. Anything I could do?

flypig's picture

It depends on how many keys there are on the servers, but over an hour is normal. The best thing to do is to just let it run; you can close the app and the process will continue. I'm currently thinking about mitigations (see here and here) and please feel free to add your thoughts there. I'd be grateful for them.

objectifnul's picture

3.3.0.16 Rokua

flypig's picture

I've uploaded a version which should work with 3.3.0 to here.

You'll have to install it manually, and you should also be aware that you may not get future updates automatically afterwards I'm afraid.

slava's picture

Hmm... Is there a reason to build a version which is NOT 3.3 (or even 3.0) compatible? I don't think Bluetooth stack changed that much recently.

flypig's picture

Yes, it's not bluez that's causing the differences here, it's protobuf-lite, quazip and openssl which changed between 3.3, 3.4 and cbeta.

slava's picture

FWIW, openssl is backward compatible, zlib too, both are even allowed in Jolla Store. But protobuf-lite must be a disaster if your app really requires it. Unlucky, then.

flypig's picture

Ah, okay, the version in the repo is for 3.4.0 Pallas-Yllästunturi. I can build a version for 3.3.0, but is there a reason you didn't upgrade to 3.4.0?

objectifnul's picture

Pallas has too many regressions...

objectifnul's picture

Missing dependency libprotobuf-lite.so.23

flypig's picture

Thanks for letting me know. Which version of Sailfish OS are you running please?

ziellos's picture

After starting contractd manually from terminal, it seems to work for now.

flypig's picture

Thanks for the update. I'm finding things work okay for me here, so hopefully this was just a blip; maybe contracd wasn't running for some reason. Please let me know if it happens again.

ziellos's picture

It seems the app doesn't work anymore since Jan 1st, 0:00? Daily update is in an infinite loop, and scanning can't be activated.

flypig's picture

Thanks for highlighting this. I'm just checking myself and will post an update as soon as I have.

tmojo's picture

As the phone app becomes unresponsive on incomming calls while Contrac is active and Contrac often looses keys on reboot/crash I decided to deactivate Contrac.

It's a shame that @flypig got that far however in the end some show stoppers block us from using it.

flypig's picture

I'm sorry to hear it's causing problems. Unfortunately it does seem that the scanning can cause problems when there are many other bluetooth devices around. I'm doing my best to find a fix.

For clarity, although the count may be forgotten on reboot/crash, it's unlikely keys are being lost (these are stored separately and as they arrive).

pvcn's picture

Can confirm that, my smartphone often crashes completely (unresponsive, black screen, green light blinking, hard reset needed) in crowded places when contract is running.

jabgoe's picture

happens to my phone too: sailfish 3.4, xperia xa2 ultra, same behaviour. makes the app somewhat unuseable ..

SKD's picture

Is it a normal behaviour that the daemon doesn't show up as a process in crest? When the UI is open it shows but it disappears as soon as I close it. Or do I need to change some settings in order for the background service to work?

edit: Thanks for your work anyway! :)

flypig's picture

The daemon should continue independent of the UI and there's no special setting for this. I've installed crest and I see the daemon (contracd) but not the UI (harbour-contrac) independent of the settings in crest, but they're both running so I'm not sure how it's choosing to show some things and not others. If you're using developer mode it would be worth checking at the command using this just to be sure:

ps aux | grep contrac

If it really isn't running, then I'd be grateful if you could file a bug (including device details please).

lispy's picture

Happens to me on Xperia X (compact).

deepbluev7's picture

I've noticed something strange: When I have this app running and scanning active, sometimes the whole Sailfish UI becomes unresponsive. I managed to catch it in the act and it seems like statefs was using 100% CPU. I'm using an Xperia X Compact, did anyone else have a similar issue? Seems to mostly happen in crowded places like public transport.

flypig's picture

Unfortunately it wouldn't surprise me if this was the case. Bluez is a shared resource and some of the things Contrac has to do (BLE scanning in particular) affect other parts of the system. I'd be grateful if you could create an issue about it on github and share your experiences there (for example the statefs connection is new info for me).

deepbluev7's picture

Hm, I completely forgot about this, but seems like someone created an issue already and I don't really have anything more to add, than what was commented on that issue. Would probably need to debug this, but since it only happens in crowded places, that does not seem ideal :D

pvcn's picture

Just tested: left scan/send deactivated, changed RSSI Setting (to 8) and rebooted: RSSI went back to 5. (device Xperia X Compact)

flypig's picture

This is useful info... and I guess my hypothesis was wrong then. I'll dig into the code in more detail to try to figure out what else might be happening then. Thanks for testing.

Pages