diff options
| author | Taesu Lee <taesu82.lee@samsung.com> | 2020-09-16 20:41:35 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-09-16 20:41:35 +0000 |
| commit | 492f7ee2d1ab28c4f1ab3daf3b324b503506b5d5 (patch) | |
| tree | e9a6391b206b92045de552ccef1c18ff75bd002e | |
| parent | c0f9bb158644e7644eee8e2d658bc801678d1c5b (diff) | |
| parent | 71f8b60cdfe86a9557127701db3c4b422e3994c6 (diff) | |
| download | platform_packages_apps_Messaging-492f7ee2d1ab28c4f1ab3daf3b324b503506b5d5.tar.gz platform_packages_apps_Messaging-492f7ee2d1ab28c4f1ab3daf3b324b503506b5d5.tar.bz2 platform_packages_apps_Messaging-492f7ee2d1ab28c4f1ab3daf3b324b503506b5d5.zip | |
Fix creating a new conversation including own number am: 9c97af9b83 am: e7df722655 am: 71f8b60cdf
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Messaging/+/1427818
Change-Id: Ie2d803c9ed06cc4f404a8b0cc05e44d6905cea73
| -rw-r--r-- | src/com/android/messaging/mmslib/pdu/PduPersister.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/com/android/messaging/mmslib/pdu/PduPersister.java b/src/com/android/messaging/mmslib/pdu/PduPersister.java index d1175ab..6615d30 100644 --- a/src/com/android/messaging/mmslib/pdu/PduPersister.java +++ b/src/com/android/messaging/mmslib/pdu/PduPersister.java @@ -1415,11 +1415,11 @@ public class PduPersister { // For received messages (whether group MMS is enabled or not) we want to // associate this message with the thread composed of all the recipients - // EXCLUDING our own number. This includes the person who sent the - // message (the FROM field above) in addition to the other people the message - // was addressed TO (or CC fields to address group messaging compatibility - // issues with devices that place numbers in this field). Typically our own - // number is in the TO/CC field so we have to remove it in loadRecipients. + // EXCLUDING our own number. This includes the person who sent the message + // (the FROM field above) in addition to the other people the message was + // addressed TO (or CC fields to address group messaging compatibility issues + // with devices that place numbers in this field). Typically our own number is + // in the TO/CC field so we have to remove it in checkAndLoadToCcRecipients. checkAndLoadToCcRecipients(recipients, addressMap, subPhoneNumber); break; case PduHeaders.MESSAGE_TYPE_SEND_REQ: @@ -1582,9 +1582,17 @@ public class PduPersister { } } } + + // If selfNumber is unavailable and there is only a single address in all TO and CC, we can + // skip adding it into recipients as assuming it is my own phone number. + final boolean isSelfNumberUnavailable = TextUtils.isEmpty(selfNumber); + if (isSelfNumberUnavailable && numbers.size() == 1) { + return; + } + for (final String number : numbers) { // Only add numbers which aren't my own number. - if (TextUtils.isEmpty(selfNumber) || !PhoneNumberUtils.compare(number, selfNumber)) { + if (isSelfNumberUnavailable || !PhoneNumberUtils.compare(number, selfNumber)) { if (!recipients.contains(number)) { // Only add numbers which aren't already included. recipients.add(number); |
