Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug] High Battery Usage Due to Frequent WakeLocks in Wear OS Complications #3821

Open
TebbeUbben opened this issue Feb 11, 2025 · 2 comments

Comments

@TebbeUbben
Copy link
Member

I have noticed that using AndroidAPS complications on my Wear OS watch significantly increases battery consumption - reducing battery life by several hours. Upon analyzing battery logs, I found that AndroidAPS acquires a WakeLock every 15 seconds, which prevents the device from entering a more power-efficient sleep mode.

The issue originates from this line in BaseComplicationProviderService. The intention behind this logic is to ensure complications update correctly when displaying the time elapsed since the last CGM reading. However, this approach keeps the CPU awake unnecessarily, leading to excessive power drain.

A more battery-efficient way to achieve the same behavior is to use ComplicationText.TimeDifferenceBuilder. This allows the system to intelligently update the complication only when needed, reducing unnecessary wake-ups and code executions and allowing the watch to stay in a low-power state when not in use.

I’ve implemented this approach for the LongStatusComplication, and it has worked well in my testing. My changes can be found in the wear-complications-timedifference branch.

Additionally, newer Wear OS versions and Jetpack libraries introduce dynamic expressions, which provide even more flexibility for complication updates while optimizing battery usage.

@MilosKozak
Copy link
Contributor

@Philoul

@SimonPhilpott
Copy link

I'm sure this is causing the same issue for me too. Not on my watch but on my phone, I have an issue raised and noticed the excessive wakelocks too.

Image

#3819

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants