Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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
Wei Huang authored and android-build SharedAccount committed Jun 21, 2010
1 parent 39e04cc commit ffadc4b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/com/android/mms/ui/ComposeMessageActivity.java
Expand Up @@ -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...");
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ffadc4b

Please sign in to comment.