|
@ -124,6 +124,7 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
private static final int CONNECT_BACKOFF_START = 32; // seconds |
|
|
private static final int CONNECT_BACKOFF_START = 32; // seconds |
|
|
private static final int CONNECT_BACKOFF_MAX = 1024; // seconds (1024 sec ~ 17 min) |
|
|
private static final int CONNECT_BACKOFF_MAX = 1024; // seconds (1024 sec ~ 17 min) |
|
|
private static final long STORE_NOOP_INTERVAL = 9 * 60 * 1000L; // ms |
|
|
private static final long STORE_NOOP_INTERVAL = 9 * 60 * 1000L; // ms |
|
|
|
|
|
private static final int ATTACHMENT_AUTO_DOWNLOAD_SIZE = 32 * 1024; // bytes |
|
|
|
|
|
|
|
|
static final String ACTION_SYNCHRONIZE_FOLDER = BuildConfig.APPLICATION_ID + ".SYNCHRONIZE_FOLDER"; |
|
|
static final String ACTION_SYNCHRONIZE_FOLDER = BuildConfig.APPLICATION_ID + ".SYNCHRONIZE_FOLDER"; |
|
|
static final String ACTION_PROCESS_OPERATIONS = BuildConfig.APPLICATION_ID + ".PROCESS_OPERATIONS"; |
|
|
static final String ACTION_PROCESS_OPERATIONS = BuildConfig.APPLICATION_ID + ".PROCESS_OPERATIONS"; |
|
@ -519,6 +520,7 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
} catch (MessageRemovedException ex) { |
|
|
} catch (MessageRemovedException ex) { |
|
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
} |
|
|
} |
|
|
|
|
|
EntityOperation.process(ServiceSynchronize.this); // download small attachments |
|
|
} catch (Throwable ex) { |
|
|
} catch (Throwable ex) { |
|
|
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
reportError(account.name, folder.name, ex); |
|
|
reportError(account.name, folder.name, ex); |
|
@ -576,6 +578,7 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
try { |
|
|
try { |
|
|
Log.i(Helper.TAG, folder.name + " message changed"); |
|
|
Log.i(Helper.TAG, folder.name + " message changed"); |
|
|
synchronizeMessage(ServiceSynchronize.this, folder, ifolder, (IMAPMessage) e.getMessage(), false); |
|
|
synchronizeMessage(ServiceSynchronize.this, folder, ifolder, (IMAPMessage) e.getMessage(), false); |
|
|
|
|
|
EntityOperation.process(ServiceSynchronize.this); // download small attachments |
|
|
} catch (MessageRemovedException ex) { |
|
|
} catch (MessageRemovedException ex) { |
|
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
} |
|
|
} |
|
@ -1265,6 +1268,7 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
} catch (MessageRemovedException ex) { |
|
|
} catch (MessageRemovedException ex) { |
|
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex)); |
|
|
} |
|
|
} |
|
|
|
|
|
EntityOperation.process(this); // download small attachments |
|
|
|
|
|
|
|
|
Log.w(Helper.TAG, folder.name + " statistics added=" + added + " updated=" + updated + " unchanged=" + unchanged); |
|
|
Log.w(Helper.TAG, folder.name + " statistics added=" + added + " updated=" + updated + " unchanged=" + unchanged); |
|
|
} finally { |
|
|
} finally { |
|
@ -1393,6 +1397,9 @@ public class ServiceSynchronize extends LifecycleService { |
|
|
attachment.message = message.id; |
|
|
attachment.message = message.id; |
|
|
attachment.sequence = sequence; |
|
|
attachment.sequence = sequence; |
|
|
attachment.id = db.attachment().insertAttachment(attachment); |
|
|
attachment.id = db.attachment().insertAttachment(attachment); |
|
|
|
|
|
|
|
|
|
|
|
if (attachment.size != null && attachment.size < ATTACHMENT_AUTO_DOWNLOAD_SIZE) |
|
|
|
|
|
EntityOperation.queue(db, message, EntityOperation.ATTACHMENT, sequence); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
result = 1; |
|
|
result = 1; |
|
|