Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Samsung S10 Screen off Switching on ANT Buffering

RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

I have had a report from a user relating to bad behavior with a Samsung S10 running Android 11 details below. This is with my app IpBike and IpSensorMan.

After a good bit of debugging it looks like the ANT event buffering is being enabled some time soon after the screen is switched off. In normal operating mode the first thing I do is disable the buffering so I get the messages straight away and can cleanly mix the data with data from other sensors e.g. Ble sensors as well as data directly from the phone like GPS and pressure sensor data. This all works as expected when the screen is on but if the user lets the screen switch off then I get no data for something like 20 seconds then a bust of lots of messages all at once.

I have added code to detect the situation and check the EventBufferSettings. They are comming back with 0 for the buffer time which is what I see after I have switched the buffer off. I set the state to switch the buffer off anyway but from the way the data is comming in it looks like the buffering is enabled regardless.

My strong suspicion is that there is some aggressive battery saving going on at the driver level adjusting the effective ANT buffering and ignoring the API's to control it when the screen is off. The user says they are not running any other relevant apps and are not running in an aggressing battery saving mode. They have gone and marked the relevant apps as not to be battery optimized but nothing looks to be changing things.

If anyone has any ideas or clues as to what might be going on then I would be very interested. I have only the one report but most of my users keep the screen on although screen off and text to speech based feedback and data logging is a valid way to use the app.

Samsung S10 SM-G973U1
One UI version 3.0
Android version 11
Build # is RP1A200720.012.G973U1UEU4FUA4
Kernel Version is 4.14.190-abG973U1UEU4FUA4
     
Rank

Total Posts: 13

Joined 0

PM

Hi Ifor,

I have a S10 myself and tested it by switching of the screen with my own app (Jepster). But I don't see any missing data from ant+ sensors in my app. I will try to test your app as well somewhere next days.

But note I have a different build and kernel, last characters are: FXXU9FUCD

Might be difference between European version with different hardware and US or other regions.

Best regards, Tom      
Rank

Total Posts: 13

Joined 0

PM

Hi Ifor,

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/ChimeraPolicyHandlerStart doKill, protected policyHEAVY...
2021-06-22 08:30:11.152 1013-1307/? I/ChimeraPolicyHandlerKilled on trigger0 com.dsi.ant.service.socketfreed1094410049[6704]:G2(0x20000score=31,6(55 10 10944), pids6704 statsadjs200 
2021
-06-22 08:30:11.167 1013-1307/? I/ChimeraPolicyHandlerKilled on trigger0 com.dsi.ant.plugins.antplusfreed2635010225[6932]:G2(0x20000score=22,7(29 10 26350), pids6932 statsadjs200 
2021
-06-22 08:30:11.171 1013-1307/? I/ChimeraPolicyHandlerkill completekilled 8 appsfreed 321055 KB
2021
-06-22 08:30:11.171 1013-1307/? I/ChimeraPolicyHandlerProcessing time(ms213 


Results after killing apps (snapshot):
2021-06-22 08:30:11.377 1013-4460/? I/ActivityManagerProcess com.dsi.ant.plugins.antplus (pid 6932has diedprcp FGS (206,933)
2021-06-22 08:30:11.378 1013-4460/? W/ActivityManagerScheduling 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/ActivityManagerScheduling 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.