Permalink
Browse files

Sms sent to wrong recipient

Remove the empty conversation from the conversation cache.
Bug 3057952

Change-Id: I89d0a6445ae9126b51da3cc4bce929ba05e97853
  • Loading branch information...
1 parent 0978a0c commit 1f4171b81be3d2aafcb5d330af5603925f0c02c9 Tom Taylor committed Jan 5, 2011
Showing with 12 additions and 14 deletions.
  1. +12 −14 src/com/android/mms/data/WorkingMessage.java
@@ -756,11 +756,7 @@ synchronized public void discard() {
asyncDelete(mMessageUri, null, null);
}
- // Delete any draft messages associated with this conversation.
- asyncDeleteDraftSmsMessage(mConversation);
-
- // Update state of the draft cache.
- mConversation.setDraftState(false);
+ clearConversation(mConversation);
}
public void unDiscard() {
@@ -1306,19 +1302,21 @@ private String readDraftSmsMessage(Conversation conv) {
// we will lose track of the original draft and be unable to delete
// it later. The message will be re-saved if necessary upon exit of
// the activity.
- asyncDeleteDraftSmsMessage(conv);
+ clearConversation(conv);
+ }
- if (DEBUG) LogTag.debug("readDraftSmsMessage calling clearThreadId");
- conv.clearThreadId();
+ return body;
+ }
+
+ private void clearConversation(final Conversation conv) {
+ asyncDeleteDraftSmsMessage(conv);
- // since we removed the draft message in the db, and the conversation no longer
- // has a thread id, let's clear the draft state for 'thread_id' in the draft cache.
- // Otherwise if a new message arrives it could be assigned the same thread id, and
- // we'd mistaken it for a draft due to the stale draft cache.
- conv.setDraftState(false);
+ if (conv.getMessageCount() == 0) {
+ if (DEBUG) LogTag.debug("clearConversation calling clearThreadId");
+ conv.clearThreadId();
}
- return body;
+ conv.setDraftState(false);
}
private void asyncUpdateDraftSmsMessage(final Conversation conv, final String contents) {

0 comments on commit 1f4171b

Please sign in to comment.