From 9e42c23d4c20683b7c3bb31e3c14ff7968cd1bab Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Wed, 17 Jun 2015 08:48:53 +0200 Subject: [PATCH] Improve debug logging. Change-Id: I13a99d5caadcc7bd2682791527f71a697d07f8d0 --- .../com/android/email/provider/EmailProvider.java | 4 +++- .../com/android/email/service/ImapService.java | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/provider_src/com/android/email/provider/EmailProvider.java b/provider_src/com/android/email/provider/EmailProvider.java index 8e4e7b6a1..a73cbf9e3 100644 --- a/provider_src/com/android/email/provider/EmailProvider.java +++ b/provider_src/com/android/email/provider/EmailProvider.java @@ -1820,6 +1820,8 @@ public class EmailProvider extends ContentProvider extras.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, true); extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(amAccount, EmailContent.AUTHORITY, extras); + LogUtils.i(TAG, "requestSync EmailProvider restoreAccounts %s, %s", + account.toString(), extras.toString()); restoredCount++; } } @@ -5978,7 +5980,7 @@ public class EmailProvider extends ContentProvider extras.putString(EmailServiceStatus.SYNC_EXTRAS_CALLBACK_METHOD, SYNC_STATUS_CALLBACK_METHOD); ContentResolver.requestSync(account, EmailContent.AUTHORITY, extras); - LogUtils.i(TAG, "requestSync EmailProvider startSync %s, %s", account.toString(), + LogUtils.i(TAG, "requestSync EmailProvider restartPush %s, %s", account.toString(), extras.toString()); } diff --git a/provider_src/com/android/email/service/ImapService.java b/provider_src/com/android/email/service/ImapService.java index 1256491ae..4522809f0 100644 --- a/provider_src/com/android/email/service/ImapService.java +++ b/provider_src/com/android/email/service/ImapService.java @@ -271,6 +271,9 @@ public class ImapService extends Service { // Request a quick sync to make sure we didn't lose any new mails // during the failure time ImapService.requestSync(mContext, account, mMailbox.mId, false); + LogUtils.d(LOG_TAG, "requestSync after reschedulePing for account %s (%s)", + account.toString(), mMailbox.mDisplayName); + } catch (MessagingException ex) { LogUtils.w(LOG_TAG, ex, "Failed to register mailbox for idle. Reschedule."); reschedulePing(increasePingDelay()); @@ -545,6 +548,8 @@ public class ImapService extends Service { // Request a "recents" sync ImapService.requestSync(mContext, account, Mailbox.NO_MAILBOX, false); + LogUtils.d(LOG_TAG, "requestSync after restarting IDLE " + + "for account %s", account.toString()); } } finally { c.close(); @@ -807,6 +812,8 @@ public class ImapService extends Service { } mBinder.init(context); mBinder.requestSync(inboxId,true,0); + LogUtils.d(LOG_TAG, "requestSync on user request for account %d (%d)", + accountId, inboxId); } else if (ACTION_DELETE_MESSAGE.equals(action)) { final long messageId = intent.getLongExtra(EXTRA_MESSAGE_ID, -1); if (Logging.LOGD) { @@ -1009,10 +1016,6 @@ public class ImapService extends Service { } private static void requestSync(Context context, Account account, long mailbox, boolean full) { - if (Logging.LOGD) { - LogUtils.d(LOG_TAG, "Request sync due to idle response for mailbox " + mailbox); - } - final EmailServiceUtils.EmailServiceInfo info = EmailServiceUtils.getServiceInfoForAccount( context, account.mId); final android.accounts.Account acct = new android.accounts.Account(