I did some other test after I identified some issues with my own app as well.
Since April I experience ANT+ connection issues when I'm going to make some pictures during a ride. When I switch back to my app (Jepster) connection is sometimes broken (not always). I was able to reproduce the issue yesterday at home and capture the logcat.
I did the same test with you Ipbike app and saw the same issue.
As you thought it seems to be aggressive battery saving policy which kills a.o. the ant+ service (snapshot):
2021-06-22 08:30:11.120 1013-1307/? I/ChimeraPolicyHandler: Start doKill, protected policy: HEAVY...
2021-06-22 08:30:11.152 1013-1307/? I/ChimeraPolicyHandler: Killed on trigger0 : com.dsi.ant.service.socket, freed: 10944, 10049:G2(0x20000) score=31,6(55 10 10944), pids: 6704 / stats: 4 / adjs: 200
2021-06-22 08:30:11.167 1013-1307/? I/ChimeraPolicyHandler: Killed on trigger0 : com.dsi.ant.plugins.antplus, freed: 26350, 10225:G2(0x20000) score=22,7(29 10 26350), pids: 6932 / stats: 4 / adjs: 200
2021-06-22 08:30:11.171 1013-1307/? I/ChimeraPolicyHandler: kill complete: killed 8 apps, freed 321055 KB
2021-06-22 08:30:11.171 1013-1307/? I/ChimeraPolicyHandler: Processing time(ms) 213
Results after killing apps (snapshot):
2021-06-22 08:30:11.377 1013-4460/? I/ActivityManager: Process com.dsi.ant.plugins.antplus (pid 6932) has died: prcp FGS (206,933)
2021-06-22 08:30:11.378 1013-4460/? W/ActivityManager: Scheduling restart of crashed service com.dsi.ant.plugins.antplus/.heartrate.HeartRateService in 1000ms for connection
2021-06-22 08:30:11.378 1013-4460/? W/ActivityManager: Scheduling restart of crashed service com.dsi.ant.plugins.antplus/.bikepower.BikePowerService in 1000ms for connection
Issue seems to impact other apps as well: https://github.com/urbandroid-team/dont-kill-my-app/issues/307
I'm wondering how to deal with it.
Full log file is blocked so I can't upload. If you want to receive it please let me know.