Merge change I218079f2 into eclair-mr2

* changes:
  Fix timing-dependent crash in Medium tests (#2202726)
This commit is contained in:
Android (Google) Code Review 2009-10-21 18:44:47 -04:00
commit da08e3bcb6

View File

@ -1039,26 +1039,29 @@ public class EasSyncService extends AbstractSyncService {
mExitStatus = EXIT_DONE; mExitStatus = EXIT_DONE;
} }
protected void setupService() { protected boolean setupService() {
// Make sure account and mailbox are always the latest from the database // Make sure account and mailbox are always the latest from the database
mAccount = Account.restoreAccountWithId(mContext, mAccount.mId); mAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
if (mAccount == null) return false;
mMailbox = Mailbox.restoreMailboxWithId(mContext, mMailbox.mId); mMailbox = Mailbox.restoreMailboxWithId(mContext, mMailbox.mId);
if (mMailbox == null) return false;
mThread = Thread.currentThread(); mThread = Thread.currentThread();
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
TAG = mThread.getName(); TAG = mThread.getName();
HostAuth ha = HostAuth.restoreHostAuthWithId(mContext, mAccount.mHostAuthKeyRecv); HostAuth ha = HostAuth.restoreHostAuthWithId(mContext, mAccount.mHostAuthKeyRecv);
if (ha == null) return false;
mHostAddress = ha.mAddress; mHostAddress = ha.mAddress;
mUserName = ha.mLogin; mUserName = ha.mLogin;
mPassword = ha.mPassword; mPassword = ha.mPassword;
return true;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Runnable#run() * @see java.lang.Runnable#run()
*/ */
public void run() { public void run() {
setupService(); if (!setupService()) return;
try { try {
SyncManager.callback().syncMailboxStatus(mMailboxId, EmailServiceStatus.IN_PROGRESS, 0); SyncManager.callback().syncMailboxStatus(mMailboxId, EmailServiceStatus.IN_PROGRESS, 0);