Fix mismash message

A particular set of repo steps involving creating a draft, then deleting
the draft and then receiving a new message can lead to a situation where
a new incoming message gets the old thread id of the discarded
draft. The compose activity can end up displaying the recipients of the
old message with the contents of the new message. Recognize this dangerous
situation and bail out to the ConversationList where the user can
enter the compose activity in a clean manner.
Bug 2793874

Change-Id: I795ed6e1d95d9c1a2d1093a2491ca8c449ff2609
diff --git a/src/com/android/mms/ui/ComposeMessageActivity.java b/src/com/android/mms/ui/ComposeMessageActivity.java
index 6364dfa..7cd685b 100644
--- a/src/com/android/mms/ui/ComposeMessageActivity.java
+++ b/src/com/android/mms/ui/ComposeMessageActivity.java
@@ -1860,7 +1860,16 @@
         super.onRestart();
 
         if (mWorkingMessage.isDiscarded()) {
-            mWorkingMessage.unDiscard();    // it was discarded in onStop().
+            // If the message isn't worth saving, don't resurrect it. Doing so can lead to
+            // a situation where a new incoming message gets the old thread id of the discarded
+            // draft. This activity can end up displaying the recipients of the old message with
+            // the contents of the new message. Recognize that dangerous situation and bail out
+            // to the ConversationList where the user can enter this in a clean manner.
+            if (mWorkingMessage.isWorthSaving()) {
+                mWorkingMessage.unDiscard();    // it was discarded in onStop().
+            } else {
+                goToConversationList();
+            }
         }
     }