Merge "Clean up imap2 logging" into jb-ub-mail

This commit is contained in:
Marc Blank 2012-09-06 14:28:26 -07:00 committed by Android (Google) Code Review
commit 2f5897589e

View File

@ -204,7 +204,7 @@ public class Imap2SyncService extends AbstractSyncService {
Cursor deletes = getDeletesCursor(); Cursor deletes = getDeletesCursor();
try { try {
if (mRequestQueue.isEmpty() && updates == null && deletes == null) { if (mRequestQueue.isEmpty() && updates == null && deletes == null) {
userLog("Ping: nothing to do"); userLog("Alarm: nothing to do");
} else { } else {
int cnt = mRequestQueue.size(); int cnt = mRequestQueue.size();
if (updates != null) { if (updates != null) {
@ -213,7 +213,7 @@ public class Imap2SyncService extends AbstractSyncService {
if (deletes != null) { if (deletes != null) {
cnt += deletes.getCount(); cnt += deletes.getCount();
} }
userLog("Ping: " + cnt + " tasks"); userLog("Alarm: " + cnt + " tasks");
ping(); ping();
} }
} finally { } finally {
@ -318,6 +318,8 @@ public class Imap2SyncService extends AbstractSyncService {
String tag = "@@a" + t + ' '; String tag = "@@a" + t + ' ';
if (!cmd.startsWith("login")) { if (!cmd.startsWith("login")) {
userLog(tag + cmd); userLog(tag + cmd);
} else {
userLog("login [redacted]");
} }
out.write(tag); out.write(tag);
out.write(cmd); out.write(cmd);
@ -398,7 +400,7 @@ public class Imap2SyncService extends AbstractSyncService {
mImapResponse = new ArrayList<String>(); mImapResponse = new ArrayList<String>();
while (true) { while (true) {
str = r.readLine(); str = r.readLine();
userLog("< " + str); userLog("< " + ((str.length() > 80) ? str.substring(0, 80) + " ..." : str));
if (caseInsensitiveStartsWith(str, tag)) { if (caseInsensitiveStartsWith(str, tag)) {
// This is the response from the command named 'tag' // This is the response from the command named 'tag'
Parser p = new Parser(str, tag.length() - 1); Parser p = new Parser(str, tag.length() - 1);
@ -1186,7 +1188,7 @@ public class Imap2SyncService extends AbstractSyncService {
if (conn.status == EXIT_DONE) { if (conn.status == EXIT_DONE) {
mBodyThread = new BodyThread(conn, unloaded); mBodyThread = new BodyThread(conn, unloaded);
mBodyThread.start(); mBodyThread.start();
userLog("***** Starting mBodyThread " + mBodyThread.getId()); userLog("Starting mBodyThread " + mBodyThread.getId());
} else { } else {
// fetchMessageData closes the cursor // fetchMessageData closes the cursor
fetchMessageData(mConnection, unloaded); fetchMessageData(mConnection, unloaded);
@ -2178,6 +2180,7 @@ public class Imap2SyncService extends AbstractSyncService {
// Don't kill the connection until mBodyThread is done... // Don't kill the connection until mBodyThread is done...
if (mBodyThread != null) { if (mBodyThread != null) {
try { try {
userLog("BodyThread running; wait for finish...");
mBodyThread.join(); mBodyThread.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
// Just finish... // Just finish...