summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Taylor <tomtaylor@google.com>2012-10-11 18:05:25 -0700
committerTom Taylor <tomtaylor@google.com>2012-10-11 18:05:25 -0700
commite1f17ce8cd1f968b1273938a05ef9237862827d4 (patch)
tree7a6fcde317da44077cff3d763f6b2114549e34fa
parentab17014baf326d69a5bfd153622a1d7da6a4f9ce (diff)
downloadmms-e1f17ce8cd1f968b1273938a05ef9237862827d4.tar.gz
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
-rw-r--r--src/java/com/google/android/mms/pdu/PduPersister.java16
1 files changed, 12 insertions, 4 deletions
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) {