am 5ac8a35c: Merge "Fix uncommanded exit from MessageList with 2+ accounts" into froyo

Merge commit '5ac8a35c4290d9e3ce22eb28341214189a40fc6c' into froyo-plus-aosp

* commit '5ac8a35c4290d9e3ce22eb28341214189a40fc6c':
  Fix uncommanded exit from MessageList with 2+ accounts
This commit is contained in:
Andrew Stadler 2010-04-23 13:34:23 -07:00 committed by Android Git Automerger
commit da0fb1784c

View File

@ -1102,7 +1102,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
final boolean accountExists = Account.isValidId(MessageList.this, mAccountId); final boolean accountExists = Account.isValidId(MessageList.this, mAccountId);
if (accountExists && mOkToRecurse) { if (accountExists && mOkToRecurse) {
// launch network lookup // launch network lookup
mControllerCallback.mWaitForMailboxType = mMailboxType; mControllerCallback.presetMailboxListCallback(mMailboxType, mAccountId);
mController.updateMailboxList(mAccountId, mControllerCallback); mController.updateMailboxList(mAccountId, mControllerCallback);
} else { } else {
// We don't want to do the network lookup, or the account doesn't exist in the // We don't want to do the network lookup, or the account doesn't exist in the
@ -1436,19 +1436,26 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
// This is used to alter the connection banner operation for sending messages // This is used to alter the connection banner operation for sending messages
MessagingException mSendMessageException; MessagingException mSendMessageException;
// This is preset for use by updateMailboxListCallback // These values are set by FindMailboxTask, and used by updateMailboxListCallback
int mWaitForMailboxType = -1; // Access to these must be synchronized because of various threads dealing with them
private int mWaitForMailboxType = -1;
private long mWaitForMailboxAccount = -1;
// TODO check accountKey and only react to relevant notifications public synchronized void presetMailboxListCallback(int mailboxType, long accountId) {
public void updateMailboxListCallback(MessagingException result, long accountKey, mWaitForMailboxType = mailboxType;
int progress) { mWaitForMailboxAccount = accountId;
}
public synchronized void updateMailboxListCallback(MessagingException result,
long accountKey, int progress) {
// updateMailboxList is never the end goal in MessageList, so we don't show // updateMailboxList is never the end goal in MessageList, so we don't show
// these errors. There are a couple of corner cases that we miss reporting, but // these errors. There are a couple of corner cases that we miss reporting, but
// this is better than reporting a number of non-problem intermediate states. // this is better than reporting a number of non-problem intermediate states.
// updateBanner(result, progress, mMailboxId); // updateBanner(result, progress, mMailboxId);
updateProgress(result, progress); updateProgress(result, progress);
if (progress == 100) { if (progress == 100 && accountKey == mWaitForMailboxAccount) {
mWaitForMailboxAccount = -1;
mHandler.lookupMailboxType(accountKey, mWaitForMailboxType); mHandler.lookupMailboxType(accountKey, mWaitForMailboxType);
} }
} }