am 2fe940d5: am fba2e9ff: am fe0ff1f5: am 5878dc7e: Merge "Do not assume mAccount is the default email" into ub-gmail-ur14-dev
* commit '2fe940d5b2212ecc319e48c30530a7d1c3425dbb':
Do not assume mAccount is the default email
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index 42c0ce7..c27a0f2 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -1208,7 +1208,7 @@
}
if (mReplyFromAccount == null) {
if (mDraft != null) {
- mReplyFromAccount = getReplyFromAccountFromDraft(mAccount, mDraft);
+ mReplyFromAccount = getReplyFromAccountFromDraft(mDraft);
} else if (mRefMessage != null) {
mReplyFromAccount = getReplyFromAccountForReply(mAccount, mRefMessage);
}
@@ -1315,20 +1315,15 @@
account.getSenderName(), account.getEmailAddress(), true, false);
}
- private ReplyFromAccount getReplyFromAccountFromDraft(final Account account,
- final Message msg) {
+ private ReplyFromAccount getReplyFromAccountFromDraft(final Message msg) {
final Address[] draftFroms = Address.parse(msg.getFrom());
final String sender = draftFroms.length > 0 ? draftFroms[0].getAddress() : "";
ReplyFromAccount replyFromAccount = null;
- List<ReplyFromAccount> replyFromAccounts = mFromSpinner.getReplyFromAccounts();
- if (TextUtils.equals(account.getEmailAddress(), sender)) {
- replyFromAccount = getDefaultReplyFromAccount(account);
- } else {
- for (ReplyFromAccount fromAccount : replyFromAccounts) {
- if (TextUtils.equals(fromAccount.address, sender)) {
- replyFromAccount = fromAccount;
- break;
- }
+ // Do not try to check against the "default" account because the default might be an alias.
+ for (ReplyFromAccount fromAccount : mFromSpinner.getReplyFromAccounts()) {
+ if (TextUtils.equals(fromAccount.address, sender)) {
+ replyFromAccount = fromAccount;
+ break;
}
}
return replyFromAccount;