clariusdev / mobileapi

Android API Allowing IPC with the Clarius App
https://www.clarius.com
BSD 3-Clause "New" or "Revised" License
12 stars 4 forks source link

Clarius App looks to autofreeze when it is in background #32

Open daudrain opened 11 months ago

daudrain commented 11 months ago

Steps

Results

With Samsung Galaxy Tab S9 5G/Model SM X716B/Android 13

After few seconds, the client app stops receiving ultrasound images.

With Samsing Galaxy Tab S8 or S7/Android 13 - Android 11

Images are being streamed for ever (until the probe runs out of battery or it is too hot)

Samsung Tab S9 Logcat

There are some weird FreecessController logs occuring on S9 few seconds after getting the first images that don't occur on S8:

2023-09-28 18:02:50.322 28382-28382 probe.mobileapi.svc     io.deski.heartfocus                  I  Service sending broadcast io.deski.heartfocus.clariusapi.CONFIGURE_IMAGE
2023-09-28 18:02:50.322 28323-28323 probe.mobileapi.bridge  io.deski.heartfocus                  V  onReceive(Intent io.deski.heartfocus.clariusapi.CONFIGURE_IMAGE)
2023-09-28 18:02:52.066  4875-4955  RequestManager_FLP      com.sec.location.nsflp2              I  onOpChanged, op=0 / packageName=me.clarius.clarius
2023-09-28 18:02:57.112  2560-4892  FreecessController      system_server                        D  me.clarius.clarius(state: Initial -> Freezeable, Reason: uidIdle)
2023-09-28 18:03:07.118  2560-4892  FreecessController      system_server                        D  me.clarius.clarius(state: Freezeable -> Frozen, Reason: uidIdle)
2023-09-28 18:03:07.120  2560-4892  FreecessController      system_server                        D  FZ : me.clarius.clarius(18927)
2023-09-28 18:03:07.127  2560-4892  FreecessController      system_server                        D  FZ : me.clarius.clarius(0), reason: Bg

Do you see any workaround to prevent the freeze behavior on S9?

Thx

julien-l commented 11 months ago

Apparently the Android 13 on S9 decided to kill the Clarius App because it is in the background but it shouldn't because the app is running a foreground service (the Mobile API service). This usually happens when memory is running low and the OS reclaims resources. To prevent this: avoid running other apps in parallel or keep the Clarius App in the foreground (e.g. split screen). I will try to reproduce.

daudrain commented 11 months ago

The Galaxy Tab S9 we're using have 12GB of memory, less than 5GB is in use. It also occurs when using a demo scanner.

Looks like a specific build issue. image

daudrain commented 11 months ago

Setting the Clarius app's battery usage as unrestricted looks to work around this behavior.