Author Topic: No IMAP only sync after reboot on Marshmallow, android 6  (Read 16066 times)

Kostya Vasilyev

  • Hero Member
  • *****
  • Posts: 12740
Re: No IMAP only sync after reboot on Marshmallow, android 6
« Reply #30 on: March 20, 2016, 02:48:28 pm »
Re: AlarmManager wake locks only fire when the WiFi radio is enabled and connected

Then those are internal to Android code.

Re: A single AlarmManager wake lock is generated at an interval roughly corresponding to the timer setting in "best network switcher

And those are too.

Re: http://developer.android.com/reference/android/app/AlarmManager.html

If you look at "constants" there you'll see "RTC":

"This alarm does not wake the device up; if it goes off while the device is asleep, it will not be delivered until the next time the device wakes up."

And my code in "best network switcher" is like this:

mAlarmManager.setRepeating(AlarmManager.RTC, now + interval, interval, operation);

So I suppose what may be happening -- since it's a "no wake up" alarm type, the system will not wake up the device just for that.

OK, but if the device already is awake (for other reasons) the Android "alarm handling" code might acquire a wake lock, *while it's delivering this alarm to the app* to avoid possible "race conditions" -- i.e. the device being awake, the system code deciding to deliver the alarm, then the device falling asleep in the middle of that.

---

Getting back to AquaMail -- I suppose there could be wake locks internal to Android implementation of some things.

One thing comes to mind is -- even though the app does not use "system settings -> accounts -> various "sync" things" to actually check mail, it does trigger a "sync" there (just so the "last sync time" there updates, for the user to see).

The sync operation (as far as "system settings -> accounts" goes) is "dummy", a "no-op", takes a few milliseconds, but I suppose Android could acquire a wake lock while processing it.
Creating debug logs for diagnostics: https://www.aqua-mail.com/troubleshooting/

The official FAQ: https://www.aqua-mail.com/faq/

Лог-файлы для диагностики: https://www.aqua-mail.com/ru/troubleshooting/

Вопросы и ответы: https://www.aqua-mail.com/ru/faq/

Davey126

  • Sr. Member
  • ****
  • Posts: 258
Re: No IMAP only sync after reboot on Marshmallow, android 6
« Reply #31 on: March 31, 2016, 07:29:40 pm »
I refrained from immediately commenting as I wanted to observe behaviors on several different devices over an 'extended' period (in this case 1 week).

In the end I come back to what was said at the top of the wakelock conversation:
- Android (not some random app) attributes numerous wakelocks to WiFi Manager and AquaMail..fairly or unfairly
- In the case of WiFi Manager these wake locks have NO ADVERSE IMPACT on device performance or wake time
- AquaMail wakelocks can keep the device awake for brief periods but for good reason as the device is executing functions requested by the user. If you don't like the wakelocks turn off IMAP push, scheduled sync and event based sync actions

Of course the developer already knew this but I felt it important to close out the discussion as I was the one who initiated the wakelock distraction in response to a comment from the OP who suggested AquaMail generated more wakelocks than other mail clients (see Post by Davey126 on March 16, 2016, 04:25:25 pm).