Unable to receive MMS on Mako
Bug 7077996
Restore a null check that was in the original code and fix sending messages
to myself.
Change-Id: I0e1e9211a3e00deb264ebc724e6fed849ee77f39
diff --git a/src/java/com/google/android/mms/pdu/PduPersister.java b/src/java/com/google/android/mms/pdu/PduPersister.java
index 6568e0a..8dbc90c 100644
--- a/src/java/com/google/android/mms/pdu/PduPersister.java
+++ b/src/java/com/google/android/mms/pdu/PduPersister.java
@@ -1320,11 +1320,11 @@
// 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);
- loadRecipients(PduHeaders.TO, recipients, addressMap);
+ loadRecipients(PduHeaders.FROM, recipients, addressMap, false);
+ loadRecipients(PduHeaders.TO, recipients, addressMap, true);
break;
case PduHeaders.MESSAGE_TYPE_SEND_REQ:
- loadRecipients(PduHeaders.TO, recipients, addressMap);
+ loadRecipients(PduHeaders.TO, recipients, addressMap, false);
break;
}
@@ -1397,11 +1397,15 @@
* @param addressType can be PduHeaders.FROM or PduHeaders.TO
* @param recipients a HashSet that is loaded with the recipients from the FROM or TO headers
* @param addressMap a HashMap of the addresses from the ADDRESS_FIELDS header
+ * @param excludeMyNumber if true, the number of this phone will be excluded from recipients
*/
private void loadRecipients(int addressType, HashSet<String> recipients,
- HashMap<Integer, EncodedStringValue[]> addressMap) {
+ HashMap<Integer, EncodedStringValue[]> addressMap, boolean excludeMyNumber) {
EncodedStringValue[] array = addressMap.get(addressType);
- String myNumber = mTelephonyManager.getLine1Number();
+ if (array == null) {
+ return;
+ }
+ String myNumber = excludeMyNumber ? mTelephonyManager.getLine1Number() : null;
for (EncodedStringValue v : array) {
if (v != null) {
String number = v.getString();