Closed Stypox closed 4 years ago
I pushed three more commits. I implemented diagnosis keys protobuf parsing using microg's .proto
, along with the database methods to store them, and I added findAllMeasuredExposures()
.
But I am facing some problems matching the CapturedData
s stored in the database with the provided DiagnosisKey
s: the microg implementation is obscure for me, and I have some doubts about the byte[]
stored in the CapturedData
object. @theScrabi does that array represent just the TemporaryExposureKey
received from the other phone, or does it represent the received data as a whole?
Also, I have a design question: I noticed that microg caches matches inside provideDiagnosisKeys
, so that they don't have to be recalculated later. Is it ok if for now I don't implement that (as it would require adding another table to the database), and then we'll get to it later?
I implemented a big part of the actual matching procedure / computation of ExposureSummary and ExposureInformation. See the 'matching' package for most of the new stuff. I did not write tests for these parts yet. Also there are some parts of the computation, where I was not 100% sure, I marked thse parts with TODOs in the code. I did some restructuring along the way, in particular I moved all datatypes that are used in different parts of the sdk to an own 'datatypes' package. I moved some of the constants (key lengths, rolling period, ...) to an own EnFrameworkConstants file.
When reviewing, better don't look at every change from every commit, but on the result, since not all commits are super clean ;)
Because of the structural changes, my idea would be to merge this branch as soon as possible, even if the implementation is not complete yet. That would also allow us to make own issues / PRs out of the many TODOs, on that different people then could work.
I'll review this tomorrow 👍
I made a few rather minor suggestions. When they are fixed/applied, I'd be okay with merging this PR.
I'll apply the suggested changes myself and merge this PR.
This PR makes the Nearby api actually do something, implementing the stub methods. I created a branch here so that you can easily push changes, too, in case you want to. I took inspiration from microg's implementation.
Closes #33
This is what needs to be done:
[x] Rename ENNumber to ENInterval (the ENNumber name was not meaningful)
[ ] Full diagnosis key handling and matching
[x] Add
DiagnosisKey
enitity to database[ ] Add database tests for diagnosis keys
[x] Add protobuf to decode key files (
.proto
file taken from microg)[ ] Implement
findAllMeasuredExposures()
to match storedCapturedData
s with storedDiagnosisKey
s.[ ] Add database tests for
findAllMeasuredExposures()
[x] Link
start()
/stop()
toPPCP.start
/.stop
[x] Implement checking if EN service
isEnabled()
(I added a privateboolean
for this, is it ok or shall I usePPCP.isStarted()
for this instead?[x] Implement
getTemporaryExposureKeyHistory()
, returning all of the keys generated by the phone in the last 14 days[x] Implement
getTemporaryExposureKeyHistory()
[ ] Make sure TEK key data is correct
[ ] Implement
provideDiagnosisKeys()
[x] Read Zip files and validate them (mostly taken form microg)
[x] Store
DiagnosisKey
s in the database[x] Send intent to notify whether there was a measured exposure or not (like in microg)
[ ] Verify whether we need to precalculate database matches or not
[ ] Implement
getExposureSummary()
[x] Loop through matched keys and collect information
[x] Calculate days from first capture timestamp
[x] Calculate attenuations and attenuation durations (i.e. the time the user has been in contact with a particular attenuation level)
[ ] Implement
getExposureInformation()