Permalink
Browse files

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
  • Loading branch information...
1 parent 03f3ab9 commit 7bb3d8cf74ec1e4ae18cb814c17e12a00816f105 Wei Huang committed Jun 18, 2010
Showing with 13 additions and 7 deletions.
  1. +13 −7 src/com/android/mms/ui/ComposeMessageActivity.java
@@ -1826,17 +1826,23 @@ protected void onNewIntent(Intent intent) {
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 @@ private void startMsgListQuery() {
if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
log("startMsgListQuery for " + conversationUri);
}
-
+
// Cancel any pending queries
mBackgroundQueryHandler.cancelOperation(MESSAGE_LIST_QUERY_TOKEN);
try {

0 comments on commit 7bb3d8c

Please sign in to comment.