Messaging: Language cleanup
No unnecessary boxing, enhanced for loops, redundant checks and throws, imports (removal, reordering), possible void returns Change-Id: I7a8e1b2007e3b0906e01b41785c518d02c2f3fab
This commit is contained in:
@@ -522,8 +522,8 @@ public class PduComposer {
|
||||
}
|
||||
|
||||
EncodedStringValue temp;
|
||||
for (int i = 0; i < addr.length; i++) {
|
||||
temp = appendAddressType(addr[i]);
|
||||
for (EncodedStringValue encodedStringValue : addr) {
|
||||
temp = appendAddressType(encodedStringValue);
|
||||
if (temp == null) {
|
||||
return PDU_COMPOSE_CONTENT_ERROR;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.util.SparseArray;
|
||||
import com.android.messaging.mmslib.InvalidHeaderValueException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class PduHeaders {
|
||||
/**
|
||||
@@ -648,9 +649,7 @@ public class PduHeaders {
|
||||
}
|
||||
|
||||
ArrayList<EncodedStringValue> list = new ArrayList<>();
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
list.add(value[i]);
|
||||
}
|
||||
Collections.addAll(list, value);
|
||||
mHeaderMap.put(field, list);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.provider.Telephony.Mms.Addr;
|
||||
import android.provider.Telephony.Mms.Part;
|
||||
import android.provider.Telephony.MmsSms;
|
||||
import android.provider.Telephony.MmsSms.PendingMessages;
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.TextUtils;
|
||||
@@ -694,9 +693,8 @@ public class PduPersister {
|
||||
|| (msgType == PduHeaders.MESSAGE_TYPE_SEND_REQ)) {
|
||||
final PduPart[] parts = loadParts(msgId);
|
||||
if (parts != null) {
|
||||
final int partsNum = parts.length;
|
||||
for (int i = 0; i < partsNum; i++) {
|
||||
body.addPart(parts[i]);
|
||||
for (PduPart part : parts) {
|
||||
body.addPart(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1223,7 +1221,7 @@ public class PduPersister {
|
||||
values.put(Mms.TEXT_ONLY, textOnly ? 1 : 0);
|
||||
values.put(Mms.SUBSCRIPTION_ID, subId);
|
||||
|
||||
Uri res = null;
|
||||
Uri res;
|
||||
if (existingUri) {
|
||||
res = uri;
|
||||
SqliteWrapper.update(mContext, mContentResolver, res, values, null, null);
|
||||
@@ -1279,10 +1277,7 @@ public class PduPersister {
|
||||
for (final EncodedStringValue v : array) {
|
||||
if (v != null) {
|
||||
final String number = v.getString();
|
||||
if (!recipients.contains(number)) {
|
||||
// Only add numbers which aren't already included.
|
||||
recipients.add(number);
|
||||
}
|
||||
recipients.add(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1325,10 +1320,7 @@ public class PduPersister {
|
||||
for (final String number : numbers) {
|
||||
// Only add numbers which aren't my own number.
|
||||
if (isSelfNumberUnavailable || !PhoneNumberUtils.compare(number, selfNumber)) {
|
||||
if (!recipients.contains(number)) {
|
||||
// Only add numbers which aren't already included.
|
||||
recipients.add(number);
|
||||
}
|
||||
recipients.add(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user