Messaging: Replace explicit types
Change-Id: I2165b3dec73973a2a82d8b3c7c364b5f011e597d
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -87,7 +88,7 @@ public class BitmapPool implements MemoryCache {
|
||||
Assert.isTrue(!TextUtils.isEmpty(name));
|
||||
mPoolName = name;
|
||||
mMaxSize = maxSize;
|
||||
mPool = new SparseArray<SingleSizePool>();
|
||||
mPool = new SparseArray<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,7 +67,7 @@ public class BugleDatabaseOperations {
|
||||
|
||||
// Global cache of phone numbers -> participant id mapping since this call is expensive.
|
||||
private static final ArrayMap<String, String> sNormalizedPhoneNumberToParticipantIdCache =
|
||||
new ArrayMap<String, String>();
|
||||
new ArrayMap<>();
|
||||
|
||||
/**
|
||||
* Convert list of recipient strings (email/phone number) into list of ConversationParticipants
|
||||
@@ -78,8 +78,7 @@ public class BugleDatabaseOperations {
|
||||
static ArrayList<ParticipantData> getConversationParticipantsFromRecipients(
|
||||
final List<String> recipients, final int refSubId) {
|
||||
// Generate a list of partially formed participants
|
||||
final ArrayList<ParticipantData> participants = new
|
||||
ArrayList<ParticipantData>();
|
||||
final ArrayList<ParticipantData> participants = new ArrayList<>();
|
||||
|
||||
if (recipients != null) {
|
||||
for (final String recipient : recipients) {
|
||||
@@ -98,7 +97,7 @@ public class BugleDatabaseOperations {
|
||||
Assert.isNotMainThread();
|
||||
if (participants.size() > 0) {
|
||||
// First remove redundant phone numbers
|
||||
final HashSet<String> recipients = new HashSet<String>();
|
||||
final HashSet<String> recipients = new HashSet<>();
|
||||
for (int i = participants.size() - 1; i >= 0; i--) {
|
||||
final String recipient = participants.get(i).getNormalizedDestination();
|
||||
if (!recipients.contains(recipient)) {
|
||||
@@ -141,7 +140,7 @@ public class BugleDatabaseOperations {
|
||||
final List<ParticipantData> participants) {
|
||||
Assert.isNotMainThread();
|
||||
// First find the thread id for this list of participants.
|
||||
final ArrayList<String> recipients = new ArrayList<String>();
|
||||
final ArrayList<String> recipients = new ArrayList<>();
|
||||
|
||||
for (final ParticipantData participant : participants) {
|
||||
recipients.add(participant.getSendDestination());
|
||||
@@ -854,7 +853,7 @@ public class BugleDatabaseOperations {
|
||||
final ArrayList<ParticipantData> participants =
|
||||
getParticipantsForConversation(dbWrapper, conversationId);
|
||||
|
||||
final ArrayList<String> recipients = new ArrayList<String>();
|
||||
final ArrayList<String> recipients = new ArrayList<>();
|
||||
for (final ParticipantData participant : participants) {
|
||||
recipients.add(participant.getSendDestination());
|
||||
}
|
||||
@@ -913,8 +912,7 @@ public class BugleDatabaseOperations {
|
||||
public static ArrayList<ParticipantData> getParticipantsForConversation(
|
||||
final DatabaseWrapper dbWrapper, final String conversationId) {
|
||||
Assert.isNotMainThread();
|
||||
final ArrayList<ParticipantData> participants =
|
||||
new ArrayList<ParticipantData>();
|
||||
final ArrayList<ParticipantData> participants = new ArrayList<>();
|
||||
try (Cursor cursor = dbWrapper.query(DatabaseHelper.PARTICIPANTS_TABLE,
|
||||
ParticipantData.ParticipantsQuery.PROJECTION,
|
||||
ParticipantColumns._ID + " IN ( " + "SELECT "
|
||||
@@ -1684,7 +1682,7 @@ public class BugleDatabaseOperations {
|
||||
private static HashSet<String> getConversationsForParticipants(
|
||||
final ArrayList<String> participantIds) {
|
||||
final DatabaseWrapper db = DataModel.get().getDatabase();
|
||||
final HashSet<String> conversationIds = new HashSet<String>();
|
||||
final HashSet<String> conversationIds = new HashSet<>();
|
||||
|
||||
final String selection = ConversationParticipantsColumns.PARTICIPANT_ID + "=?";
|
||||
for (final String participantId : participantIds) {
|
||||
@@ -1734,7 +1732,7 @@ public class BugleDatabaseOperations {
|
||||
@DoesNotRunOnMainThread
|
||||
public static void refreshConversationsForParticipant(final String participantId) {
|
||||
Assert.isNotMainThread();
|
||||
final ArrayList<String> participantList = new ArrayList<String>(1);
|
||||
final ArrayList<String> participantList = new ArrayList<>(1);
|
||||
participantList.add(participantId);
|
||||
refreshConversationsForParticipants(participantList);
|
||||
}
|
||||
@@ -1764,7 +1762,7 @@ public class BugleDatabaseOperations {
|
||||
final String rowKey, final String rowId, final ContentValues values) {
|
||||
Assert.isNotMainThread();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final ArrayList<String> whereValues = new ArrayList<String>(values.size() + 1);
|
||||
final ArrayList<String> whereValues = new ArrayList<>(values.size() + 1);
|
||||
whereValues.add(rowId);
|
||||
|
||||
for (final String key : values.keySet()) {
|
||||
|
||||
@@ -119,8 +119,7 @@ public class BugleNotifications {
|
||||
|
||||
private static final String WEARABLE_COMPANION_APP_PACKAGE = "com.google.android.wearable.app";
|
||||
|
||||
private static final Set<NotificationState> sPendingNotifications =
|
||||
new HashSet<NotificationState>();
|
||||
private static final Set<NotificationState> sPendingNotifications = new HashSet<>();
|
||||
|
||||
private static int sWearableImageWidth;
|
||||
private static int sWearableImageHeight;
|
||||
@@ -134,8 +133,7 @@ public class BugleNotifications {
|
||||
// sLastMessageDingTime is a map between a conversation id and a time. It's used to keep track
|
||||
// of the time we last dinged a message for this conversation. When messages are coming in
|
||||
// at flurry, we don't want to over-ding the user.
|
||||
private static final SimpleArrayMap<String, Long> sLastMessageDingTime =
|
||||
new SimpleArrayMap<String, Long>();
|
||||
private static final SimpleArrayMap<String, Long> sLastMessageDingTime = new SimpleArrayMap<>();
|
||||
private static int sTimeBetweenDingsMs;
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DatabaseWrapper {
|
||||
|
||||
// track transaction on a per thread basis
|
||||
private static final ThreadLocal<Stack<TransactionData>> sTransactionDepth =
|
||||
ThreadLocal.withInitial(() -> new Stack<TransactionData>());
|
||||
ThreadLocal.withInitial(() -> new Stack<>());
|
||||
|
||||
private static final String[] sFormatStrings = new String[] {
|
||||
"took %d ms to %s",
|
||||
@@ -69,7 +69,7 @@ public class DatabaseWrapper {
|
||||
mLog = LogUtil.isLoggable(LogUtil.BUGLE_DATABASE_PERF_TAG, LogUtil.VERBOSE);
|
||||
mDatabase = db;
|
||||
mContext = context;
|
||||
mCompiledStatements = new SparseArray<SQLiteStatement>();
|
||||
mCompiledStatements = new SparseArray<>();
|
||||
}
|
||||
|
||||
public SQLiteStatement getStatementInTransaction(final int index, final String statement) {
|
||||
|
||||
@@ -86,8 +86,7 @@ public class FrequentContactsCursorBuilder {
|
||||
|
||||
// First, go through the frequents cursor and take note of all lookup keys and their
|
||||
// corresponding rank in the frequents list.
|
||||
final SimpleArrayMap<String, Integer> lookupKeyToRankMap =
|
||||
new SimpleArrayMap<String, Integer>();
|
||||
final SimpleArrayMap<String, Integer> lookupKeyToRankMap = new SimpleArrayMap<>();
|
||||
int oldPosition = mFrequentContactsCursor.getPosition();
|
||||
int rank = 0;
|
||||
mFrequentContactsCursor.moveToPosition(-1);
|
||||
@@ -102,8 +101,7 @@ public class FrequentContactsCursorBuilder {
|
||||
// (multiple phone numbers etc.) and store that in an array list. Since the all
|
||||
// contacts list only contains phone contacts, this step will ensure that we filter
|
||||
// out any invalid/email contacts in the frequents list.
|
||||
final ArrayList<Object[]> rows =
|
||||
new ArrayList<Object[]>(mFrequentContactsCursor.getCount());
|
||||
final ArrayList<Object[]> rows = new ArrayList<>(mFrequentContactsCursor.getCount());
|
||||
oldPosition = mAllContactsCursor.getPosition();
|
||||
mAllContactsCursor.moveToPosition(-1);
|
||||
while (mAllContactsCursor.moveToNext()) {
|
||||
|
||||
@@ -44,8 +44,7 @@ import java.util.List;
|
||||
public class MediaScratchFileProvider extends FileProvider {
|
||||
private static final String TAG = LogUtil.BUGLE_TAG;
|
||||
|
||||
private static final SimpleArrayMap<Uri, String> sUriToDisplayNameMap =
|
||||
new SimpleArrayMap<Uri, String>();
|
||||
private static final SimpleArrayMap<Uri, String> sUriToDisplayNameMap = new SimpleArrayMap<>();
|
||||
|
||||
@VisibleForTesting
|
||||
public static final String AUTHORITY =
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -25,7 +26,7 @@ import java.util.HashSet;
|
||||
* is memory pressure provide a callback to reclaim the memory in the caches.
|
||||
*/
|
||||
public class MemoryCacheManager {
|
||||
private final HashSet<MemoryCache> mMemoryCaches = new HashSet<MemoryCache>();
|
||||
private final HashSet<MemoryCache> mMemoryCaches = new HashSet<>();
|
||||
private final Object mMemoryCacheLock = new Object();
|
||||
|
||||
public static MemoryCacheManager get() {
|
||||
|
||||
@@ -226,7 +226,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
mIncludeEmailAddress = includeEmailAddress;
|
||||
mReceivedTimestamp = receivedTimestamp;
|
||||
mSelfParticipantId = selfParticipantId;
|
||||
mLineInfos = new ArrayList<NotificationLineInfo>();
|
||||
mLineInfos = new ArrayList<>();
|
||||
mTotalMessageCount = 0;
|
||||
mAvatarUri = avatarUri;
|
||||
mContactUri = contactUri;
|
||||
@@ -340,8 +340,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
*/
|
||||
public static class MultiConversationNotificationState extends MessageNotificationState {
|
||||
|
||||
public final List<MessageNotificationState>
|
||||
mChildren = new ArrayList<MessageNotificationState>();
|
||||
public final List<MessageNotificationState> mChildren = new ArrayList<>();
|
||||
|
||||
public MultiConversationNotificationState(
|
||||
final ConversationInfoList convList, final MessageNotificationState state) {
|
||||
@@ -618,7 +617,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
|
||||
final Iterator<ParticipantData> iter = participantsData.iterator();
|
||||
|
||||
final HashMap<String, Integer> firstNames = new HashMap<String, Integer>();
|
||||
final HashMap<String, Integer> firstNames = new HashMap<>();
|
||||
boolean seenSelf = false;
|
||||
while (iter.hasNext()) {
|
||||
final ParticipantData participant = iter.next();
|
||||
@@ -1040,13 +1039,13 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
// For now, only show avatars for notifications for a single conversation.
|
||||
if (convInfo.mAvatarUri != null) {
|
||||
if (state.mParticipantAvatarsUris == null) {
|
||||
state.mParticipantAvatarsUris = new ArrayList<Uri>(1);
|
||||
state.mParticipantAvatarsUris = new ArrayList<>(1);
|
||||
}
|
||||
state.mParticipantAvatarsUris.add(convInfo.mAvatarUri);
|
||||
}
|
||||
if (convInfo.mContactUri != null) {
|
||||
if (state.mParticipantContactUris == null) {
|
||||
state.mParticipantContactUris = new ArrayList<Uri>(1);
|
||||
state.mParticipantContactUris = new ArrayList<>(1);
|
||||
}
|
||||
state.mParticipantContactUris.add(convInfo.mContactUri);
|
||||
}
|
||||
@@ -1160,11 +1159,11 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
if (messageDataCursor != null) {
|
||||
final MessageData messageData = new MessageData();
|
||||
|
||||
final HashSet<String> conversationsWithFailedMessages = new HashSet<String>();
|
||||
final HashSet<String> conversationsWithFailedMessages = new HashSet<>();
|
||||
|
||||
// track row ids in case we want to display something that requires this
|
||||
// information
|
||||
final ArrayList<Integer> failedMessages = new ArrayList<Integer>();
|
||||
final ArrayList<Integer> failedMessages = new ArrayList<>();
|
||||
|
||||
int cursorPosition = -1;
|
||||
final long when = 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ public abstract class NotificationState {
|
||||
|
||||
NotificationState(final ConversationIdSet conversationIds) {
|
||||
mConversationIds = conversationIds;
|
||||
mPeople = new HashSet<String>();
|
||||
mPeople = new HashSet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -234,7 +234,7 @@ public class ParticipantRefresh {
|
||||
refreshSelfParticipantList();
|
||||
}
|
||||
|
||||
final ArrayList<String> changedParticipants = new ArrayList<String>();
|
||||
final ArrayList<String> changedParticipants = new ArrayList<>();
|
||||
|
||||
String selection = null;
|
||||
String[] selectionArgs = null;
|
||||
@@ -306,7 +306,7 @@ public class ParticipantRefresh {
|
||||
|
||||
private static Set<Integer> getExistingSubIds() {
|
||||
final DatabaseWrapper db = DataModel.get().getDatabase();
|
||||
final HashSet<Integer> existingSubIds = new HashSet<Integer>();
|
||||
final HashSet<Integer> existingSubIds = new HashSet<>();
|
||||
|
||||
try (Cursor cursor = db.query(DatabaseHelper.PARTICIPANTS_TABLE,
|
||||
ParticipantsQuery.PROJECTION,
|
||||
@@ -346,7 +346,7 @@ public class ParticipantRefresh {
|
||||
final List<SubscriptionInfo> subInfoRecords =
|
||||
PhoneUtils.getDefault().getActiveSubscriptionInfoList();
|
||||
final ArrayMap<Integer, SubscriptionInfo> activeSubscriptionIdToRecordMap =
|
||||
new ArrayMap<Integer, SubscriptionInfo>();
|
||||
new ArrayMap<>();
|
||||
db.beginTransaction();
|
||||
final Set<Integer> existingSubIds = getExistingSubIds();
|
||||
|
||||
@@ -603,7 +603,7 @@ public class ParticipantRefresh {
|
||||
*/
|
||||
private static List<String> getInactiveSelfParticipantIds() {
|
||||
final DatabaseWrapper db = DataModel.get().getDatabase();
|
||||
final List<String> inactiveSelf = new ArrayList<String>();
|
||||
final List<String> inactiveSelf = new ArrayList<>();
|
||||
|
||||
final String selection = ParticipantColumns.SIM_SLOT_ID + "=? AND " +
|
||||
SELF_PARTICIPANTS_CLAUSE;
|
||||
@@ -628,7 +628,7 @@ public class ParticipantRefresh {
|
||||
*/
|
||||
private static List<String> getConversationsWithSelfParticipantIds(final List<String> selfIds) {
|
||||
final DatabaseWrapper db = DataModel.get().getDatabase();
|
||||
final List<String> conversationIds = new ArrayList<String>();
|
||||
final List<String> conversationIds = new ArrayList<>();
|
||||
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
|
||||
@@ -365,12 +365,10 @@ public class SyncManager {
|
||||
|
||||
public static class ThreadInfoCache {
|
||||
// Cache of thread->conversationId map
|
||||
private final LongSparseArray<String> mThreadToConversationId =
|
||||
new LongSparseArray<String>();
|
||||
private final LongSparseArray<String> mThreadToConversationId = new LongSparseArray<>();
|
||||
|
||||
// Cache of thread->recipients map
|
||||
private final LongSparseArray<List<String>> mThreadToRecipients =
|
||||
new LongSparseArray<List<String>>();
|
||||
private final LongSparseArray<List<String>> mThreadToRecipients = new LongSparseArray<>();
|
||||
|
||||
// Remember the conversation ids that need to be archived
|
||||
private final HashSet<String> mArchivedConversations = new HashSet<>();
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class Action implements Parcelable {
|
||||
protected final Bundle actionParameters;
|
||||
|
||||
// This does not get written to the parcel
|
||||
private final List<Action> mBackgroundActions = new LinkedList<Action>();
|
||||
private final List<Action> mBackgroundActions = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* Process the action locally - runs on action service thread.
|
||||
|
||||
@@ -413,8 +413,7 @@ public class ActionMonitor {
|
||||
* Map of action monitors indexed by actionKey
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static final SimpleArrayMap<String, ActionMonitor> sActionMonitors =
|
||||
new SimpleArrayMap<String, ActionMonitor>();
|
||||
static final SimpleArrayMap<String, ActionMonitor> sActionMonitors = new SimpleArrayMap<>();
|
||||
|
||||
/**
|
||||
* Insert new monitor into map
|
||||
|
||||
@@ -188,7 +188,7 @@ public class DeleteConversationAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DeleteConversationAction> CREATOR
|
||||
= new Parcelable.Creator<DeleteConversationAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public DeleteConversationAction createFromParcel(final Parcel in) {
|
||||
return new DeleteConversationAction(in);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class DeleteMessageAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DeleteMessageAction> CREATOR
|
||||
= new Parcelable.Creator<DeleteMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public DeleteMessageAction createFromParcel(final Parcel in) {
|
||||
return new DeleteMessageAction(in);
|
||||
|
||||
@@ -327,8 +327,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DownloadMmsAction> CREATOR
|
||||
= new Parcelable.Creator<DownloadMmsAction>() {
|
||||
public static final Parcelable.Creator<DownloadMmsAction> CREATOR = new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public DownloadMmsAction createFromParcel(final Parcel in) {
|
||||
return new DownloadMmsAction(in);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class FixupMessageStatusOnStartupAction extends Action implements Parcela
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<FixupMessageStatusOnStartupAction> CREATOR
|
||||
= new Parcelable.Creator<FixupMessageStatusOnStartupAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public FixupMessageStatusOnStartupAction createFromParcel(final Parcel in) {
|
||||
return new FixupMessageStatusOnStartupAction(in);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class GetOrCreateConversationAction extends Action implements Parcelable
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<GetOrCreateConversationAction> CREATOR
|
||||
= new Parcelable.Creator<GetOrCreateConversationAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public GetOrCreateConversationAction createFromParcel(final Parcel in) {
|
||||
return new GetOrCreateConversationAction(in);
|
||||
|
||||
@@ -463,7 +463,7 @@ public class InsertNewMessageAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<InsertNewMessageAction> CREATOR
|
||||
= new Parcelable.Creator<InsertNewMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public InsertNewMessageAction createFromParcel(final Parcel in) {
|
||||
return new InsertNewMessageAction(in);
|
||||
|
||||
@@ -96,8 +96,7 @@ public class MarkAsReadAction extends Action implements Parcelable {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<MarkAsReadAction> CREATOR
|
||||
= new Parcelable.Creator<MarkAsReadAction>() {
|
||||
public static final Parcelable.Creator<MarkAsReadAction> CREATOR = new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public MarkAsReadAction createFromParcel(final Parcel in) {
|
||||
return new MarkAsReadAction(in);
|
||||
|
||||
@@ -109,8 +109,7 @@ public class MarkAsSeenAction extends Action implements Parcelable {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<MarkAsSeenAction> CREATOR
|
||||
= new Parcelable.Creator<MarkAsSeenAction>() {
|
||||
public static final Parcelable.Creator<MarkAsSeenAction> CREATOR = new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public MarkAsSeenAction createFromParcel(final Parcel in) {
|
||||
return new MarkAsSeenAction(in);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ProcessDeliveryReportAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ProcessDeliveryReportAction> CREATOR
|
||||
= new Parcelable.Creator<ProcessDeliveryReportAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ProcessDeliveryReportAction createFromParcel(final Parcel in) {
|
||||
return new ProcessDeliveryReportAction(in);
|
||||
|
||||
@@ -565,7 +565,7 @@ public class ProcessDownloadedMmsAction extends Action {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ProcessDownloadedMmsAction> CREATOR
|
||||
= new Parcelable.Creator<ProcessDownloadedMmsAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ProcessDownloadedMmsAction createFromParcel(final Parcel in) {
|
||||
return new ProcessDownloadedMmsAction(in);
|
||||
|
||||
@@ -457,7 +457,7 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ProcessPendingMessagesAction> CREATOR
|
||||
= new Parcelable.Creator<ProcessPendingMessagesAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ProcessPendingMessagesAction createFromParcel(final Parcel in) {
|
||||
return new ProcessPendingMessagesAction(in);
|
||||
|
||||
@@ -296,7 +296,7 @@ public class ProcessSentMessageAction extends Action {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ProcessSentMessageAction> CREATOR
|
||||
= new Parcelable.Creator<ProcessSentMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ProcessSentMessageAction createFromParcel(final Parcel in) {
|
||||
return new ProcessSentMessageAction(in);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class ReadDraftDataAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ReadDraftDataAction> CREATOR
|
||||
= new Parcelable.Creator<ReadDraftDataAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ReadDraftDataAction createFromParcel(final Parcel in) {
|
||||
return new ReadDraftDataAction(in);
|
||||
|
||||
@@ -181,7 +181,7 @@ public class ReceiveMmsMessageAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ReceiveMmsMessageAction> CREATOR
|
||||
= new Parcelable.Creator<ReceiveMmsMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ReceiveMmsMessageAction createFromParcel(final Parcel in) {
|
||||
return new ReceiveMmsMessageAction(in);
|
||||
|
||||
@@ -184,7 +184,7 @@ public class ReceiveSmsMessageAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ReceiveSmsMessageAction> CREATOR
|
||||
= new Parcelable.Creator<ReceiveSmsMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ReceiveSmsMessageAction createFromParcel(final Parcel in) {
|
||||
return new ReceiveSmsMessageAction(in);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class RedownloadMmsAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<RedownloadMmsAction> CREATOR
|
||||
= new Parcelable.Creator<RedownloadMmsAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public RedownloadMmsAction createFromParcel(final Parcel in) {
|
||||
return new RedownloadMmsAction(in);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ResendMessageAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ResendMessageAction> CREATOR
|
||||
= new Parcelable.Creator<ResendMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ResendMessageAction createFromParcel(final Parcel in) {
|
||||
return new ResendMessageAction(in);
|
||||
|
||||
@@ -435,8 +435,7 @@ public class SendMessageAction extends Action implements Parcelable {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SendMessageAction> CREATOR
|
||||
= new Parcelable.Creator<SendMessageAction>() {
|
||||
public static final Parcelable.Creator<SendMessageAction> CREATOR = new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public SendMessageAction createFromParcel(final Parcel in) {
|
||||
return new SendMessageAction(in);
|
||||
|
||||
@@ -73,7 +73,7 @@ class SyncMessageBatch {
|
||||
mMmsToAdd = mmsToAdd;
|
||||
mMessagesToDelete = messagesToDelete;
|
||||
mCache = cache;
|
||||
mConversationsToUpdate = new HashSet<String>();
|
||||
mConversationsToUpdate = new HashSet<>();
|
||||
}
|
||||
|
||||
void updateLocalDatabase() {
|
||||
|
||||
@@ -221,12 +221,11 @@ public class SyncMessagesAction extends Action implements Parcelable {
|
||||
cache.clear();
|
||||
|
||||
// Sms messages to store
|
||||
final ArrayList<SmsMessage> smsToAdd = new ArrayList<SmsMessage>();
|
||||
final ArrayList<SmsMessage> smsToAdd = new ArrayList<>();
|
||||
// Mms messages to store
|
||||
final LongSparseArray<MmsMessage> mmsToAdd = new LongSparseArray<MmsMessage>();
|
||||
final LongSparseArray<MmsMessage> mmsToAdd = new LongSparseArray<>();
|
||||
// List of local SMS/MMS to remove
|
||||
final ArrayList<LocalDatabaseMessage> messagesToDelete =
|
||||
new ArrayList<LocalDatabaseMessage>();
|
||||
final ArrayList<LocalDatabaseMessage> messagesToDelete = new ArrayList<>();
|
||||
|
||||
long lastTimestampMillis = SYNC_FAILED;
|
||||
if (syncManager.isSyncing(upperBoundTimeMillis)) {
|
||||
@@ -242,7 +241,7 @@ public class SyncMessagesAction extends Action implements Parcelable {
|
||||
|
||||
// If comparison succeeds bundle up the changes for processing in ActionService
|
||||
if (lastTimestampMillis > SYNC_FAILED) {
|
||||
final ArrayList<MmsMessage> mmsToAddList = new ArrayList<MmsMessage>();
|
||||
final ArrayList<MmsMessage> mmsToAddList = new ArrayList<>();
|
||||
for (int i = 0; i < mmsToAdd.size(); i++) {
|
||||
final MmsMessage mms = mmsToAdd.valueAt(i);
|
||||
mmsToAddList.add(mms);
|
||||
@@ -610,7 +609,7 @@ public class SyncMessagesAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SyncMessagesAction> CREATOR
|
||||
= new Parcelable.Creator<SyncMessagesAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public SyncMessagesAction createFromParcel(final Parcel in) {
|
||||
return new SyncMessagesAction(in);
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ public class UpdateConversationArchiveStatusAction extends Action {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<UpdateConversationArchiveStatusAction> CREATOR
|
||||
= new Parcelable.Creator<UpdateConversationArchiveStatusAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public UpdateConversationArchiveStatusAction createFromParcel(final Parcel in) {
|
||||
return new UpdateConversationArchiveStatusAction(in);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class UpdateDestinationBlockedAction extends Action {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<UpdateDestinationBlockedAction> CREATOR
|
||||
= new Parcelable.Creator<UpdateDestinationBlockedAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public UpdateDestinationBlockedAction createFromParcel(final Parcel in) {
|
||||
return new UpdateDestinationBlockedAction(in);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class UpdateMessageNotificationAction extends Action {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<UpdateMessageNotificationAction> CREATOR
|
||||
= new Parcelable.Creator<UpdateMessageNotificationAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public UpdateMessageNotificationAction createFromParcel(final Parcel in) {
|
||||
return new UpdateMessageNotificationAction(in);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class UpdateMessagePartSizeAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<UpdateMessagePartSizeAction> CREATOR
|
||||
= new Parcelable.Creator<UpdateMessagePartSizeAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public UpdateMessagePartSizeAction createFromParcel(final Parcel in) {
|
||||
return new UpdateMessagePartSizeAction(in);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class WriteDraftMessageAction extends Action implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<WriteDraftMessageAction> CREATOR
|
||||
= new Parcelable.Creator<WriteDraftMessageAction>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public WriteDraftMessageAction createFromParcel(final Parcel in) {
|
||||
return new WriteDraftMessageAction(in);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -33,7 +34,7 @@ public abstract class BindingBase<T extends BindableData> {
|
||||
* Creates a new exclusively owned binding for the owner object.
|
||||
*/
|
||||
public static <T extends BindableData> Binding<T> createBinding(final Object owner) {
|
||||
return new Binding<T>(owner);
|
||||
return new Binding<>(owner);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ public abstract class BindingBase<T extends BindableData> {
|
||||
*/
|
||||
public static <T extends BindableData> ImmutableBindingRef<T> createBindingReference(
|
||||
final BindingBase<T> srcBinding) {
|
||||
return new ImmutableBindingRef<T>(srcBinding);
|
||||
return new ImmutableBindingRef<>(srcBinding);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +53,7 @@ public abstract class BindingBase<T extends BindableData> {
|
||||
*/
|
||||
public static <T extends BindableData> DetachableBinding<T> createDetachableBinding(
|
||||
final Object owner) {
|
||||
return new DetachableBinding<T>(owner);
|
||||
return new DetachableBinding<>(owner);
|
||||
}
|
||||
|
||||
public abstract T getData();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ConversationData extends BindableData {
|
||||
* for each message.
|
||||
*/
|
||||
public List<Integer> getPositions(final String conversationId, final List<Long> ids) {
|
||||
final ArrayList<Integer> result = new ArrayList<Integer>();
|
||||
final ArrayList<Integer> result = new ArrayList<>();
|
||||
|
||||
if (ids.isEmpty()) {
|
||||
return result;
|
||||
@@ -84,7 +84,7 @@ public class ConversationData extends BindableData {
|
||||
new String [] { conversationId }));
|
||||
if (c != null) {
|
||||
try {
|
||||
final Set<Long> idsSet = new HashSet<Long>(ids);
|
||||
final Set<Long> idsSet = new HashSet<>(ids);
|
||||
if (c.moveToLast()) {
|
||||
do {
|
||||
final long messageId = c.getLong(0);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ConversationListData extends BindableData
|
||||
private static final int INDEX_BLOCKED_PARTICIPANTS_NORMALIZED_DESTINATION = 1;
|
||||
|
||||
// all blocked participants
|
||||
private final HashSet<String> mBlockedParticipants = new HashSet<String>();
|
||||
private final HashSet<String> mBlockedParticipants = new HashSet<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
||||
@@ -489,7 +489,7 @@ public class ConversationListItemData {
|
||||
return participants.get(0).getDisplayName(true);
|
||||
}
|
||||
|
||||
final ArrayList<String> participantNames = new ArrayList<String>();
|
||||
final ArrayList<String> participantNames = new ArrayList<>();
|
||||
for (final ParticipantData participant : participants) {
|
||||
// Prefer first name over full name for group conversation
|
||||
participantNames.add(participant.getDisplayName(false));
|
||||
|
||||
@@ -163,7 +163,7 @@ public class ConversationMessageData {
|
||||
|
||||
// statics to avoid unnecessary object allocation
|
||||
private static final StringBuilder sUnquoteStringBuilder = new StringBuilder();
|
||||
private static final ArrayList<String> sUnquoteResults = new ArrayList<String>();
|
||||
private static final ArrayList<String> sUnquoteResults = new ArrayList<>();
|
||||
|
||||
// this lock is used to guard access to the above statics
|
||||
private static final Object sUnquoteLock = new Object();
|
||||
@@ -281,7 +281,7 @@ public class ConversationMessageData {
|
||||
final String rawTexts,
|
||||
final int partsCount,
|
||||
final String messageId) {
|
||||
final List<MessagePartData> parts = new LinkedList<MessagePartData>();
|
||||
final List<MessagePartData> parts = new LinkedList<>();
|
||||
if (partsCount == 1) {
|
||||
parts.add(makePartData(
|
||||
rawIds,
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ConversationParticipantsData implements Iterable<ParticipantData> {
|
||||
private int mParticipantCountExcludingSelf = 0;
|
||||
|
||||
public ConversationParticipantsData() {
|
||||
mConversationParticipantsMap = new SimpleArrayMap<String, ParticipantData>();
|
||||
mConversationParticipantsMap = new SimpleArrayMap<>();
|
||||
}
|
||||
|
||||
public void bind(final Cursor cursor) {
|
||||
@@ -66,7 +66,7 @@ public class ConversationParticipantsData implements Iterable<ParticipantData> {
|
||||
|
||||
ArrayList<ParticipantData> getParticipantListExcludingSelf() {
|
||||
final ArrayList<ParticipantData> retList =
|
||||
new ArrayList<ParticipantData>(mConversationParticipantsMap.size());
|
||||
new ArrayList<>(mConversationParticipantsMap.size());
|
||||
for (int i = 0; i < mConversationParticipantsMap.size(); i++) {
|
||||
final ParticipantData participant = mConversationParticipantsMap.valueAt(i);
|
||||
if (!participant.isSelf()) {
|
||||
@@ -103,7 +103,7 @@ public class ConversationParticipantsData implements Iterable<ParticipantData> {
|
||||
@NonNull
|
||||
@Override
|
||||
public Iterator<ParticipantData> iterator() {
|
||||
return new Iterator<ParticipantData>() {
|
||||
return new Iterator<>() {
|
||||
private int mCurrentIndex = -1;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -117,9 +117,9 @@ public class DraftMessageData extends BindableData implements ReadDraftDataActio
|
||||
|
||||
public DraftMessageData(final String conversationId) {
|
||||
mConversationId = conversationId;
|
||||
mAttachments = new ArrayList<MessagePartData>();
|
||||
mAttachments = new ArrayList<>();
|
||||
mReadOnlyAttachments = Collections.unmodifiableList(mAttachments);
|
||||
mPendingAttachments = new ArrayList<PendingAttachmentData>();
|
||||
mPendingAttachments = new ArrayList<>();
|
||||
mReadOnlyPendingAttachments = Collections.unmodifiableList(mPendingAttachments);
|
||||
mListeners = new DraftMessageDataEventDispatcher();
|
||||
mMessageTextStats = new MessageTextStats();
|
||||
@@ -773,7 +773,7 @@ public class DraftMessageData extends BindableData implements ReadDraftDataActio
|
||||
mBindingId = binding.getBindingId();
|
||||
// Obtain an immutable copy of the attachment list so we can operate on it in the
|
||||
// background thread.
|
||||
mAttachmentsCopy = new ArrayList<MessagePartData>(mAttachments);
|
||||
mAttachmentsCopy = new ArrayList<>(mAttachments);
|
||||
|
||||
mCheckDraftForSendTask = this;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class MessageData implements Parcelable {
|
||||
* Create an "empty" message
|
||||
*/
|
||||
public MessageData() {
|
||||
mParts = new ArrayList<MessagePartData>();
|
||||
mParts = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static String[] getProjection() {
|
||||
@@ -846,7 +846,7 @@ public class MessageData implements Parcelable {
|
||||
mRetryStartTimestamp = in.readLong();
|
||||
|
||||
// Read parts
|
||||
mParts = new ArrayList<MessagePartData>();
|
||||
mParts = new ArrayList<>();
|
||||
final int partCount = in.readInt();
|
||||
for (int i = 0; i < partCount; i++) {
|
||||
mParts.add((MessagePartData) in.readParcelable(MessagePartData.class.getClassLoader()));
|
||||
@@ -889,7 +889,7 @@ public class MessageData implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<MessageData> CREATOR
|
||||
= new Parcelable.Creator<MessageData>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public MessageData createFromParcel(final Parcel in) {
|
||||
return new MessageData(in);
|
||||
|
||||
@@ -413,7 +413,7 @@ public class MessagePartData implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<MessagePartData> CREATOR
|
||||
= new Parcelable.Creator<MessagePartData>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public MessagePartData createFromParcel(final Parcel in) {
|
||||
return new MessagePartData(in);
|
||||
|
||||
@@ -45,8 +45,7 @@ import com.android.messaging.util.TextUtil;
|
||||
*/
|
||||
public class ParticipantData implements Parcelable {
|
||||
|
||||
private static final ArrayMap<Integer, String> sSubIdtoParticipantIdCache =
|
||||
new ArrayMap<Integer, String>();
|
||||
private static final ArrayMap<Integer, String> sSubIdtoParticipantIdCache = new ArrayMap<>();
|
||||
|
||||
// We always use -1 as default/invalid sub id although system may give us anything negative
|
||||
public static final int DEFAULT_SELF_SUB_ID = MmsManager.DEFAULT_SUB_ID;
|
||||
@@ -583,8 +582,7 @@ public class ParticipantData implements Parcelable {
|
||||
dest.writeString(mSubscriptionName);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ParticipantData> CREATOR
|
||||
= new Parcelable.Creator<ParticipantData>() {
|
||||
public static final Parcelable.Creator<ParticipantData> CREATOR = new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ParticipantData createFromParcel(final Parcel in) {
|
||||
return new ParticipantData(in);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -162,15 +163,15 @@ public class PendingAttachmentData extends MessagePartData {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<PendingAttachmentData> CREATOR
|
||||
= new Parcelable.Creator<PendingAttachmentData>() {
|
||||
@Override
|
||||
public PendingAttachmentData createFromParcel(final Parcel in) {
|
||||
return new PendingAttachmentData(in);
|
||||
}
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public PendingAttachmentData createFromParcel(final Parcel in) {
|
||||
return new PendingAttachmentData(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PendingAttachmentData[] newArray(final int size) {
|
||||
return new PendingAttachmentData[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public PendingAttachmentData[] newArray(final int size) {
|
||||
return new PendingAttachmentData[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SelfParticipantsData {
|
||||
private final ArrayMap<String, ParticipantData> mSelfParticipantMap;
|
||||
|
||||
public SelfParticipantsData() {
|
||||
mSelfParticipantMap = new ArrayMap<String, ParticipantData>();
|
||||
mSelfParticipantMap = new ArrayMap<>();
|
||||
}
|
||||
|
||||
public void bind(final Cursor cursor) {
|
||||
@@ -55,7 +55,7 @@ public class SelfParticipantsData {
|
||||
* @param activeOnly if set, returns active self entries only (i.e. those with SIMs plugged in).
|
||||
*/
|
||||
public List<ParticipantData> getSelfParticipants(final boolean activeOnly) {
|
||||
List<ParticipantData> list = new ArrayList<ParticipantData>();
|
||||
List<ParticipantData> list = new ArrayList<>();
|
||||
for (final ParticipantData self : mSelfParticipantMap.values()) {
|
||||
if (!activeOnly || self.isActiveSubscription()) {
|
||||
list.add(self);
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SettingsData extends BindableData implements
|
||||
|
||||
public List<SettingsItem> getSettingsItems() {
|
||||
final List<ParticipantData> selfs = mSelfParticipantsData.getSelfParticipants(true);
|
||||
final List<SettingsItem> settingsItems = new ArrayList<SettingsItem>();
|
||||
final List<SettingsItem> settingsItems = new ArrayList<>();
|
||||
// First goes the general settings, followed by per-subscription settings.
|
||||
settingsItems.add(SettingsItem.createGeneralSettingsItem(mContext));
|
||||
// For per-subscription settings, show the actual SIM name with phone number if the
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -86,7 +87,7 @@ public class SubscriptionListData {
|
||||
private final Context mContext;
|
||||
|
||||
public SubscriptionListData(final Context context) {
|
||||
mEntriesExcludingDefault = new ArrayList<SubscriptionListEntry>();
|
||||
mEntriesExcludingDefault = new ArrayList<>();
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -31,7 +32,7 @@ class AsyncMediaRequestWrapper<T extends RefCountedMediaResource> extends Bindab
|
||||
public static <T extends RefCountedMediaResource> AsyncMediaRequestWrapper<T>
|
||||
createWith(final MediaRequest<T> wrappedRequest,
|
||||
final MediaResourceLoadListener<T> listener) {
|
||||
return new AsyncMediaRequestWrapper<T>(listener, wrappedRequest);
|
||||
return new AsyncMediaRequestWrapper<>(listener, wrappedRequest);
|
||||
}
|
||||
|
||||
private final MediaRequest<T> mWrappedRequest;
|
||||
@@ -71,4 +72,4 @@ class AsyncMediaRequestWrapper<T extends RefCountedMediaResource> extends Bindab
|
||||
public MediaRequestDescriptor<T> getDescriptor() {
|
||||
return mWrappedRequest.getDescriptor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -44,7 +45,7 @@ public class AvatarGroupRequestDescriptor extends CompositeImageRequestDescripto
|
||||
final int desiredWidth, final int desiredHeight) {
|
||||
final List<String> participantUriStrings = AvatarUriUtil.getGroupParticipantUris(uri);
|
||||
final List<AvatarRequestDescriptor> avatarDescriptors =
|
||||
new ArrayList<AvatarRequestDescriptor>(participantUriStrings.size());
|
||||
new ArrayList<>(participantUriStrings.size());
|
||||
for (final String uriString : participantUriStrings) {
|
||||
final AvatarRequestDescriptor descriptor = new AvatarRequestDescriptor(
|
||||
Uri.parse(uriString), desiredWidth, desiredHeight);
|
||||
@@ -55,7 +56,7 @@ public class AvatarGroupRequestDescriptor extends CompositeImageRequestDescripto
|
||||
|
||||
@Override
|
||||
public CompositeImageRequest<?> buildBatchImageRequest(final Context context) {
|
||||
return new CompositeImageRequest<AvatarGroupRequestDescriptor>(context, this);
|
||||
return new CompositeImageRequest<>(context, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,13 +59,13 @@ public class CustomVCardEntryConstructor implements VCardInterpreter {
|
||||
/**
|
||||
* Represents current stack of VCardEntry. Used to support nested vCard (vCard 2.1).
|
||||
*/
|
||||
private final List<CustomVCardEntry> mEntryStack = new ArrayList<CustomVCardEntry>();
|
||||
private final List<CustomVCardEntry> mEntryStack = new ArrayList<>();
|
||||
private CustomVCardEntry mCurrentEntry;
|
||||
|
||||
private final int mVCardType;
|
||||
private final Account mAccount;
|
||||
|
||||
private final List<EntryHandler> mEntryHandlers = new ArrayList<EntryHandler>();
|
||||
private final List<EntryHandler> mEntryHandlers = new ArrayList<>();
|
||||
|
||||
public CustomVCardEntryConstructor() {
|
||||
this(VCardConfig.VCARD_TYPE_V21_GENERIC, null);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -33,7 +34,7 @@ public abstract class MediaCacheManager implements MemoryCache {
|
||||
protected final SparseArray<MediaCache<?>> mCaches;
|
||||
|
||||
public MediaCacheManager() {
|
||||
mCaches = new SparseArray<MediaCache<?>>();
|
||||
mCaches = new SparseArray<>();
|
||||
MemoryCacheManager.get().registerMemoryCache(this);
|
||||
}
|
||||
|
||||
@@ -66,4 +67,4 @@ public abstract class MediaCacheManager implements MemoryCache {
|
||||
}
|
||||
|
||||
protected abstract MediaCache<?> createMediaCacheById(final int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,8 +233,7 @@ public class MediaResourceManager {
|
||||
}
|
||||
// We don't use SafeAsyncTask here since it enforces the shared thread pool executor
|
||||
// whereas we want a dedicated thread pool executor.
|
||||
AsyncTask<Void, Void, MediaLoadingResult<T>> mediaLoadingTask =
|
||||
new AsyncTask<Void, Void, MediaLoadingResult<T>>() {
|
||||
AsyncTask<Void, Void, MediaLoadingResult<T>> mediaLoadingTask = new AsyncTask<>() {
|
||||
private Exception mException;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -118,7 +119,7 @@ public class PoolableImageCache extends MediaCache<ImageResource> {
|
||||
private final SparseArray<LinkedList<ImageResource>> mImageListSparseArray;
|
||||
|
||||
public ReusableImageResourcePool() {
|
||||
mImageListSparseArray = new SparseArray<LinkedList<ImageResource>>();
|
||||
mImageListSparseArray = new SparseArray<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +233,7 @@ public class PoolableImageCache extends MediaCache<ImageResource> {
|
||||
Assert.isTrue(poolKey != INVALID_POOL_KEY);
|
||||
LinkedList<ImageResource> imageList = mImageListSparseArray.get(poolKey);
|
||||
if (imageList == null) {
|
||||
imageList = new LinkedList<ImageResource>();
|
||||
imageList = new LinkedList<>();
|
||||
mImageListSparseArray.put(poolKey, imageList);
|
||||
}
|
||||
imageList.addLast(imageResource);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
@@ -48,7 +49,7 @@ public abstract class RefCountedMediaResource {
|
||||
// to find out where each ref change happens.
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String TAG = "bugle_media_ref_history";
|
||||
private final ArrayList<String> mRefHistory = new ArrayList<String>();
|
||||
private final ArrayList<String> mRefHistory = new ArrayList<>();
|
||||
|
||||
// A lock that guards access to shared members in this class (and all its subclasses).
|
||||
private final ReentrantLock mLock = new ReentrantLock();
|
||||
@@ -161,4 +162,4 @@ public abstract class RefCountedMediaResource {
|
||||
|
||||
public abstract int getMediaSize();
|
||||
protected abstract void close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ public class UriImageRequestDescriptor extends ImageRequestDescriptor {
|
||||
@Override
|
||||
public MediaRequest<ImageResource> buildSyncMediaRequest(final Context context) {
|
||||
if (uri == null || UriUtil.isLocalUri(uri)) {
|
||||
return new UriImageRequest<UriImageRequestDescriptor>(context, this);
|
||||
return new UriImageRequest<>(context, this);
|
||||
} else {
|
||||
return new NetworkUriImageRequest<UriImageRequestDescriptor>(context, this);
|
||||
return new NetworkUriImageRequest<>(context, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class VCardRequest implements MediaRequest<VCardResource> {
|
||||
VCardRequest(final Context context, final VCardRequestDescriptor descriptor) {
|
||||
mDescriptor = descriptor;
|
||||
mContext = context;
|
||||
mLoadedVCards = new ArrayList<VCardResourceEntry>();
|
||||
mLoadedVCards = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -163,7 +163,7 @@ public class VCardResourceEntry {
|
||||
final VCardEntry vcard) {
|
||||
final Resources resources = Factory.get().getApplicationContext().getResources();
|
||||
final List<VCardResourceEntry.VCardResourceEntryDestinationItem> retList =
|
||||
new ArrayList<VCardResourceEntry.VCardResourceEntryDestinationItem>();
|
||||
new ArrayList<>();
|
||||
if (vcard.getPhoneList() != null) {
|
||||
for (final PhoneData phone : vcard.getPhoneList()) {
|
||||
final Intent intent = new Intent(Intent.ACTION_DIAL);
|
||||
@@ -264,7 +264,7 @@ public class VCardResourceEntry {
|
||||
|
||||
if (vcard.getNotes() != null) {
|
||||
for (final NoteData note : vcard.getNotes()) {
|
||||
final ArrayMap<String, String> curChildMap = new ArrayMap<String, String>();
|
||||
final ArrayMap<String, String> curChildMap = new ArrayMap<>();
|
||||
if (TextUtils.isGraphic(note.getNote())){
|
||||
retList.add(new VCardResourceEntryDestinationItem(note.getNote(),
|
||||
resources.getString(R.string.vcard_detail_notes_label), null));
|
||||
|
||||
Reference in New Issue
Block a user