From 632ee24d48f308c855ddec8f013b674e5ade67e2 Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Fri, 18 Oct 2013 14:04:49 -0700 Subject: [PATCH] Populate real name in From: field b/11246653 Change-Id: I8629ba655b99629f7b14f857acb67cb8453ddb8b --- src/com/android/email/provider/EmailProvider.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index a9bdbff5b..4dada5eb9 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2376,6 +2376,8 @@ public class EmailProvider extends ContentProvider { .add(UIProvider.AccountColumns.NAME, AccountColumns.DISPLAY_NAME) .add(UIProvider.AccountColumns.ACCOUNT_MANAGER_NAME, AccountColumns.EMAIL_ADDRESS) + .add(UIProvider.AccountColumns.SENDER_NAME, + AccountColumns.SENDER_NAME) .add(UIProvider.AccountColumns.UNDO_URI, ("'content://" + EmailContent.AUTHORITY + "/uiundo'")) .add(UIProvider.AccountColumns.URI, uriWithId("uiaccount")) @@ -4282,14 +4284,19 @@ public class EmailProvider extends ContentProvider { * - UIProvider.MessageColumns.SNIPPET * - UIProvider.MessageColumns.REPLY_TO * - UIProvider.MessageColumns.FROM - * - UIProvider.MessageColumns.CUSTOM_FROM_ADDRESS */ private Uri uiSaveMessage(Message msg, Mailbox mailbox, Bundle extras) { final Context context = getContext(); // Fill in the message final Account account = Account.restoreAccountWithId(context, mailbox.mAccountKey); if (account == null) return null; - msg.mFrom = account.mEmailAddress; + final String customFromAddress = + extras.getString(UIProvider.MessageColumns.CUSTOM_FROM_ADDRESS); + if (!TextUtils.isEmpty(customFromAddress)) { + msg.mFrom = customFromAddress; + } else { + msg.mFrom = account.getEmailAddress(); + } msg.mTimeStamp = System.currentTimeMillis(); msg.mTo = extras.getString(UIProvider.MessageColumns.TO); msg.mCc = extras.getString(UIProvider.MessageColumns.CC);