diff options
author | Wei Huang <weih@google.com> | 2010-06-18 16:07:48 -0700 |
---|---|---|
committer | Wei Huang <weih@google.com> | 2010-06-18 16:22:05 -0700 |
commit | 7bb3d8cf74ec1e4ae18cb814c17e12a00816f105 (patch) | |
tree | 6b250a5c616f6c8a04e856e23daeaa43571ed191 | |
parent | 03f3ab97453c4498c2a1006e83340e8163417954 (diff) | |
download | Mms-7bb3d8cf74ec1e4ae18cb814c17e12a00816f105.tar.gz |
bug #2780967: fix SMS sending message to the wrong person.
- there is an edge case where an old draft message (but w/ only recipient entered, no draft message) would confuse Compose activity to think it's the same
thread_id as a new message (coming into onNewIntent() from status notification). In that case, we don't re-initialize mConversation, which retained the old draft recipient
When the user sends a new message in that state, the message would be addressed to the old draft recipient instead of what's appearing in the UI.
Change-Id: Ic78c4343dc1d9a1639f586dcc8ac861adf73f44f
-rw-r--r-- | src/com/android/mms/ui/ComposeMessageActivity.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/com/android/mms/ui/ComposeMessageActivity.java b/src/com/android/mms/ui/ComposeMessageActivity.java index 78945ac8..6364dfa6 100644 --- a/src/com/android/mms/ui/ComposeMessageActivity.java +++ b/src/com/android/mms/ui/ComposeMessageActivity.java @@ -1826,17 +1826,23 @@ public class ComposeMessageActivity extends Activity log(" new conversation=" + conversation + ", mConversation=" + mConversation); } - long convThreadId = 0; if (conversation != null) { // Don't let any markAsRead DB updates occur before we've loaded the messages for // the thread. conversation.blockMarkAsRead(true); - convThreadId = conversation.getThreadId(); + + // this is probably paranoia to compare both thread_ids and recipient lists, + // but we want to make double sure because this is a last minute fix for Froyo + // and the previous code checked thread ids only. + // (we cannot just compare thread ids because there is a case where mConversation + // has a stale/obsolete thread id (=1) that could collide against the new thread_id(=1), + // even though the recipient lists are different) + sameThread = (conversation.getThreadId() == mConversation.getThreadId() && + conversation.equals(mConversation)); } - if (sameThread || (convThreadId != 0 && convThreadId == mConversation.getThreadId())) { - if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) { - log("onNewIntent: same conversation"); - } + + if (sameThread) { + log("onNewIntent: same conversation"); } else { if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) { log("onNewIntent: different conversation, initialize..."); @@ -2945,7 +2951,7 @@ public class ComposeMessageActivity extends Activity if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) { log("startMsgListQuery for " + conversationUri); } - + // Cancel any pending queries mBackgroundQueryHandler.cancelOperation(MESSAGE_LIST_QUERY_TOKEN); try { |