Messaging: Replace explicit types
Change-Id: I2165b3dec73973a2a82d8b3c7c364b5f011e597d
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Esmertec AG.
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -402,8 +403,8 @@ public class CharacterSets {
|
||||
|
||||
static {
|
||||
// Create the HashMaps.
|
||||
MIBENUM_TO_NAME_MAP = new SparseArray<String>();
|
||||
NAME_TO_MIBENUM_MAP = new SimpleArrayMap<String, Integer>();
|
||||
MIBENUM_TO_NAME_MAP = new SparseArray<>();
|
||||
NAME_TO_MIBENUM_MAP = new SimpleArrayMap<>();
|
||||
assert (MIBENUM_NUMBERS.length == MIME_NAMES.length);
|
||||
final int count = MIBENUM_NUMBERS.length - 1;
|
||||
for (int i = 0; i <= count; i++) {
|
||||
|
||||
@@ -245,7 +245,7 @@ public class EncodedStringValue implements Cloneable {
|
||||
public static EncodedStringValue[] extract(String src) {
|
||||
String[] values = src.split(";");
|
||||
|
||||
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
|
||||
ArrayList<EncodedStringValue> list = new ArrayList<>();
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (values[i].length() > 0) {
|
||||
list.add(new EncodedStringValue(values[i]));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Esmertec AG.
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,7 +27,7 @@ public class PduBody {
|
||||
* Constructor.
|
||||
*/
|
||||
public PduBody() {
|
||||
mParts = new Vector<PduPart>();
|
||||
mParts = new Vector<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008 Esmertec AG.
|
||||
* Copyright (C) 2007-2008 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -120,7 +121,7 @@ public class PduComposer {
|
||||
private static SimpleArrayMap<String, Integer> mContentTypeMap = null;
|
||||
|
||||
static {
|
||||
mContentTypeMap = new SimpleArrayMap<String, Integer>();
|
||||
mContentTypeMap = new SimpleArrayMap<>();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < PduContentTypes.contentTypes.length; i++) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Esmertec AG.
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -346,7 +347,7 @@ public class PduHeaders {
|
||||
* Constructor of PduHeaders.
|
||||
*/
|
||||
public PduHeaders() {
|
||||
mHeaderMap = new SparseArray<Object>();
|
||||
mHeaderMap = new SparseArray<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -652,7 +653,7 @@ public class PduHeaders {
|
||||
throw new RuntimeException("Invalid header field!");
|
||||
}
|
||||
|
||||
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
|
||||
ArrayList<EncodedStringValue> list = new ArrayList<>();
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
list.add(value[i]);
|
||||
}
|
||||
@@ -684,7 +685,7 @@ public class PduHeaders {
|
||||
ArrayList<EncodedStringValue> list =
|
||||
(ArrayList<EncodedStringValue>) mHeaderMap.get(field);
|
||||
if (null == list) {
|
||||
list = new ArrayList<EncodedStringValue>();
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
list.add(value);
|
||||
mHeaderMap.put(field, list);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008 Esmertec AG.
|
||||
* Copyright (C) 2007-2008 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -811,7 +812,7 @@ public class PduParser {
|
||||
}
|
||||
|
||||
case PduHeaders.CONTENT_TYPE: {
|
||||
SparseArray<Object> map = new SparseArray<Object>();
|
||||
SparseArray<Object> map = new SparseArray<>();
|
||||
byte[] contentType =
|
||||
parseContentType(pduDataStream, map);
|
||||
|
||||
@@ -882,7 +883,7 @@ public class PduParser {
|
||||
}
|
||||
|
||||
/* parse part's content-type */
|
||||
SparseArray<Object> map = new SparseArray<Object>();
|
||||
SparseArray<Object> map = new SparseArray<>();
|
||||
byte[] contentType = parseContentType(pduDataStream, map);
|
||||
if (null != contentType) {
|
||||
part.setContentType(contentType);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008 Esmertec AG.
|
||||
* Copyright (C) 2007-2008 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -123,7 +124,7 @@ public class PduPart {
|
||||
* Empty Constructor.
|
||||
*/
|
||||
public PduPart() {
|
||||
mPartHeader = new SparseArray<Object>();
|
||||
mPartHeader = new SparseArray<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -213,7 +213,7 @@ public class PduPersister {
|
||||
private static final SparseArray<String> LONG_COLUMN_NAME_MAP;
|
||||
|
||||
static {
|
||||
MESSAGE_BOX_MAP = new SimpleArrayMap<Uri, Integer>();
|
||||
MESSAGE_BOX_MAP = new SimpleArrayMap<>();
|
||||
MESSAGE_BOX_MAP.put(Mms.Inbox.CONTENT_URI, Mms.MESSAGE_BOX_INBOX);
|
||||
MESSAGE_BOX_MAP.put(Mms.Sent.CONTENT_URI, Mms.MESSAGE_BOX_SENT);
|
||||
MESSAGE_BOX_MAP.put(Mms.Draft.CONTENT_URI, Mms.MESSAGE_BOX_DRAFTS);
|
||||
@@ -223,7 +223,7 @@ public class PduPersister {
|
||||
CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT_CHARSET);
|
||||
CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT_CHARSET);
|
||||
|
||||
CHARSET_COLUMN_NAME_MAP = new SparseArray<String>();
|
||||
CHARSET_COLUMN_NAME_MAP = new SparseArray<>();
|
||||
CHARSET_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT_CHARSET);
|
||||
CHARSET_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT_CHARSET);
|
||||
|
||||
@@ -232,7 +232,7 @@ public class PduPersister {
|
||||
ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT);
|
||||
ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT);
|
||||
|
||||
ENCODED_STRING_COLUMN_NAME_MAP = new SparseArray<String>();
|
||||
ENCODED_STRING_COLUMN_NAME_MAP = new SparseArray<>();
|
||||
ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT);
|
||||
ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT);
|
||||
|
||||
@@ -245,7 +245,7 @@ public class PduPersister {
|
||||
TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RESPONSE_TEXT, PDU_COLUMN_RESPONSE_TEXT);
|
||||
TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.TRANSACTION_ID, PDU_COLUMN_TRANSACTION_ID);
|
||||
|
||||
TEXT_STRING_COLUMN_NAME_MAP = new SparseArray<String>();
|
||||
TEXT_STRING_COLUMN_NAME_MAP = new SparseArray<>();
|
||||
TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_LOCATION, Mms.CONTENT_LOCATION);
|
||||
TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_TYPE, Mms.CONTENT_TYPE);
|
||||
TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_CLASS, Mms.MESSAGE_CLASS);
|
||||
@@ -266,7 +266,7 @@ public class PduPersister {
|
||||
OCTET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_STATUS, PDU_COLUMN_RETRIEVE_STATUS);
|
||||
OCTET_COLUMN_INDEX_MAP.put(PduHeaders.STATUS, PDU_COLUMN_STATUS);
|
||||
|
||||
OCTET_COLUMN_NAME_MAP = new SparseArray<String>();
|
||||
OCTET_COLUMN_NAME_MAP = new SparseArray<>();
|
||||
OCTET_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_CLASS, Mms.CONTENT_CLASS);
|
||||
OCTET_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_REPORT, Mms.DELIVERY_REPORT);
|
||||
OCTET_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_TYPE, Mms.MESSAGE_TYPE);
|
||||
@@ -285,7 +285,7 @@ public class PduPersister {
|
||||
LONG_COLUMN_INDEX_MAP.put(PduHeaders.EXPIRY, PDU_COLUMN_EXPIRY);
|
||||
LONG_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_SIZE, PDU_COLUMN_MESSAGE_SIZE);
|
||||
|
||||
LONG_COLUMN_NAME_MAP = new SparseArray<String>();
|
||||
LONG_COLUMN_NAME_MAP = new SparseArray<>();
|
||||
LONG_COLUMN_NAME_MAP.put(PduHeaders.DATE, Mms.DATE);
|
||||
LONG_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_TIME, Mms.DELIVERY_TIME);
|
||||
LONG_COLUMN_NAME_MAP.put(PduHeaders.EXPIRY, Mms.EXPIRY);
|
||||
@@ -1135,7 +1135,7 @@ public class PduPersister {
|
||||
}
|
||||
|
||||
final PduHeaders headers = sendReq.getPduHeaders();
|
||||
final HashSet<String> recipients = new HashSet<String>();
|
||||
final HashSet<String> recipients = new HashSet<>();
|
||||
for (final int addrType : ADDRESS_FIELDS) {
|
||||
EncodedStringValue[] array = null;
|
||||
if (addrType == PduHeaders.FROM) {
|
||||
@@ -1233,8 +1233,8 @@ public class PduPersister {
|
||||
PDU_CACHE_INSTANCE.setUpdating(uri, true);
|
||||
}
|
||||
|
||||
final ArrayList<PduPart> toBeCreated = new ArrayList<PduPart>();
|
||||
final ArrayMap<Uri, PduPart> toBeUpdated = new ArrayMap<Uri, PduPart>();
|
||||
final ArrayList<PduPart> toBeCreated = new ArrayList<>();
|
||||
final ArrayMap<Uri, PduPart> toBeUpdated = new ArrayMap<>();
|
||||
|
||||
final int partsNum = body.getPartsNum();
|
||||
final StringBuilder filter = new StringBuilder().append('(');
|
||||
@@ -1376,7 +1376,7 @@ public class PduPersister {
|
||||
}
|
||||
|
||||
final SparseArray<EncodedStringValue[]> addressMap =
|
||||
new SparseArray<EncodedStringValue[]>(ADDRESS_FIELDS.length);
|
||||
new SparseArray<>(ADDRESS_FIELDS.length);
|
||||
// Save address information.
|
||||
for (final int addrType : ADDRESS_FIELDS) {
|
||||
EncodedStringValue[] array = null;
|
||||
@@ -1392,7 +1392,7 @@ public class PduPersister {
|
||||
addressMap.put(addrType, array);
|
||||
}
|
||||
|
||||
final HashSet<String> recipients = new HashSet<String>();
|
||||
final HashSet<String> recipients = new HashSet<>();
|
||||
final int msgType = pdu.getMessageType();
|
||||
// Here we only allocate thread ID for M-Notification.ind,
|
||||
// M-Retrieve.conf and M-Send.req.
|
||||
@@ -1553,7 +1553,7 @@ public class PduPersister {
|
||||
final SparseArray<EncodedStringValue[]> addressMap, final String selfNumber) {
|
||||
final EncodedStringValue[] arrayTo = addressMap.get(PduHeaders.TO);
|
||||
final EncodedStringValue[] arrayCc = addressMap.get(PduHeaders.CC);
|
||||
final ArrayList<String> numbers = new ArrayList<String>();
|
||||
final ArrayList<String> numbers = new ArrayList<>();
|
||||
if (arrayTo != null) {
|
||||
for (final EncodedStringValue v : arrayTo) {
|
||||
if (v != null) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Esmertec AG.
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +30,7 @@ public abstract class AbstractCache<K, V> {
|
||||
private final SimpleArrayMap<K, CacheEntry<V>> mCacheMap;
|
||||
|
||||
protected AbstractCache() {
|
||||
mCacheMap = new SimpleArrayMap<K, CacheEntry<V>>();
|
||||
mCacheMap = new SimpleArrayMap<>();
|
||||
}
|
||||
|
||||
public boolean put(K key, V value) {
|
||||
@@ -47,7 +48,7 @@ public abstract class AbstractCache<K, V> {
|
||||
}
|
||||
|
||||
if (key != null) {
|
||||
CacheEntry<V> cacheEntry = new CacheEntry<V>();
|
||||
CacheEntry<V> cacheEntry = new CacheEntry<>();
|
||||
cacheEntry.value = value;
|
||||
mCacheMap.put(key, cacheEntry);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
|
||||
URI_MATCHER.addURI("mms-sms", "conversations", MMS_CONVERSATION);
|
||||
URI_MATCHER.addURI("mms-sms", "conversations/#", MMS_CONVERSATION_ID);
|
||||
|
||||
MATCH_TO_MSGBOX_ID_MAP = new SparseArray<Integer>();
|
||||
MATCH_TO_MSGBOX_ID_MAP = new SparseArray<>();
|
||||
MATCH_TO_MSGBOX_ID_MAP.put(MMS_INBOX, Mms.MESSAGE_BOX_INBOX);
|
||||
MATCH_TO_MSGBOX_ID_MAP.put(MMS_SENT, Mms.MESSAGE_BOX_SENT);
|
||||
MATCH_TO_MSGBOX_ID_MAP.put(MMS_DRAFTS, Mms.MESSAGE_BOX_DRAFTS);
|
||||
@@ -77,9 +77,9 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
|
||||
private final HashSet<Uri> mUpdating;
|
||||
|
||||
private PduCache() {
|
||||
mMessageBoxes = new SparseArray<HashSet<Uri>>();
|
||||
mThreads = new SimpleArrayMap<Long, HashSet<Uri>>();
|
||||
mUpdating = new HashSet<Uri>();
|
||||
mMessageBoxes = new SparseArray<>();
|
||||
mThreads = new SimpleArrayMap<>();
|
||||
mUpdating = new HashSet<>();
|
||||
}
|
||||
|
||||
public static synchronized PduCache getInstance() {
|
||||
@@ -97,14 +97,14 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
|
||||
int msgBoxId = entry.getMessageBox();
|
||||
HashSet<Uri> msgBox = mMessageBoxes.get(msgBoxId);
|
||||
if (msgBox == null) {
|
||||
msgBox = new HashSet<Uri>();
|
||||
msgBox = new HashSet<>();
|
||||
mMessageBoxes.put(msgBoxId, msgBox);
|
||||
}
|
||||
|
||||
long threadId = entry.getThreadId();
|
||||
HashSet<Uri> thread = mThreads.get(threadId);
|
||||
if (thread == null) {
|
||||
thread = new HashSet<Uri>();
|
||||
thread = new HashSet<>();
|
||||
mThreads.put(threadId, thread);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user