From e1f17ce8cd1f968b1273938a05ef9237862827d4 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Thu, 11 Oct 2012 18:05:25 -0700 Subject: MMS creates a new thread when receiver is not in the Message thread Bug 7334111 The bug is due to the phone not knowing its own number and hence, not being able to remove the phone's own number from the list of recipients. The simple fix for one-to-one chats is to not add the TO recipients when there's only one recipient, because we know that's going to be ourself. Change-Id: Iec54949e53c350974b8291e389f61b323f1b23f2 --- src/java/com/google/android/mms/pdu/PduPersister.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/java/com/google/android/mms/pdu/PduPersister.java b/src/java/com/google/android/mms/pdu/PduPersister.java index 7178c6c..7e68b21 100644 --- a/src/java/com/google/android/mms/pdu/PduPersister.java +++ b/src/java/com/google/android/mms/pdu/PduPersister.java @@ -1323,11 +1323,14 @@ public class PduPersister { switch (msgType) { case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND: case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF: - // For received messages, we want to associate this message with the thread - // composed of all the recipients. This includes the person who sent the - // message or the FROM field in addition to the other people the message - // was addressed to or the TO field. loadRecipients(PduHeaders.FROM, recipients, addressMap, false); + + // For received messages when group MMS is enabled, we want to associate this + // message with the thread composed of all the recipients -- all but our own + // number, that is. This includes the person who sent the + // message or the FROM field (above) in addition to the other people the message + // was addressed to or the TO field. Our own number is in that TO field and + // we have to ignore it in loadRecipients. if (groupMmsEnabled) { loadRecipients(PduHeaders.TO, recipients, addressMap, true); } @@ -1436,6 +1439,11 @@ public class PduPersister { if (array == null) { return; } + // If the TO recipients is only a single address, then we can skip loadRecipients when + // we're excluding our own number because we know that address is our own. + if (excludeMyNumber && array.length == 1) { + return; + } String myNumber = excludeMyNumber ? mTelephonyManager.getLine1Number() : null; for (EncodedStringValue v : array) { if (v != null) { -- cgit v1.2.3