corona-warn-app / cwa-app-android

Native Android app using the Apple/Google exposure notification API. The CWA development ends on May 31, 2023. You still can warn other users until April 30, 2023. More information:
https://coronawarn.app/en/faq/#ramp_down
Apache License 2.0
2.44k stars 495 forks source link

Update date missmatch #1516

Closed hackfix closed 3 years ago

hackfix commented 4 years ago

Hello,

I use CWA 1.5.1 under Android 7.1 and the CWA app indicates a regularly exposure data update as shown in this screen shot (which I took today): image

But in Settings -> Google -> COVID-19 exposure notifications it shows "Last checked for potential exposure 24 September at 7:02": image

Battery optimization is already disabled (-> CWA) and BT is enabled. I do open the app at least twice a day to make sure it is working correctly and gets the latest updates.

Now I'm wondering why these two dates do not match. It seems to me something is going wrong.

Has anyone else also noticed something like this?

Thanks,

hackfix

MikeMcC399 commented 4 years ago

@hackfix The number 1312 checks in the Google display is very high. I wouldn't expect it to be more than about 250. Could you go to Settings > Google > COVID-19 exposure notifications > Exposure checks (touch this element with the 1312 count shown in your screen shot) Use the three dot menu to Export exposure checks. Rename the file extension from .json to .txt then attach the file to the post.

We've had a couple of cases where the device date went into the future and back, which caused issues with the exposure check history. This might be the cause in your case.

hackfix commented 4 years ago

@MikeMcC399

here's the requested file: all-exposure-checks.txt

MikeMcC399 commented 4 years ago

@hackfix Thanks for providing the exposure check file. There are 300 entries in it compared to the 1312 reported in your screen shot. That is not the main problem though. Today's entry from Nov 2, 2020 shows:

{"timestamp":"2. November 2020, 07:43","keyCount":0,"matchesCount":0,"appName":"Corona-Warn","hash":"IHJsX7DDP0OVW0yEMqsvGErbDt1PBigMJ1IGu+GBHo0="}

and all the other records show "keyCount":0 as well. Those are the infection keys (Diagnosis Keys) that the app pulls from the server to compare with the ones stored on your device to see if any of them match up in terms of a risk encounter. If that count is 0 it means that the comparison is not working.

The actual data stored by Google is not accessible by other means (unless you have a rooted device), so it's not possible to diagnose the problem any deeper using what the standard user interfaces tell you.

If this were my device I would uninstall CWA and reinstall it. Uninstalling CWA causes all key data to be deleted.

The FAQ suggests trying resetting the app first before uninstalling it. I would follow that advice, but I don't expect that will fix the issue.

If you want to wait and see if somebody else gives you different advice, you could in the meantime reply with:

hackfix commented 4 years ago

@MikeMcC399 Many thanks for your feedback!

I followed the FAQ and reset the app but that did not fix the issue. Finally I reinstalled the CWA but even that didn't help. In the log I still can see "keyCountkey":0

Exposure Notifications Version on my device is 17203915000

Any other ideas what else I can check? Thank you

MikeMcC399 commented 4 years ago

@hackfix What number is now showing in the display which previously showed "1312 checks in the previous 14 days"? What does the full text "Last checked for potential exposure ..." say? Are both the above now looking correct?

Your Google ENS with 17203915000 is up-to-date. That is good! There was a bug quite a while back https://github.com/corona-warn-app/cwa-app-android/issues/744 leading to an incorrect display of "keyCountkey":0 and users reported that this was fixed in 15202902002 in July 2020. The fix was in ENS Version 1.5 (from the first two digits 15 of the version number) and you already have Version 1.7 (first two digits 17).

You have also said: CWA 1.5.1 Android 7.1

Could you please add the information about your device make and model?

If your device has any function like device care you could run it to check for hardware issues like low memory.

hackfix commented 4 years ago

Here's the latest screen shot of the Exposure Notifications screen: image

My device is a Samsung S5 mini. Android 7.1 and rooted. I can't find any other problems with this device like hardware defects or low memory.

MikeMcC399 commented 4 years ago

@hackfix The display Exposure Notifications is missing the section: "Last checked for potential exposure ..." which is strange.

The app is not officially supported on rooted devices, although there are some people successfully running the app on a rooted device. (See https://www.coronawarn.app/en/faq/#rooted_devices.) One of them might possibly jump in here, but I personally don't have experience with rooted devices, and apart from suggesting a factory reset on your device, I don't know what else I could recommend here. Sorry for that!

hackfix commented 4 years ago

@MikeMcC399 OK many thanks for all your efforts! You helped me to understand a bit more about CWA.

CWA worked until Sep 24th - so I guess rooting is not causing the troubles. Anyway - in my case the app seems to have become worthless since a few weeks...

MikeMcC399 commented 4 years ago

The discussion in https://github.com/corona-warn-app/cwa-app-android/issues/1238 which discusses the files may help you to understand a bit more.

Also, since you have a rooted device, you can use https://github.com/mh-/corona-warn-companion-android/blob/master/README.md which is available from the Google Play Store https://play.google.com/store/apps/details?id=org.tosl.warnappcompanion to check from a different app what might be going on.

MikeMcC399 commented 4 years ago

One more thought:

On an emulated Pixel 3a device running Android 11 I have seen the same result that you are getting on your Samsung S5 mini. Android 7.1. That is to say, Use Exposure Notifications is on (switch is on the right), no text "Last checked for potential exposure today .... " is displayed despite "xx checks in the past 14 days" showing, together with "Number of keys" 0 when viewed directly in the UI and "keyCount":0 in the Export exposure checks all-exposure-checks.json file.

I wouldn't expect CWA to work correctly in the emulator, in fact Android 11 is the first version where it doesn't produce a fatal error in an emulator, however it is interesting that your results are identical. I wish I knew if it can be solved on your device!

masema67 commented 4 years ago

I have a similar issue:

Android Version: 10 Device is: Moto G7plus App Version: 1.51 ENF Version: 17203915000 Play Service Version: 22.5.28-21

It indicates no risk exposure for today (yesterday it were 5), but google exposure notification tells something different, still 5. The data being retrieved for test results (as you can see in the screenshot) is not successful and ongoing since 8 hours now. Hope you can solve this issue! best masema

Screenshot_20201108-160522

Screenshot_20201108-154321 Screenshot_20201108-154345 all-exposure-checks.txt

MikeMcC399 commented 4 years ago

Hi @masema67

It looks like you have a problem which is a subset of what was reported in this issue. I'm seeing in your screen shot "Datenabruf ... Das Ergebnis wird aktualisiert TEST ANZEIGEN".

The data being retrieved for test results (as you can see in the screenshot) is not successful and ongoing since 8 hours now.

This is the hot topic covered by https://github.com/corona-warn-app/cwa-app-android/issues/1084. There is a workaround from @daimpi described in https://github.com/corona-warn-app/cwa-app-android/issues/1084#issuecomment-719928037 which involves setting the date back one day, resetting the app, then setting the date back to today.

I'm not sure if resetting the app will also cure the discrepancy about the number of risk encounters. Let us know the results if you decide to reset.

daimpi commented 4 years ago

@masema67 your log and CWA display not matching is indeed curious. Have you tried closing and re-opening CWA? If this doesn't help you might be experiencing https://github.com/corona-warn-app/cwa-app-android/issues/1210, the reasons for which are a total mystery afaik.

Would be interesting to know what your app and log shows tomorrow, feel free to mirror your description over at #1210.

masema67 commented 4 years ago

@MikeMcC399 I set the date 14 days back to the past, reset and changed the date back - the test I had entered is gone now and therefore no data retrieve issue is there anymore. (after scanning the test QR code again the result is displayed) But the "discrepancy about the number of risk encounters" is still the same!

masema67 commented 4 years ago

@daimpi yes restarted plenty of times and also restarted the phone as such - did not change anything

daimpi commented 4 years ago

@masema67

yes restarted plenty of times and also restarted the phone as such - did not change anything

Thanks for confirming this. My guess is that you're indeed experiencing something like described in https://github.com/corona-warn-app/cwa-app-android/issues/1210. Btw: now that you reset the data in CWA and played around with the date, did your CWA perform a new check after the reset? If this is the case, is the new timestamp shown in CWA and could you also share your new EN log here?

masema67 commented 4 years ago

@daimpi indeed it did - but which result is true? 5 risk encounters or 0?

Screenshot_20201108-181547 Screenshot_20201108-181825 Screenshot_20201108-181909 all-exposure-checks.txt

daimpi commented 4 years ago

@masema67 this is indeed very curious. If we look at the two EN log entries from today, they both contain the same number of diagnosis keys (DKs) but a different hash (but tbh since CWA 1.5 I have no clue how the Android hashes are generated):

{"timestamp":"8. November 2020, 18:03",
"keyCount":312112,
"matchesCount":0,
"appName":"Corona-Warn",
"hash":"vB7Hmi+rRtQ+HnZ1K2ZPGqwB26xih1aP987oH6CQrj4="},

{"timestamp":"8. November 2020, 02:00",
"keyCount":312112,
"matchesCount":5,
"appName":"Corona-Warn",
"hash":"AxnbW1ATtXxEddiQWUbTCbQX5sgagK0JeYTw5Cm5dW4="}

So the good news is: your EN log and CWA are now both in agreement again after the reset.

But why the discrepancy happened in the first place: no clue… finding the root cause of this would probably solve the mystery of #1210.

masema67 commented 4 years ago

@daimpi Thank you! Sounds also to me very mysterious. Have only very little knowledge about CWA, but believe 98% of the CWA user have even less and imagine there must be plenty of user out there where this happens. Therefore hope that someone can solve this mystery and make CWA work better.

masema67 commented 4 years ago

@daimpi @MikeMcC399 By the way I am quite sure that the problem of refreshing the test result and showing the correct number of risk exposures is somehow connected. Because yesterday morning, when looking at the CWA it also displayed 0 risk exposures while trying to retrieve the test data. It took a while until it received the data and then displayed the 5 risk exposures (day before 4). Today in the morning kind of the same happened, only it never stopped to retrieve the test data, got stuck and displayed 0 risk exposures all day long.

MikeMcC399 commented 4 years ago

@masema67

By the way I am quite sure that the problem of refreshing the test result and showing the correct number of risk exposures is somehow connected.

You could well be right. I'm looking at something else though related to your issue:

The issue reported by @daimpi in https://github.com/corona-warn-app/cwa-app-android/issues/1084, regarding the stuck retrieval of a test result, is the same as part of your problem. It is labelled with internal ID EXPOSUREAPP-2398. Now the fix for that is https://github.com/corona-warn-app/cwa-app-android/pull/1481 which says "Cannot delete tests older than 21 days - DE: Tests die älter als 21 Tage sind, können nicht gelöscht werden (EXPOSUREAPP-2398)". And that fix is in preparation for the release of version 1.6.

From your two screen shots before and after resetting CWA, the status has gone from "Datenabruf ... Das Ergebnis wird aktualisiert TEST ANZEIGEN" to "Ihr Ergebnis liegt vor Befund negativ". So your problem doesn't seem to have been caused by a test having been removed from the server because it was more than 21 days old. Can you say how old your test was (when tested, when you heard the result)?

It might be good to get a new issue opened on this topic. I hope @daimpi will let us know what he thinks as well. Also, I'm wondering if the Open Source team is able to say when version 1.6 will be released.

daimpi commented 4 years ago

@MikeMcC399

From your two screen shots before and after resetting CWA, the status has gone from "Datenabruf ... Das Ergebnis wird aktualisiert TEST ANZEIGEN" to "Ihr Ergebnis liegt vor Befund negativ". So your problem doesn't seem to have been caused by a test having been removed from the server because it was more than 21 days old. Can you say how old your test was (when tested, when you heard the result)?

My assumption was that @masema67 just added his new test after the old one was deleted by the reset and immediately got the result… but maybe that's not the case? @masema67 could you clarify whether you added a new test after removing the old one?

masema67 commented 4 years ago

@MikeMcC399 @daimpi It was only one old test from October 18, with result displayed first in CWA on October 19. After the reset I scanned the QR code for the old test again.

masema67 commented 4 years ago

@daimpi just in case it is needed - after last night's data match there is no discrepancy between CWA and EN log. But the EN log shows again for November 8th two different hash codes, one with 5 risk contacts and one with 0 Screenshot_20201109-053640_1 all-exposure-checks.txt

MikeMcC399 commented 4 years ago

@masema67

It was only one old test from October 18, with result displayed first in CWA on October 19. After the reset I scanned the QR code for the old test again.

Thank you for filling in the details! The date October 18, 2020 is 21 days ago, so I would expect the test data to now be deleted from the server. (See https://www.coronawarn.app/assets/documents/cwa-privacy-notice-en.pdf Section 9 b.) It looks like you just pulled the results on the last available day, yesterday Nov 8, 2020.

just in case it is needed - after last night's data match there is no discrepancy between CWA and EN log. But the EN log shows again for October 8th two different hash codes, one with 5 risk contacts and one with 0

I would not expect the ENS log to change for yesterday Nov 8, 2020. Those values are written in the log and they will stay there until they are aged out by ENS after 16 days (or if you uninstall the app).

masema67 commented 4 years ago

@MikeMcC399 sorry, I meant 8th of November in "But the EN log shows again for October 8th two different hash codes....". But seams you had already detected my mistake and concluded correctly. I have now corrected my mistake in the original post.

daimpi commented 4 years ago

@masema67

It was only one old test from October 18, with result displayed first in CWA on October 19. After the reset I scanned the QR code for the old test again.

It's curious that you were even able to add an old test again. This shouldn't have been possible according to @thomasaugsten's comment here:

Hi unfortunately this is not possible. We have to ensure only one phone can scan the qr code and submit his diagnoses keys. We are not allowed to save an ID of the phone this is the reason why the qr code is only valid for one scan.

I wonder why this worked for you nevertheless 🤔.

The second curiosity is about the hashes. Looking at your most recent EN log entries we have

{"timestamp":"9. November 2020, 01:00",
"keyCount":312112,
"matchesCount":0,
"appName":"Corona-Warn",
"hash":"vB7Hmi+rRtQ+HnZ1K2ZPGqwB26xih1aP987oH6CQrj4="}

{"timestamp":"8. November 2020, 18:03",
"keyCount":312112,
"matchesCount":0,
"appName":"Corona-Warn",
"hash":"vB7Hmi+rRtQ+HnZ1K2ZPGqwB26xih1aP987oH6CQrj4="},

{"timestamp":"8. November 2020, 02:00",
"keyCount":312112,
"matchesCount":5,
"appName":"Corona-Warn",
"hash":"AxnbW1ATtXxEddiQWUbTCbQX5sgagK0JeYTw5Cm5dW4="}

The hash from 9. November 2020, 01:00 and 8. November 2020, 18:03 are the same, which is not that surprising given that new daily DK packages only become available on the server at around 0:10 UTC (01:10 CET), so your checks were performed on the same DK package both times. But this makes it even more curious that the hash from 8. November 2020, 02:00 is different from the other two, even though keyCount is the same for all three checks which would indicate that actually the same package was checked each time. I know that the in app reset happened between the two checks on Nov 8. but according to my understanding this shouldn't have had an effect on any of this. Otoh I've no real clue how hashes are calculated for CWA 1.5+ under Android tbh. If I look at the same package with keyCount":312112 on my phone I again find a totally different hash (anFL+wVRZWE42PE8urgQUThv06sS8Pm4GwzEThkNES8=) 😕.

My guess is that if we found out why the hash changed this would probably bring us a good step closer to solving the mystery of why matchesCount changed and at the same time bring us closer to solving #1210.

masema67 commented 4 years ago

@daimpi very interesting and at the same time also very concerning for at least two reasons. Thank you a lot for your time, effort and explanation! Let me know if I can support in any way to solve these mysteries.

masema67 commented 4 years ago

@daimpi maybe interesting: right now the test result has changed - 21 days after first registration. And the CWA info is quite revealing "Registriert am 8.11.20" .................... Screenshot_20201109-214550 Screenshot_20201109-214507 Screenshot_20201109-214527

daimpi commented 4 years ago

@masema67

right now the test result has changed - 21 days after first registration.

interesting… in a sense this was expected b/c as @MikeMcC399 stated above:

Thank you for filling in the details! The date October 18, 2020 is 21 days ago, so I would expect the test data to now be deleted from the server. (See coronawarn.app/assets/documents/cwa-privacy-notice-en.pdf Section 9 b.) It looks like you just pulled the results on the last available day, yesterday Nov 8, 2020.

But seemingly some fix for https://github.com/corona-warn-app/cwa-app-android/issues/1084 has already been implemented with CWA 1.5.1 b/c you didn't run again into the error with the indefinitely spinning loading wheel and instead got actually presented with some useful information. But maybe this is just b/c you actually only added the test to your device two days ago (that this worked at all is a curiosity in and of itself ^^).

hackfix commented 4 years ago

I have analyzed the problem on my device a bit more detailed and I found out that CWA stops half way during exposure data update.

First of all - the app on my device is able to communicate with the CWA servers. Here are the API requests from my device:

  1. Request: https://svc90.main.px.t-online.de/version/v1/diagnosis-keys/country Response: ["DE","EUR"]

  2. Request: https://svc90.main.px.t-online.de/version/v1/diagnosis-keys/country/EUR/date Response: ["2020-10-28","2020-10-29","2020-10-30","2020-10-31","2020-11-01","2020-11-02","2020-11-03","2020-11-04","2020-11-05","2020-11-06","2020-11-07","2020-11-08","2020-11-09","2020-11-10"]

After that no further requests are sent to the server and CWA reports "Updated: Today 09:45". No error - nothing.

According to the CWA server documentation the app should now fetch the diagnosis keys (e.g. https://svc90.main.px.t-online.de/version/v1/diagnosis-keys/country/EUR/date/2020-11-05). But that does never happens....

I can manually download the diagnosis keys via a web browser without any problems.

As reported in my initial post I got exposure data update until September 24th. There might be a bug in CWA since end of September which prevents a daily update but does not generate an error message.

Maybe many users are affected by the same problem but they don't notice it because no error message is displayed. The normal user relies on the app and does not look in the "COVID-19 exposure notifications" to see if the update was successful.

MikeMcC399 commented 4 years ago

@hackfix Welcome back! This thread got a bit side-tracked from your original issue. It's very good to see the results of your network tracing.

In https://github.com/corona-warn-app/cwa-app-android/issues/1459#issuecomment-724485866 I asked about silent failure issues and the Open Source team replied in https://github.com/corona-warn-app/cwa-app-android/issues/1459#issuecomment-724591105 (@thomasaugsten) and https://github.com/corona-warn-app/cwa-app-android/issues/1459#issuecomment-724650624 (@d4rken). Those comments may possibly tie in with your findings about silent failure.

hackfix commented 3 years ago

I installed the latest update of CWA (-> 1.6) but it didn't fixed the issue on my device...

I could imagine that some other users are having the same issues as me. But most of them do not know this because there's no error message that comes up. So they don't know that CWA is not able to warn them. Please make this issue a priority!

dsarkar commented 3 years ago

Dear @hackfix, the CWA version 1.7 is coming up, we will monitor if the problem persists.

UPDATE: Regarding the update to CWA 1.7: Please note that it is a staged rollout. Over the next two days, 100% of the users should have received the update. We would appreciate very much your feedback regarding this issue over the next few days!

Best wishes, DS


Corona-Warn-App Open Source Team

hackfix commented 3 years ago

I installed the latest update of CWA (-> 1.7.1) but it didn't fixed the issue on my device.

I may have found something strange: After an exposure update no database files are created in the following path:

ls -l /data/data/com.google.android.gms/app_contact-tracing-contact-record-db/ 
-rw------- 1 u0_a32 u0_a32   0 2020-11-30 07:56 000074.log
-rw------- 1 u0_a32 u0_a32  16 2020-11-30 07:56 CURRENT
-rw------- 1 u0_a32 u0_a32   0 2020-11-23 21:19 LOCK
-rw------- 1 u0_a32 u0_a32 474 2020-11-30 07:56 LOG
-rw------- 1 u0_a32 u0_a32 172 2020-11-30 07:10 LOG.old
-rw------- 1 u0_a32 u0_a32  65 2020-11-30 07:56 MANIFEST-000072

Is my guess right that there should be at least on database file (.ldb)?

dsarkar commented 3 years ago

Update on https://github.com/corona-warn-app/cwa-app-android/issues/1516#issuecomment-723590136 (5 exposures / CWA reports 0) updated in EXPOSUREAPP-2872.

MikeMcC399 commented 3 years ago

@hackfix Are you still seeing more than 16 day's history in Google's Exposure checks? If so, there is something going wrong inside gms, because a clean-up job is supposed to run at a random time each day to clean up the keys and the history. This is not something which CWA has any influence on. It is controlled completely by Google.

I have seen the Google Exposure Notification System get into a strange state on one of my test devices and the only way I could recover was to uninstall CWA and re-install CWA. Of course this loses all the stored keys, so this would be the last resort if no other action helped.

hackfix commented 3 years ago

@MikeMcC399: thanks for your feedback!

No - checks older than 16 days are cleaned up automatically. So today I can see that the oldest check (on my device) is from December 2.

Trust me - I have re-installed CWA several times....

MikeMcC399 commented 3 years ago

@hackfix Google has made some changes to the Exposure Notifications System. Are you still seeing the problem with a mismatch of last exposure check timestamps using the latest app version and latest Google Play services update?

I had the same issue with one device (see https://github.com/corona-warn-app/cwa-app-android/issues/2061) and the only way I found to solve it was by a factory reset. There was something going wrong with the broadcasts between the Google ENS and the CWA app but we didn't really find a root cause or a bug to be fixed.

dsarkar commented 3 years ago

@hackfix Do you still experience the same issue? We have a similar report today. Thanks for the feedback.

MikeMcC399 commented 3 years ago

@dsarkar This issue has gone cold and hasn't received any feedback in almost 5 months. I think it could be a candidate for closure.

dsarkar commented 3 years ago

@MikeMcC399 Thanks. @hackfix Thanks for contributing here. We will close this issue now. Feel free to re-open this issue if you still experience any related problems, or create a new issue. Best wishes, DS


Corona-Warn-App Open Source Team