AquaMail Forum

English - Android => General Discussion => Topic started by: lexluthor on December 05, 2012, 05:29:17 pm

Title: Gmail IMAP Implementation
Post by: lexluthor on December 05, 2012, 05:29:17 pm
From what I understand, Gmail's IMAP implementation is somewhat buggy.

Let's say I get a new email in my inbox.  If I mark it as read via gmail web interface, it never gets marked as read automatically in Aquamail (or K9 for that matter).  If I delete the email out of my inbox via gmail web interface, it does get deleted from the Aquamail inbox.

Basically, message read state does not get passed properly via IMAP idle when using gmail.

Can you comment on this?  Any tricks you might be able to think of to get this working correctly?  I could do poll at some interval in addition to push and when it polls, it should get the read state, but at the interval that I'd have to set polling to to make it useful for this purpose, it'd use up more battery than I'd be willing to do.

By the way, that's one of the reasons that it'd be great if you ever got exchange activesync working.  Setting gmail up that way does pass read state properly.  Unfortunately for me, no client that I've found that does exchange activesync works the way I need it to (mainly the need to allow me to have my from and reply to addresses NOT be my gmail address).
Title: Re: Gmail IMAP Implementation
Post by: lexluthor on December 07, 2012, 03:24:52 am
Just making sure this one didn't get lost in all the spam.
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on December 07, 2012, 03:25:16 am
Gmail's IMAP server does two things differently (and I'm only talking about IMAP Push here...)

1 - It does not send message flag changes, although it's *required* by the spec to do this

2 - It "tickles" the app every 5 minutes, even if there were no changes

Because of the above, I have to perform a full "check 25 or whatever most recent messages" on those 5 minute tickles just to get the flags.

Was it an oversight on Google's part, or an intentional way to steer users towards the native Gmail app?
Title: Re: Gmail IMAP Implementation
Post by: lexluthor on December 07, 2012, 03:30:07 am
Ok. So using this, i could see the read flag updated anytime between immediate and 5 minutes after the message is marked as a elsewhere?
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on December 07, 2012, 03:32:57 am
Most of the time, yes:

-- unless there are new messages during that time, in which case the app tries to optimize things a bit and only downloads the new messages.

Performing a full (N recent messages) every time there is a new message would be too expensive.

At the latest, you should be seeing the flags update after the IMAP Idle connection expires and is refreshed, max. 25 minutes, or 12 minutes 30 seconds on the average.
Title: Re: Gmail IMAP Implementation
Post by: ggggg on June 21, 2015, 07:00:13 pm
I am using Llama to switch data and flight mode on my SM-T705, 4.4.2. During the day data is on every 20 minutes for 1 minute or when the user is active (display on) data stays on.

1 I have one gmail account, IMAP but no push (up till now). How should I set up sync options, to reduce wake ups / power consumption ?
Maybe event option mobile, Intervall 18/20, delay 10s ? How is this setting combined with the intervall setting further up on the same page ? It is 15Min.

2. What is less consuming: System settings: Watch or sync even if AutoSync disabled. I have watch right now.
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on June 21, 2015, 07:31:55 pm
If you set Aqua to sync when auto-sync is disabled, but there is no network connection, then that won't work (no network).

If this battery optimizer enables auto-sync, then I'd set Aqua to trigger on that and disable scheduled mail sync -- hopefully, auto-sync will be enabled only once the network connection is fully available.
Title: Re: Gmail IMAP Implementation
Post by: ggggg on June 21, 2015, 08:15:46 pm
LLama doesnt change auto-sync, but mobile-data on/off. (auto-sync stays enabled all the time)

What about:
System settings: watch auto-sync
Poll Intervall: 15min
Start sync on: event option mobile, shortest intervall 18min, Delay 10s

Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on June 21, 2015, 09:56:58 pm
Yes, that should work -- unless your mobile data takes more than 10 seconds to "get ready", and then you'll want to increase the "settle in delay".
Title: Re: Gmail IMAP Implementation
Post by: ggggg on June 22, 2015, 11:10:52 am
OK, is there any log, where I can see when last sync was and if it succeeded ?
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on June 24, 2015, 11:29:42 pm
The app's main window has "last sync time" under each account.
Title: 1.5.7.23, SM-a500fu, 4.4.4, over night data enabled for 1 minute per hour
Post by: ggggg on August 25, 2015, 12:48:27 pm
Problems with long wake locks ... please analyse attached log (every time one email was polled)

sync with 2s lock:
Code: [Select]
15:02:07.726 +0200 LockManager Releasing all locks
15:02:07.727 +0200 LockManager Releasing the Wake lock, time held = 2.41 sec
15:02:07.730 +0200 LockManager After release: Wake lock isHeld = false
15:02:07.731 +0200 LockManager WiFi lock is not held
15:02:07.732 +0200 StartSyncService All locks have been released

sync with 13s lock:
Code: [Select]
15:14:47.458 +0200 UIModeTracker onScreenOff
15:14:47.460 +0200 UIModeTracker Notifying listeners
15:17:51.414 +0200 LostConnectionReceiver {}{}{}{}{} onReceive ConnectivityManager.CONNECTIVITY_ACTION: ni = NetworkInfo: type: mobile[HSPA+], state: CONNECTED/CONNECTED, reason: connected, roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false,  isConn = true, isConnOrConn = true
15:17:51.446 +0200 LostConnectionReceiver {}{}{}{}{} Currently active network info: NetworkInfo: type: mobile[HSPA+], state: CONNECTED/CONNECTED, reason: connected, roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
15:17:51.449 +0200 LostConnectionReceiver {}{}{}{}{} onConnectionEstablished: curr -1, new 0
15:17:51.453 +0200 LostConnectionReceiver {}{}{}{}{} onConnectionEstablished: new connection type is 0
15:17:53.191 +0200 KickSyncReceiver onReceive, Intent = Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 cmp=org.kman.AquaMail/.core.KickSyncReceiver (has extras) }
15:17:53.205 +0200 KickSyncReceiver Connectivity change: NetworkInfo: type: mobile[HSPA+], state: CONNECTED/CONNECTED, reason: connected, roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
15:17:53.209 +0200 KickSyncReceiver Last kick sync event time: 15:01:43
15:17:53.264 +0200 KickSyncReceiver Will kick off sync in 15 seconds
15:17:53.268 +0200 AlarmCompat_api19 setWindow: 0, 1440595088208 (2015-08-26 15:18:08) 5000, PendingIntent{434bfb90: android.os.BinderProxy@4311b060}
15:18:09.244 +0200 KickSyncReceiver onReceive, Intent = Intent { act=org.kman.AquaMail.KICK_SYNC flg=0x14 cmp=org.kman.AquaMail/.core.KickSyncReceiver (has extras) }
15:18:09.332 +0200 KickSyncReceiver Kicking off sync
15:18:09.334 +0200 [POWER.1] Acquired special flag 0x00000001, result 0x00000001
15:18:09.338 +0200 LockManager Acquiring the Wake lock
....
15:18:22.658 +0200 LockManager Releasing the Wake lock, time held = 13.31 sec

the last one has 31s ... without receiving any new email !!!!
Code: [Select]
2015.08.26 18:02:49.351 +0200 LockManager Releasing the Wake lock, time held = 31.67 sec

Title: Re: Gmail IMAP Implementation
Post by: ggggg on August 26, 2015, 05:17:57 pm
Open questions:

As said Llama enables data only once an hour for 1 minute or when the screen is on ... I am syncing 1 gmail account and I have one alias (via gmx) for sending like in gmail.

0) what about wake lock logs from post above ?

1) Under androids account settings I had one Aquamail account (gmail, google apps). After changing the language setting it said appliing settings and now I have a 2nd account for IMAP,POP3. I double checked ... no IMAP in Aqua general settings, no IMAP in Aqua account setting and no IMAP in accounts folder settings !

2) I cant see any difference whether it is set the Aqua gmail account to sync or not (it still syncs if unchecked). In Aqua the sync is set to "observe all" and I have one sync event for mobile connections.

3) What happens if data is enabled (delay=0) and data not yet stable ... does aqua wake lock and for how long does it try ?

4) It looks if one sync event fails (time written in red) Aqua doesnt do any further sync ? How can I overcome that ?

5) When does it sync if enable the sync event "Auto-Sync setting"

6) What is the best setting to have no wake locks and minimum battery drain (please keep my data strategy in mind)

 
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 26, 2015, 10:57:51 pm
Re: the last one has 31s ... without receiving any new email !!!!

Nothing unusual, you should be able to follow the log yourself.

Time to establish new network connection to imap.gmail.com -- 3 seconds

CAPABILITY command -- almost 3 seconds

SELECT INBOX -- 2 seconds

Changing a message's flags (STORE command) -- 2 seconds

And these things do add up.

And then the network connection breaks off, and a bunch of apps are woken / started to process this event (you won't see it in the AquaMail log, but that's what happens on connectivity changes).

One thing you can try is Menu -> Compact the database in Aqua's main window, think I'm seeing some database slowness too in a couple of places.
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 26, 2015, 11:03:10 pm
1 - "AquaMail (IMAP, POP3)" is a category for both IMAP and POP3 accounts.

2 - Right, AquaMail doesn't use the Android "Sync Adapter" framework to do its work.

3 - The attempt to check mail without a network connection won't work and will have network errors

4 - It will check mail next time based on the mail check schedule (by default, 15 minutes).

5 - Toggling auto-sync, the actual setting name and location varies by Android version, but in terms of code, it's this:

   com.android.sync.SYNC_CONN_STATUS_CHANGED

6 - NO wake locks? Uninstall all mail apps, all non-mail apps, power down your phone, and you'll have NO wake locks.

Title: Re: Gmail IMAP Implementation
Post by: ggggg on August 27, 2015, 08:36:00 am
THX. no offence ... I like your app !!! Just a technican who wants to save juice and understand tings  ;-)

Quote
1) Under androids account settings I had one Aquamail account (gmail, google apps). After changing the language setting it said appliing settings and now I have a 2nd account for IMAP,POP3. I double checked ... no IMAP in Aqua general settings, no IMAP in Aqua account setting and no IMAP in accounts folder settings !

3) What happens if data is enabled (delay=0) and data not yet stable ... does aqua wake lock and for how long does it try ?

4) It looks if one sync event fails (time written in red) Aqua doesnt do any further sync ? How can I overcome that ?

5) When does it sync if enable the sync event "Auto-Sync setting"

6) What is the best setting to have no wake locks and minimum battery drain (please keep my data strategy in mind)
0 - One thing you can try is Menu -> Compact the database in Aqua's main window, think I'm seeing some database slowness too in a couple of places.

1 - "AquaMail (IMAP, POP3)" is a category for both IMAP and POP3 accounts.

2 - Right, AquaMail doesn't use the Android "Sync Adapter" framework to do its work.

3 - The attempt to check mail without a network connection won't work and will have network errors

4 - It will check mail next time based on the mail check schedule (by default, 15 minutes).

5 - Toggling auto-sync, the actual setting name and location varies by Android version, but in terms of code, it's this:
com.android.sync.SYNC_CONN_STATUS_CHANGED

ad 0) did not find "compact data base" ?

ad 3) would it say "network error" in log or what would the message be ?

3a) What is the effect of "network check" ON/OFF ?

ad 5) So this is the androids general Autosync ON/OFF button ... not Aquas individual one

5a) is there any way/event to sync when googles framework is syncing

ad 6) which sync would be least on bat...  ?
Title: Re: Gmail IMAP Implementation
Post by: mikeone on August 27, 2015, 08:56:44 am
point 1:
"...and now I have a 2nd account for IMAP,POP3.... "

> ahm, is this 2nd account (generated "automatically"?) an IMAP or a POP3 account?

point 4:
if you exactly know what the app will do, why did you asked the developer about this?
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 27, 2015, 04:48:04 pm
ad 0) did not find "compact data base" ?

--- Menu in the app's main window (account list)

ad 3) would it say "network error" in log or what would the message be ?

-- Yes, network error (briefly) and then the last "good" sync time would turn red below in the account

3a) What is the effect of "network check" ON/OFF ?

-- In app settings -> network? Some devices don't properly report that they're connected, this setting lets you bypass the check.

ad 5) So this is the androids general Autosync ON/OFF button ... not Aquas individual one

-- Yes, system setting

5a) is there any way/event to sync when googles framework is syncing

-- Don't think so.

ad 6) which sync would be least on bat...  ?

-- My phones are all on the default 15 minute sync schedule, no push, no battery saving / memory optimizing apps of any kind.
Title: Re: Gmail IMAP Implementation
Post by: ggggg on August 27, 2015, 05:40:28 pm
ad 0) did not find "compact data base" ?
...
THX, I found it.

7.) mobile connection event: How would I see in log, if I have to set any "settle time" ?

8.) I think I still have not understood the difference between "number mails synced" and "number mails local stored"
"number stored": I think it means the storage on device per synced folder
"number synced": ??
a) Please explain the difference
b) and how it influences the duration of sync if the gmail account has not got any new mails
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 27, 2015, 10:09:39 pm
Re: 7.) mobile connection event: How would I see in log, if I have to set any "settle time" ?


When Android enables a particular network connection (mobile or WiFi) it sends the "network connection available" event before the connection is actually usable (fully brought up and connected).

The "settle in" time is to make AquaMail not rush with checking mail right away, a delay, from the time Android tells Aqua "WiFi is available" or "mobile data is available" and when the app starts the sync process.

Re: "number stored": I think it means the storage on device per synced folder
"number synced": ??

Messages to sync: how many server messages are checked every time, monitored for changes (e.g. disappeared, or their read/unread/starred state changed).

Those are the messages you see when you open an account's folder (message list).

The larger the setting, the more work the app has to do, even if there are no new messages -- since "old" messages can change their state or be deleted at any time (on the server).

Messages to cache: previously loaded messages, not necessarily up to date (wrt. their state or existence), kept around in case you scroll down in a message list.

If you do, the app will be able to update their state (read/unread/starred) without reloading from server from scratch.
Title: Re: Gmail IMAP Implementation
Post by: ggggg on August 28, 2015, 08:44:25 am
Re: 7.) When Android enables a particular network connection (mobile or WiFi) it sends the "network connection available" event before the connection is actually usable (fully brought up and connected).
The "settle in" time is to make AquaMail not rush with checking mail right away, a delay, from the time Android tells Aqua "WiFi is available" or "mobile data is available" and when the app starts the sync process.
1 ad  network settle: But how could I see a not yet stable conn. in log ?
- what about the attached log-AquaMail_79s.txt, it could be an example ?

2 and why is log-AquaMail_why_just_2.8s.txt so fast - is it skipping all ? why ?
Code: [Select]
2015.08.27 13:46:45.832 +0200 [SYNC.1346] Will skip INBOX
2015.08.27 13:46:45.833 +0200 [SYNC.1346] Will skip [Gmail]/Entwürfe
2015.08.27 13:46:45.833 +0200 [SYNC.1346] Will skip [Gmail]/Gesendet
2015.08.27 13:46:45.834 +0200 [SYNC.1346] Will skip [Gmail]/Papierkorb

3 Last night aqua synced about 15 times (1 skipped, rest went OK) ... but why did it start 45 times instead of e.g. 15 times. PLease see attached log-AquaMail_nodelay_45_starts.log and screenshot


Quote
Re: "number stored":
Messages to sync: how many server messages are checked every time, monitored for changes (e.g. disappeared, or their read/unread/starred state changed). Those are the messages you see when you open an account's folder (message list).
The larger the setting, the more work the app has to do, even if there are no new messages -- since "old" messages can change their state or be deleted at any time (on the server).

Messages to cache: previously loaded messages, not necessarily up to date (wrt. their state or existence), kept around in case you scroll down in a message list.
If you do, the app will be able to update their state (read/unread/starred) without reloading from server from scratch.
4 so if the no. synced= 50 and stored=250 (I think thats default)
- it checks the LAST 50 of each synced folder every time
- the rest 200 are untouched even if the state (e.g. read/unread) changes ... I guess I am still wrong, because if one of the 200 is deleted it musr be checked too
- what happens if one has received 100 new mails in its account and sync is on 50 ?
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 30, 2015, 01:21:35 am
Re: network settle: But how could I see a not yet stable conn. in log ?

If the device's connectivity isn't ready -> network (connectivity) errors. In the log, you'll see them as Java exceptions.

Re: and why is log-AquaMail_why_just_2.8s.txt so fast - is it skipping all ? why ?

Yes. AquaMail can (with the "better IMAP servers") very quickly detect if there are no changes since last sync.

And since we're talking about Gmail IMAP here, a change to a single folder (even if it's not synced!) will mark all folders as "changed".

Re:  I guess I am still wrong, because if one of the 200 is deleted it musr be checked too

This won't be detected immediately -- but since the app will only show last 50, you won't see any "ghost" messages.

Until you scroll down to "see more messages" -- then it will check 50 more.


I guess this has to do with how Gmail doesn't separate messages into folders -- rather, there is an account-level message database + each message may have "labels".

Other IMAP servers (Dovecot, Cyrus) are able to properly track changes per-folder.

Re: what happens if one has received 100 new mails in its account and sync is on 50

You will see 50 new messages and the unread count will have 100, so you'll know to scroll down.

And when you do scroll down, the app will load the next 50, so you'll have your 100.
Title: Re: Gmail IMAP Implementation
Post by: ggggg on August 30, 2015, 09:27:13 am
If the device's connectivity isn't ready -> network (connectivity) errors. In the log, you'll see them as Java exceptions.
THX Kostya,
- would the conn error look like this ?
Code: [Select]
2015.08.29 09:27:47.744 +0200 StartSyncService onStartCommand 1
2015.08.29 09:27:47.747 +0200 GenericWorkerThread Executing org.kman.AquaMail.core.StartSyncService$1@4296bcc0
2015.08.29 09:27:47.748 +0200 [*** IDLE ***.729] checkWatchers 0x0
2015.08.29 09:27:47.748 +0200 [*** IDLE ***.729] About to check network type
2015.08.29 09:27:47.753 +0200 [*** IDLE ***.729] Active network info: NetworkInfo: type: mobile[HSPA+], state: CONNECTED/CONNECTED, reason: connected, roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
2015.08.29 09:27:47.756 +0200 [*** IDLE ***.729] Checking system settings: 0
2015.08.29 09:27:47.757 +0200 StartSyncService ***** ACTION_SYNC, planned list is -1 long, grabAll is false, runNow is false *****
2015.08.29 09:27:47.758 +0200 StartSyncService ***** handleStartSyncAccounts() *****
2015.08.29 09:27:47.759 +0200 MailAccountManager Constructor, loadDb = true, loadErrors = true
2015.08.29 09:27:47.762 +0200 AquaMail ***** STACK TRACE FOR : GenericDbOpenHelper: Messages.sqldb
java.lang.Throwable: GenericDbOpenHelper: Messages.sqldb
at org.kman.Compat.util.MyLog.logStackTrace(MyLog.java:159)
at org.kman.AquaMail.data.GenericDbOpenHelper.<init>(GenericDbOpenHelper.java:35)
at org.kman.AquaMail.data.MailDbOpenHelper.<init>(MailDbOpenHelper.java:972)
at org.kman.AquaMail.data.MailDbOpenHelper.get(MailDbOpenHelper.java:644)
at org.kman.AquaMail.data.MailDbHelpers.getDatabase(MailDbHelpers.java:57)
at org.kman.AquaMail.mail.MailAccountManager.<init>(MailAccountManager.java:1740)
at org.kman.AquaMail.mail.MailAccountManager.get(MailAccountManager.java:103)
at org.kman.AquaMail.core.StartSyncService.handleStartSyncAccounts(StartSyncService.java:277)
at org.kman.AquaMail.core.StartSyncService.onStartCommand(StartSyncService.java:224)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3110)
at android.app.ActivityThread.access$2200(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5756)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)

- and could you please comment on #3 of my last post too
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 31, 2015, 08:28:44 pm
- would the conn error look like this ?

No, that's an "exception stack trace" but not a network error. That's the stack trace for opening the database (for my use, really).

Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on August 31, 2015, 08:32:48 pm
Re: #3

45 of "what"?

Mail checks driven by connectivity changes:

$ grep "Will kick off sync" log-AquaMail_nodelay_45_starts.txt
2015.08.27 18:28:05.352 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.27 19:28:05.564 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.27 20:28:05.392 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.27 21:28:05.878 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.27 22:28:04.598 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.27 23:28:05.323 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 00:28:05.518 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 01:28:06.466 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 02:28:04.661 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 03:28:04.809 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 04:28:05.856 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 05:28:05.744 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 06:28:04.584 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 07:28:05.640 +0200   KickSyncReceiver   Will kick off sync in 0 seconds
2015.08.28 08:28:05.697 +0200   KickSyncReceiver   Will kick off sync in 0 seconds

Count: 15


Wake lock releases (paired to acquires, of course):

$ grep "Releasing the Wake lock, time held" log-AquaMail_nodelay_45_starts.txt
2015.08.27 18:28:08.248 +0200   LockManager   Releasing the Wake lock, time held = 2.85 sec
2015.08.27 19:28:14.490 +0200   LockManager   Releasing the Wake lock, time held = 8.91 sec
2015.08.27 20:28:12.564 +0200   LockManager   Releasing the Wake lock, time held = 7.16 sec
2015.08.27 21:28:14.028 +0200   LockManager   Releasing the Wake lock, time held = 8.14 sec
2015.08.27 22:28:11.808 +0200   LockManager   Releasing the Wake lock, time held = 7.19 sec
2015.08.27 23:28:15.350 +0200   LockManager   Releasing the Wake lock, time held = 10.00 sec
2015.08.28 00:28:13.461 +0200   LockManager   Releasing the Wake lock, time held = 7.92 sec
2015.08.28 01:28:14.428 +0200   LockManager   Releasing the Wake lock, time held = 7.95 sec
2015.08.28 02:28:11.898 +0200   LockManager   Releasing the Wake lock, time held = 7.21 sec
2015.08.28 03:28:12.906 +0200   LockManager   Releasing the Wake lock, time held = 8.08 sec
2015.08.28 04:28:13.584 +0200   LockManager   Releasing the Wake lock, time held = 7.71 sec
2015.08.28 05:28:13.825 +0200   LockManager   Releasing the Wake lock, time held = 8.05 sec
2015.08.28 06:28:11.787 +0200   LockManager   Releasing the Wake lock, time held = 7.19 sec
2015.08.28 07:28:13.517 +0200   LockManager   Releasing the Wake lock, time held = 7.86 sec
2015.08.28 08:28:13.579 +0200   LockManager   Releasing the Wake lock, time held = 7.87 sec

Count: 15
Title: Re: Gmail IMAP Implementation
Post by: ggggg on September 01, 2015, 09:18:12 am
Re: #3   45 of "what"?
It was about the number of wakelocks over night. Aqua syncs once per hour triggered by data ON/OFF for 1 minute. So over night thats about 12-15 syncs, but it produces about 45 wakelocks ... see screenshot.

- Sorry, but I still have no idea what the conn error then would look like ...?

- if I set sync to 50 and local stored to 250 in general settings and I am offline ... I just see the last 50 synced  ... I expected to have 250 ?
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on September 01, 2015, 11:26:02 pm
Quote
It was about the number of wakelocks over night. Aqua syncs once per hour triggered by data ON/OFF for 1 minute. So over night thats about 12-15 syncs, but it produces about 45 wakelocks ... see screenshot.

In the log, the wake lock was released 15 times (and so acquired 15 times too).

What is the app's actual battery usage %% value? In system settings -> battery?

Quote
- if I set sync to 50 and local stored to 250 in general settings and I am offline ... I just see the last 50 synced  ... I expected to have 250 ?

Maybe, but it will show 50 because (as explained above), "how many to sync" means "how many messages to check for existence / flags changes".

The other 200 are "beyond the sync window" and will come into play if you scroll down to "see more". But first the app will check the server for the current state of these messages.

If you need to see the cached messages, even if their state (or existence) may not be up to date, do Menu -> View -> Offline list.
Title: Re: Gmail IMAP Implementation
Post by: Kostya Vasilyev on September 01, 2015, 11:28:34 pm
Wake lock *acquires* from the log:

2015.08.27 18:28:05.393 +0200   LockManager   Acquiring the Wake lock
2015.08.27 19:28:05.578 +0200   LockManager   Acquiring the Wake lock
2015.08.27 20:28:05.404 +0200   LockManager   Acquiring the Wake lock
2015.08.27 21:28:05.890 +0200   LockManager   Acquiring the Wake lock
2015.08.27 22:28:04.614 +0200   LockManager   Acquiring the Wake lock
2015.08.27 23:28:05.344 +0200   LockManager   Acquiring the Wake lock
2015.08.28 00:28:05.535 +0200   LockManager   Acquiring the Wake lock
2015.08.28 01:28:06.478 +0200   LockManager   Acquiring the Wake lock
2015.08.28 02:28:04.677 +0200   LockManager   Acquiring the Wake lock
2015.08.28 03:28:04.821 +0200   LockManager   Acquiring the Wake lock
2015.08.28 04:28:05.868 +0200   LockManager   Acquiring the Wake lock
2015.08.28 05:28:05.773 +0200   LockManager   Acquiring the Wake lock
2015.08.28 06:28:04.597 +0200   LockManager   Acquiring the Wake lock
2015.08.28 07:28:05.655 +0200   LockManager   Acquiring the Wake lock
2015.08.28 08:28:05.711 +0200   LockManager   Acquiring the Wake lock


15 of them.

And "all together now":

$ egrep "Acquiring the Wake lock|Releasing the Wake lock, time held" log-AquaMail_nodelay_45_starts.txt

2015.08.27 18:28:05.393 +0200   LockManager   Acquiring the Wake lock
2015.08.27 18:28:08.248 +0200   LockManager   Releasing the Wake lock, time held = 2.85 sec
2015.08.27 19:28:05.578 +0200   LockManager   Acquiring the Wake lock
2015.08.27 19:28:14.490 +0200   LockManager   Releasing the Wake lock, time held = 8.91 sec
2015.08.27 20:28:05.404 +0200   LockManager   Acquiring the Wake lock
2015.08.27 20:28:12.564 +0200   LockManager   Releasing the Wake lock, time held = 7.16 sec
2015.08.27 21:28:05.890 +0200   LockManager   Acquiring the Wake lock
2015.08.27 21:28:14.028 +0200   LockManager   Releasing the Wake lock, time held = 8.14 sec
2015.08.27 22:28:04.614 +0200   LockManager   Acquiring the Wake lock
2015.08.27 22:28:11.808 +0200   LockManager   Releasing the Wake lock, time held = 7.19 sec
2015.08.27 23:28:05.344 +0200   LockManager   Acquiring the Wake lock
2015.08.27 23:28:15.350 +0200   LockManager   Releasing the Wake lock, time held = 10.00 sec
2015.08.28 00:28:05.535 +0200   LockManager   Acquiring the Wake lock
2015.08.28 00:28:13.461 +0200   LockManager   Releasing the Wake lock, time held = 7.92 sec
2015.08.28 01:28:06.478 +0200   LockManager   Acquiring the Wake lock
2015.08.28 01:28:14.428 +0200   LockManager   Releasing the Wake lock, time held = 7.95 sec
2015.08.28 02:28:04.677 +0200   LockManager   Acquiring the Wake lock
2015.08.28 02:28:11.898 +0200   LockManager   Releasing the Wake lock, time held = 7.21 sec
2015.08.28 03:28:04.821 +0200   LockManager   Acquiring the Wake lock
2015.08.28 03:28:12.906 +0200   LockManager   Releasing the Wake lock, time held = 8.08 sec
2015.08.28 04:28:05.868 +0200   LockManager   Acquiring the Wake lock
2015.08.28 04:28:13.584 +0200   LockManager   Releasing the Wake lock, time held = 7.71 sec
2015.08.28 05:28:05.773 +0200   LockManager   Acquiring the Wake lock
2015.08.28 05:28:13.825 +0200   LockManager   Releasing the Wake lock, time held = 8.05 sec
2015.08.28 06:28:04.597 +0200   LockManager   Acquiring the Wake lock
2015.08.28 06:28:11.787 +0200   LockManager   Releasing the Wake lock, time held = 7.19 sec
2015.08.28 07:28:05.655 +0200   LockManager   Acquiring the Wake lock
2015.08.28 07:28:13.517 +0200   LockManager   Releasing the Wake lock, time held = 7.86 sec
2015.08.28 08:28:05.711 +0200   LockManager   Acquiring the Wake lock
2015.08.28 08:28:13.579 +0200   LockManager   Releasing the Wake lock, time held = 7.87 sec


15