traccar / traccar-client-android

Traccar Client for Android
https://www.traccar.org/client
Apache License 2.0
659 stars 727 forks source link

CPU always running even with screen off #438

Closed ippocratis closed 1 year ago

ippocratis commented 1 year ago

Describe the bug Device does not go in deep sleep with screen off

To Reproduce 1.install traccar client and setup server and frequency 2.turn screen off wait some hours

  1. adb shell dumpsys batterystats |grep -E "Time on battery"\|"Time on battery screen off"\|"Battery time remaining"\|"Screen off discharge"\|"Device deep doze discharge"\|"Device light doze discharge"\|"Device light idling"\|"Device full idling"

Expected behavior Device should go to deep sleep after some time in screen off

Smartphone (please complete the following information):

Additional context I'm rooted so I can monitor cpu times On any kernel manager it is obvious that the kernel cant go in "deep sleep" state with the traccar client running

But it is also obvious fromdumpsys batterystats that "Device full idling" and "Device deep doze discharge" are missing while using traccar

tananaev commented 1 year ago

Do you have wake lock enabled?

ippocratis commented 1 year ago

Do you have wake lock enabled?

Yes

ippocratis commented 1 year ago

Should I disable that?

tananaev commented 1 year ago

Then why is the expectation that it's going to go into a deep sleep when you explicitly have wake lock enabled? I'm very confused.

ippocratis commented 1 year ago

Then why is the expectation that it's going to go into a deep sleep when you explicitly have wake lock enabled? I'm very confused.

Wake locks does not keep the cpu running constantly

I have other services running in the backround without preventing the cpu from going to sleep Avira,ntfy,gsmcompat,naptime,1.1.1.1

Maybe the method used to request and send a location update every x seconds to serverr is not optimal idk

I see many methods here https://developer.android.com/training/scheduling/wakelock

ippocratis commented 1 year ago

Anyway I disabled the wakelock toggle and see

I.g that was placed there to prevent some oems that kill apps in the backround?

tananaev commented 1 year ago

I'm going to close this for now because it doesn't seem like you have a specific suggestion or a bug report. If you have a suggestion on how we can improve the logic, feel free to create a new ticket and provide specific details on what you want to be changed.

ippocratis commented 1 year ago

I'm going to close this for now because it doesn't seem like you have a specific suggestion or a bug report. If you have a suggestion on how we can improve the logic, feel free to create a new ticket and provide specific details on what you want to be changed.

Been monitoring since yesterday that we last spoke the traccar log for consistent location updates. I've disabled the wakelock option and everything seems to work fluid. Device goes to light and deep doze normaly and the app is not killed while in the backround. Sorry for misunderstanding the use of the wakelock option Thanks And keep up