Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background update does not work, CWA 1.9.1 and “prioritized background activity” #933

Closed
speedy-1702 opened this issue Jul 27, 2020 · 192 comments
Assignees
Labels
bug Something isn't working mirrored-to-jira This item is also tracked internally in JIRA

Comments

@speedy-1702
Copy link

speedy-1702 commented Jul 27, 2020

Version 1.1.1 is installed since last week and “prioritized background activity” is set to on. Today I clicked on my risk status and saw that the last update was two days ago ("vorgestern").

Is this how it is supposed to be?

Some seconds later, the update was performed.

Device is a Huawei P30 lite running with Android 10.0.0


Internal Tracking ID: EXPOSUREAPP-1922

@speedy-1702 speedy-1702 added the bug Something isn't working label Jul 27, 2020
@gusowski1
Copy link

gusowski1 commented Jul 27, 2020

I could confirm the issue.

Honor 10 (COL-L29)
Android 10
EMUI 10.0.0
Build 10.0.0.177(C432E3R1P4patch01)
CWA 1.1.1
ENF 15202902003

no check 2020/07/24.
prioritized background activity enabled from within the app

@benjussuf
Copy link

benjussuf commented Jul 27, 2020

Same issue on bq Aquaris X, Android 8.1.0. Automatic updates worked in Version 1.0.5.

@NKarolak
Copy link

NKarolak commented Jul 27, 2020

Same issue on a Samsung Galaxy S10e on Android 10. I reboot the phone every day.
I am using the latest app version, and excluded it from the phone's energy optimization.
The last time I've used the app was over 24 hours ago (July 26, 2020 14:49 - now it's July 27, 17:15)

I've checked the entries under Settings --> Google --> COVID-19 Notifications. They don't get updated until I open the app again.

@swe0815
Copy link

swe0815 commented Jul 27, 2020

Same issue on Xiaomi Mi9 Android 10 with the latest patches
"Priorisierte Hintergrundaktivität" is turned on

Same problem "I've checked the entries under Settings --> Google --> COVID-19 Notifications. They don't get updated until I open the app again."

@mbw83
Copy link

mbw83 commented Jul 28, 2020

I also have the issue on a Xiaomi Mi 9 Lite. This is also reported in #756, but I think we can't expect the developers to take care of this.
For me open source is not defined as "putting the code somewhere and don't care afterwards", open source means for me also taking the advantages and especially using for example this issue tracker. But I don't have the impression, that the developers are using this. If they would, they should communicate more often!

And to be honest: They are getting a hell of money from "us" and the "only" thing the app has to do is downloading keys of infected persons every roughly 24 hours and showing a notification if the user is infected. But the app is not able to reliable do this.

@MarlisFriedl MarlisFriedl added the mirrored-to-jira This item is also tracked internally in JIRA label Jul 28, 2020
@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 28, 2020

Is there any way in the production version of CWA (currently Version 1.1.1) to see when the next risk evaluation is scheduled? I only know how to look via Settings > Google > COVID-19 exposure notifications > Exposure checks to see what requests have been previously made.

@SebastianWolf-SAP
Copy link
Member

SebastianWolf-SAP commented Jul 28, 2020

@mbw83 We are taking this issue (and the others of course as well) seriously. We are continuously checking if we can reproduce the issue with the devices people have mentioned here. So please keep on posting the devices which still face the issues. We are taking them into account in further test efforts.

@MikeMcC399 The latest update is also shown on the home screen of the app. The next automated evaluation is scheduled for 24 hours later. It depends on OS scheduling and other aspects when it will actually happen. Usually it's 24 hours plus a little bit more. Only if the next update happens later than 24+4 hours after the last update, the scheduling hasn't worked properly and we recommend opening the app manually once again.

@thomasaugsten
Copy link
Member

thomasaugsten commented Jul 28, 2020

can you please double check in OS settings if the app is excluded from the phone's energy optimization/ akkuoptimierung
Also try to restart the phone and start the app once and check after ~28h if there is an entry in COVID-19 Notifications.
Please check this page https://dontkillmyapp.com/ for a working solution for your device.

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 28, 2020

@SebastianWolf-SAP

The latest update is also shown on the home screen of the app. The next automated evaluation is scheduled for 24 hours later. It depends on OS scheduling and other aspects when it will actually happen. Usually it's 24 hours plus a little bit more. Only if the next update happens later than 24+4 hours after the last update, the scheduling hasn't worked properly and we recommend opening the app manually once again.

Thank you for describing the expected interval of 24+4. Today my Samsung Galaxy A50 / Android 10 device did an automatic risk update at 19:35 following on from a previous automatic risk update the previous day at 7:25. This is an interval of 24:00+12:10. I have not opened CWA during this time, so the automatic risk update is delayed more than 8 hours (12:10 - 4:00) compared to what was expected.

@thomasaugsten
Copy link
Member

thomasaugsten commented Jul 28, 2020

@MikeMcC399
Was there any special conditions like heavy load, low battery or poor network connection?

@speedy-1702
Copy link
Author

speedy-1702 commented Jul 28, 2020

@thomasaugsten

can you please double check in OS settings if the app is excluded from the phone's energy optimization/ akkuoptimierung
Also try to restart the phone and start the app once and check after ~28h if there is an entry in COVID-19 Notifications.
Please check this page https://dontkillmyapp.com/ for a working solution for your device.

Double check is done. Corona warn app is excluded from battery optimization
Screenshot_20200728_231331_com android settings

Restart is done. I will report here after ~28 hours.

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 28, 2020

@thomasaugsten

Was there any special conditions like heavy load, low battery or poor network connection?

No special conditions were occurring. I am checking against https://dontkillmyapp.com/. Although my model is not specifically referenced I think I can still infer what settings might help and I will try them out.

@w-flo
Copy link

w-flo commented Jul 29, 2020

I wasn't involved in Android development in recent years, so take this with a grain of salt, but someone mentioned that foreground services should be used instead of background services, because they are less likely to be killed. They received no response to that comment.

Does corona-warn-app already use a foreground service for risk updates? Since foreground services must show a notification while they are active, and I haven't noticed any "update in progress" notifications from CWA, I assume it is a background service right now? If so, shouldn't the implementation be changed to use a foreground service instead?

Also regarding the scheduled update time, I can't confirm that the next update will take place 24 hours after the previous update. It appears like my phone used to schedule automatic updates at 6pm, but I've since switched to manually opening the app at ~6am instead, and 7am or 8am on weekends. The app never scheduled an automatic update at ~6am on weekends, it was always triggered by my opening the app a few hours later. I guess automatic updates are still scheduled for 6pm, so that would be 36 hours after my last manually triggered update.

@matherm
Copy link

matherm commented Jul 29, 2020

@w-flo I would not recommend a foreground service as this causes the app to "run" all the time. More or less an endless loop. There are ways to mitigate, but using scheduled tasks AlarmManager and WorkManager is imho the correct pattern. Unfortunately, it seems that in the work scheduler API is not using AlarmManger but seems to choose TaskScheduler which is more energy efficient (bulk updates), but obviously ia not reliable on some devices/OS. If changing something I would rather propose to change to AlarmManger with setExactAndAllowWhileIdle() instead. Of course, this would impact battery life.

As already reported in #637 there is a general android problem with background processing on several devices. https://issuetracker.google.com/issues/122098785

Another interesting thing appears in my Settings --> Google --> COVID-19 Notifications. It seems that the keys are checked multiple times with the same timestamp.
However, it only dates back 4 days. I guess that's because the list only shows the latest 100 entries.
Anyway, it seems as it is updating too often.

Screenshot_20200729-134203

Nokia 7 plus
Android 10 (latest)
Corona-app 1.1.1

@vaubaehn
Copy link
Contributor

vaubaehn commented Jul 29, 2020

@matherm

As already reported in #637 there is a general android problem with background processing on several devices. https://issuetracker.google.com/issues/122098785

Very interesting link, but very frustrating to read...

Comment no. 91 in that linked issue thread has a nice idea...
Maybe it is possible to ask Google, to implement a scheduled task to the ENF, that triggers the registered exposure notification app (for us: CWA) to run every couple of hours per day? Is something like this technically possible?
(Underlaying logic:
GPS/GMS/ENF doesn't get killed by battery optimisation.
GPS/ENF schedules a task to wake up (run) EN-App.
EN-App is awake again, and shows 'the finger' to device manufacturer's battery optimisation/background process killing.)

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 29, 2020

@vaubaehn

Maybe it is possible to ask Google, to implement a scheduled task to the ENF, that triggers the registered exposure notification app (for us: CWA) to run every couple of hours per day? Is something like this technically possible?

I read about the following improvement in the ENF:
"App force-stop improvements: if an app has been force-stopped in the background, the Exposure Notifications service will wake it up again automatically." in the Exposure Notifications release notes . Is this functionality doing what it is described to do, and if yes, why isn't that enough to solve the issue? Does anybody know?

@vaubaehn
Copy link
Contributor

vaubaehn commented Jul 29, 2020

@MikeMcC399 Thanks very much for that hint. Actually, I knew the release notes but overlooked it there!
For me it looks like the way to go.
Obviously it still seems to be buggy or not fully functional, would need a closer look together from google and our devs here, imho.

@thomasaugsten
Copy link
Member

thomasaugsten commented Jul 29, 2020

@MikeMcC399 thanks for pointing out this new feature. We are working day and night together with Google to improve the app. This new feature will be adopted soon by our app and should increase the stability of the background task.

@daimpi
Copy link

daimpi commented Jul 29, 2020

Here is an overview of some Android devices from friends/family.
“Prioritized Background Activity” (PBA) was activated manually on all the devices on the 24.07. and I followed the Button in CWA to the device settings to check that the App is actually exempt from “Energy Saving”. I checked the logs for those phones on the 24th (the day of activating PBA) and on 28.07. to see whether days were missing before/after enabling PBA.

All Phones were running CWA version 1.1.1, and ENF version 15202902003.

The Phones checked were:

  • 2x Samsung Galaxy S8 (Android 9): Both had lots of entries missing before the 24th, and were working perfectly afterwards even though the users didn’t regularly open the app manually.

  • LG G5 (Android 8): This was the only phone where the checks were performed every day even before the 24th. Unsurprisingly everything also worked fine after the 24th.

  • Samsung Galaxy S10e (Android 10): App was not working before the 24th (no checks within the last 14 days as the user hadn’t manually opened the app). Afterwards it was working perfectly even though the user didn’t regularly open the app manually.

  • Xiaomi Redmi 5 Plus (Android 8.1) and Xiaomi Redmi Note 7 (Android 9): Before the 24th: the App was not working properly, only when manually opened checks were performed. Unfortunately, this didn’t change after the 24th even though PBA was enabled on both devices (one check was automatically performed on the 25th, but nothing afterwards).

Screenshot of the Redmi Note 7 Energy settings:


So in summary: On the Samsung devices setting PBA to “on” fixed the Problem. On the LG G5 there was no problem to start with, and CWA continued to work reliably after setting PBA.

Unfortunately for both Xiaomi devices activating PBA didn’t help.

@vaubaehn
Copy link
Contributor

vaubaehn commented Jul 29, 2020

@daimpi very nice and useful research!
That information might be very useful to the public also.

@NKarolak
Copy link

NKarolak commented Jul 29, 2020

As written earlier, my Samsung Galaxy s10e was NOT fixed by activating PBA.
However, I've updated another setting (disabled it), and I need to wait for a new test result.
IMG_20200729_204420_937

Result: #933 (comment)

@speedy-1702
Copy link
Author

speedy-1702 commented Jul 30, 2020

@thomasaugsten

can you please double check in OS settings if the app is excluded from the phone's energy optimization/ akkuoptimierung
Also try to restart the phone and start the app once and check after ~28h if there is an entry in COVID-19 Notifications.
Please check this page https://dontkillmyapp.com/ for a working solution for your device.

After reboot and waiting for ~28 hours still no improvement.
When starting CWA the update started immediately. ("Aktualisiert: Heute, 7:46")

More details can be provided on request

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 30, 2020

@thomasaugsten @speedy-1702

After reboot and waiting for ~28 hours still no improvement.
When starting CWA the update started immediately. ("Aktualisiert: Heute, 7:46")

I have also seen updates taking longer than 28 hours and I am beginning to suspect there are multiple root causes for the issue of risk update not running reliably without user interaction. I have been trying to check by using a USB cable and debugging with Android Debug Bridge (adb). I am though a complete newby at this!

I have one Samsung Galaxy Android 8 device that updated yesterday at 06:32 and I am puzzled that
adb shell dumpsys jobscheduler is showing an entry where the job seems to want to run for another 23h21m. It is currently 08:35, so I would expect it to run the next risk update within the next 2 hours (maximum of 24 +4 hours after the previous run). I will have to wait until 10:32 this morning to check whether the Google COVID-19 UI is telling me that it ran or not.

Here is a relevant portion of the output of adb shell dumpsys jobscheduler:

JOB #u0a172/0: 9365b07 de.rki.coronawarnapp/androidx.work.impl.background.systemjob.SystemJobService
u0a172 tag=job/de.rki.coronawarnapp/androidx.work.impl.background.systemjob.SystemJobService
Source: uid=u0a172 user=0 pkg=de.rki.coronawarnapp
JobInfo:
Service: de.rki.coronawarnapp/androidx.work.impl.background.systemjob.SystemJobService
Requires: charging=false batteryNotLow=true deviceIdle=false
Extras: mParcelledData.dataSize=180
Minimum latency: +23h59m59s972ms
Backoff: policy=0 initial=+1m0s0ms
Has early constraint
Required constraints: BATTERY_NOT_LOW TIMING_DELAY
Satisfied constraints: CHARGING BATTERY_NOT_LOW APP_NOT_IDLE DEVICE_NOT_DOZING
Unsatisfied constraints: TIMING_DELAY
Doze whitelisted: true
Tracking: BATTERY TIME
Enqueue time: -38m59s343ms
Run time: earliest=+23h21m0s628ms, latest=none
Ready: false (job=false user=true !pending=true !active=true !backingup=true comp=true)

Update

At 10:39 today the Google ENF UI is showing that a risk update was carried out at 07:55 which is 3 minutes after I first opened the UI at 07:52 today. So currently the automatic risk update is working for me on this device. I guess that the jobscheduler output above was pulled a few minutes after the risk update took place. I didn't check the Google ENF UI again until 10:39.

CWA > Settings > Prioritized Background Activity was already set to "On". This is confirmed by jobscheduler showing "Doze whitelisted: true" and (Android) Settings > Apps > Corona-Warn > Battery shows Optimise battery usage as "Not optimised" so I should have ruled out that CWA is killed by Samsung's battery saving.

I will keep monitoring the risk updates and see if there is anything strange happens.

@mbw83
Copy link

mbw83 commented Jul 30, 2020

can you please double check in OS settings if the app is excluded from the phone's energy optimization/ akkuoptimierung
Also try to restart the phone and start the app once and check after ~28h if there is an entry in COVID-19 Notifications.
Please check this page https://dontkillmyapp.com/ for a working solution for your device.

It also does not work on my Mi 9 Lite. The battery saving settings are off since a few weeks (I switched them of the first time it was recommended by a developer). Yesterday morning I double checked it, rebooted my device, started the app (updated 6:53) and waited until now (so ~30 hours). The update takes place immediately when starting the app (12:42) and not on its own.

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 30, 2020

The current date / time is Jul 30, 2020 15:00 and I am looking at another device (a Samsung Galaxy A50 running Android 10).

Settings > Google > COVID-19 exposure notifications shows
"Last checked for potential exposure on yesterday at 10:54"
24 + 4 hours after 10:54 is 14:54 today. Compare to current time 15:00 - the risk update is now late.

open CWA which causes manual risk update at 15:05
Settings > Google > COVID-19 exposure notifications shows
"Last checked for potential exposure on today at 15:05"

adb shell dumpsys jobscheduler shows the following, and the (planned) Run time was not affected by the manual update.

JOB #u0a379/63: 406e72d de.rki.coronawarnapp/androidx.work.impl.background.systemjob.SystemJobService
u0a379 tag=job/de.rki.coronawarnapp/androidx.work.impl.background.systemjob.SystemJobService
Source: uid=u0a379 user=0 pkg=de.rki.coronawarnapp
JobInfo:
Service: de.rki.coronawarnapp/androidx.work.impl.background.systemjob.SystemJobService
Requires: charging=false batteryNotLow=true deviceIdle=false
Extras: mParcelledData.dataSize=180
Minimum latency: +23h59m59s958ms
Backoff: policy=0 initial=+1m0s0ms
Has early constraint
Required constraints: BATTERY_NOT_LOW TIMING_DELAY [0x80000002]
Satisfied constraints: CHARGING BATTERY_NOT_LOW DEVICE_NOT_DOZING BACKGROUND_NOT_RESTRICTED WITHIN_QUOTA [0x3400003]
Unsatisfied constraints: TIMING_DELAY [0x80000000]
Doze whitelisted: true
Tracking: BATTERY TIME QUOTA
Implicit constraints:
readyNotDozing: true
readyNotRestrictedInBg: true
Standby bucket: ACTIVE
Enqueue time: -19h31m42s177ms
Run time: earliest=+4h28m17s781ms, latest=none, original latest=none
Last run heartbeat: 0
Ready: false (job=false user=true !pending=true !active=true !backingup=true comp=true)

If CWA carried out a manual risk update due to it being opened by the user, wouldn't it make sense for the automated update time to get reset, so the next automated update took place 24 hours later? Also it would be helpful as an enhancement for the CWA UI to show when it next plans to carry out an automated risk update if there is no user interaction in the meantime.

@heinosahling
Copy link

heinosahling commented Aug 1, 2020

@SebastianWolf-SAP asked for affected devices.

Mine ist the Honor View 20 with the latest patches
"Priorisierte Hintergrundaktivität" is turned on

Same problem "I've checked the entries under Settings --> Google --> COVID-19 Notifications. They don't get updated until I open the app again."

Pleased let me know If I can support you.
Of course I might test a fix.

@NKarolak
Copy link

NKarolak commented Aug 1, 2020

I have some news from my Samsung Galaxy S10e.
After I had set "Adaptive Battery" and "Standby for unused Apps" to false, the COVID-19 Notifications got automatically updated after 24 hours.
The "Standby for unused Apps" seems to be the critical point. I've just enabled "Adaptive Battery" back to true to verify tomorrow that it will still work, hopefully.

What is also interesting about "Standby for unused Apps": the setting allows to declare apps as exceptions from the standby. However, the Corona-Warn-App is not listed there, meaning, I cannot add it as an exception.

[Edit 02.08.20] My assumption was right. The "Adaptive Battery" setting does not have any negative influence on the app and thus can stay active.

@NKarolak
Copy link

NKarolak commented Aug 1, 2020

@heinosahling And I can tell about my partner's Honor View 20 on Android 10.1: The notifications get updated in the background since he has set the following: Battery --> App Start -->disable "Corona-Warn-App" --> new page: let all three entries active.

@traut21
Copy link

traut21 commented Nov 30, 2020

For the moment 1.7.1 finally seems to work, as it always should have been.
Automatic update is shown directly when I open the CWA.
Android 10 on Redmi 9

@cwa-bot cwa-bot bot moved this from Mirrored to Jira to ToDo in [CM] cwa-app-android Nov 30, 2020
@dsarkar
Copy link
Member

dsarkar commented Nov 30, 2020

Dear @traut21 and community, thanks for the feedback. We monitor a few more days this issue, and if appropriate, we will finally close it.

Best wishes,
DS


Corona-Warn-App Open Source Team

@R-Sommer
Copy link

R-Sommer commented Dec 2, 2020

I'm not sure to follow this issue or to create a new one. Please let me know if I'm doing wrong.

My app stopped updating and the last update occurred more than 48 hours ago. Android10 on Samsung Galaxy A6 with app V1.7.1. It's complaning "Risiko-Ermittlung nicht möglich" but "Risiko-Ermittlung" is active. I didn't change any settings, but I can'T remember when the app was updated.

@cwa-bot cwa-bot bot moved this from Waiting for Input to ToDo in [CM] cwa-app-android Dec 2, 2020
@traut21
Copy link

traut21 commented Dec 2, 2020

I'm not sure to follow this issue or to create a new one. Please let me know if I'm doing wrong.

My app stopped updating and the last update occurred more than 48 hours ago. Android10 on Samsung Galaxy A6 with app V1.7.1. It's complaning "Risiko-Ermittlung nicht möglich" but "Risiko-Ermittlung" is active. I didn't change any settings, but I can'T remember when the app was updated.

Check for issues #1081 or #1304. Bluetooth is active? Battery optimization for this app is off?

@R-Sommer
Copy link

R-Sommer commented Dec 3, 2020

Bluetooth is active. Batterie optimization for the app is off.

Today it looks different: It looks as usual means "Risiko-Ermittlung nicht möglich" is gone as well as "Risiko-Ermittlung einschalten". Only the hint "Aktualisiert: 30. Nov. 12:26" still indicates an issue.

@R-Sommer
Copy link

R-Sommer commented Dec 3, 2020

I just forced to stop the app again and after restarting it has updated.

@dsarkar
Copy link
Member

dsarkar commented Dec 3, 2020

Dear @R-Sommer,

Thanks for reporting. Are you able to reproduce this issue? Please, send some feedback over the next few days. Thanks.

Best wishes,
DS


Corona-Warn-App Open Source Team

@dsarkar dsarkar moved this from ToDo to In Progress in [CM] cwa-app-android Dec 3, 2020
@dsarkar dsarkar moved this from In Progress to Waiting for Input in [CM] cwa-app-android Dec 4, 2020
@svengabr
Copy link
Member

svengabr commented Dec 14, 2020

After getting positive feedback from all channels I will consider this issue as resolved. If there are any follow up topics appearing, please create a new issue.

@cwa-bot cwa-bot bot moved this from Waiting for Input to Done in [CM] cwa-app-android Dec 14, 2020
@dsarkar dsarkar removed the hot topic 🔥 Hot Topics from the view point of the Community label Dec 14, 2020
@R-Sommer
Copy link

R-Sommer commented Dec 15, 2020

Dear @R-Sommer,

Thanks for reporting. Are you able to reproduce this issue? Please, send some feedback over the next few days. Thanks.

Best wishes,
DS

Corona-Warn-App Open Source Team

I wasn't able to reproduce this issue. Everything fine since then.

@cwa-bot cwa-bot bot moved this from Done to ToDo in [CM] cwa-app-android Dec 15, 2020
@dsarkar
Copy link
Member

dsarkar commented Dec 15, 2020

Hi @R-Sommer! Thanks for the feedback! Best regards, DS


Corona-Warn-App Open Source Team

@dsarkar dsarkar moved this from ToDo to Done in [CM] cwa-app-android Dec 15, 2020
@dsarkar dsarkar reopened this Dec 28, 2020
@cwa-bot cwa-bot bot moved this from Done to ToDo in [CM] cwa-app-android Dec 28, 2020
@dsarkar dsarkar changed the title Background update does not work, despite v.1.1.1 and “prioritized background activity” Background update does not work, CWA 1.9.1 and “prioritized background activity” Dec 28, 2020
@dsarkar dsarkar added the hot topic 🔥 Hot Topics from the view point of the Community label Dec 28, 2020
@dsarkar dsarkar closed this as completed Dec 28, 2020
@dsarkar dsarkar removed the hot topic 🔥 Hot Topics from the view point of the Community label Dec 28, 2020
@dsarkar dsarkar moved this from ToDo to Done in [CM] cwa-app-android Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mirrored-to-jira This item is also tracked internally in JIRA
Development

No branches or pull requests