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:
@@ -153,9 +153,9 @@ public class Base64 {
|
||||
byte[] groomedData = new byte[data.length];
|
||||
int bytesCopied = 0;
|
||||
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (isBase64(data[i])) {
|
||||
groomedData[bytesCopied++] = data[i];
|
||||
for (byte datum : data) {
|
||||
if (isBase64(datum)) {
|
||||
groomedData[bytesCopied++] = datum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -628,8 +628,8 @@ public class PduHeaders {
|
||||
}
|
||||
|
||||
ArrayList<EncodedStringValue> list = new ArrayList<>();
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
list.add(value[i]);
|
||||
for (EncodedStringValue encodedStringValue : value) {
|
||||
list.add(encodedStringValue);
|
||||
}
|
||||
mHeaderMap.put(field, list);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,6 @@ public class BugleApplication extends Application implements UncaughtExceptionHa
|
||||
// Start method tracing with a big enough buffer and let it run for 30s.
|
||||
// Note we use a logging tag as we don't want to wait for gservices to start up.
|
||||
final File file = DebugUtils.getDebugFile("startup.trace", true);
|
||||
if (file != null) {
|
||||
android.os.Debug.startMethodTracing(file.getAbsolutePath(), 160 * 1024 * 1024);
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
android.os.Debug.stopMethodTracing();
|
||||
@@ -176,7 +175,6 @@ public class BugleApplication extends Application implements UncaughtExceptionHa
|
||||
}, 30000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void maybeHandleSharedPrefsUpgrade(final Factory factory) {
|
||||
final int existingVersion = factory.getApplicationPrefs().getInt(
|
||||
|
||||
@@ -24,9 +24,10 @@ import android.database.sqlite.SQLiteDoneException;
|
||||
import android.database.sqlite.SQLiteStatement;
|
||||
import android.net.Uri;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.DatabaseHelper.ConversationColumns;
|
||||
@@ -55,6 +56,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
|
||||
@@ -35,17 +35,18 @@ import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat.WearableExtender;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.app.RemoteInput;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat.WearableExtender;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.app.RemoteInput;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.MessageNotificationState.BundledMessageNotificationState;
|
||||
@@ -55,14 +56,12 @@ import com.android.messaging.datamodel.MessageNotificationState.MultiMessageNoti
|
||||
import com.android.messaging.datamodel.action.MarkAsReadAction;
|
||||
import com.android.messaging.datamodel.action.MarkAsSeenAction;
|
||||
import com.android.messaging.datamodel.action.RedownloadMmsAction;
|
||||
import com.android.messaging.datamodel.data.ConversationListItemData;
|
||||
import com.android.messaging.datamodel.media.AvatarRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.ImageResource;
|
||||
import com.android.messaging.datamodel.media.MediaRequest;
|
||||
import com.android.messaging.datamodel.media.MediaResourceManager;
|
||||
import com.android.messaging.datamodel.media.MessagePartVideoThumbnailRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.UriImageRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.VideoThumbnailRequest;
|
||||
import com.android.messaging.sms.MmsSmsUtils;
|
||||
import com.android.messaging.sms.MmsUtils;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
@@ -78,7 +77,6 @@ import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.NotificationPlayer;
|
||||
import com.android.messaging.util.NotificationsUtil;
|
||||
import com.android.messaging.util.PendingIntentConstants;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.ThreadUtil;
|
||||
import com.android.messaging.util.UriUtil;
|
||||
|
||||
@@ -632,10 +630,8 @@ public class BugleNotifications {
|
||||
}
|
||||
|
||||
synchronized (sPendingNotifications) {
|
||||
if (sPendingNotifications.contains(notificationState)) {
|
||||
sPendingNotifications.remove(notificationState);
|
||||
}
|
||||
}
|
||||
|
||||
notificationState.mNotificationBuilder
|
||||
.setSmallIcon(notificationState.getIcon())
|
||||
@@ -662,8 +658,7 @@ public class BugleNotifications {
|
||||
Bitmap attachmentBitmap = null;
|
||||
|
||||
// For messages with photo/video attachment, request an image to show in the notification.
|
||||
if (attachmentUri != null && notificationState.mNotificationStyle != null &&
|
||||
(notificationState.mNotificationStyle instanceof
|
||||
if (attachmentUri != null && (notificationState.mNotificationStyle instanceof
|
||||
NotificationCompat.BigPictureStyle) &&
|
||||
(ContentType.isImageType(attachmentType) ||
|
||||
ContentType.isVideoType(attachmentType))) {
|
||||
|
||||
@@ -32,12 +32,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.Assert.DoesNotRunOnMainThread;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
|
||||
/**
|
||||
* TODO: Open Issues:
|
||||
* - Should we be storing the draft messages in the regular messages table or should we have a
|
||||
* separate table for drafts to keep the normal messages query as simple as possible?
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows access to the SQL database. This is package private.
|
||||
*/
|
||||
|
||||
@@ -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<>());
|
||||
ThreadLocal.withInitial(Stack::new);
|
||||
|
||||
private static final String[] sFormatStrings = new String[] {
|
||||
"took %d ms to %s",
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContactUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* A cursor builder that takes the frequent contacts cursor and aggregate it with the all contacts
|
||||
@@ -45,20 +44,16 @@ public class FrequentContactsCursorBuilder {
|
||||
|
||||
/**
|
||||
* Sets the frequent contacts cursor as soon as it is loaded, or null if it's reset.
|
||||
* @return this builder instance for chained operations
|
||||
*/
|
||||
public FrequentContactsCursorBuilder setFrequents(final Cursor frequentContactsCursor) {
|
||||
public void setFrequents(final Cursor frequentContactsCursor) {
|
||||
mFrequentContactsCursor = frequentContactsCursor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the all contacts cursor as soon as it is loaded, or null if it's reset.
|
||||
* @return this builder instance for chained operations
|
||||
*/
|
||||
public FrequentContactsCursorBuilder setAllContacts(final Cursor allContactsCursor) {
|
||||
public void setAllContacts(final Cursor allContactsCursor) {
|
||||
mAllContactsCursor = allContactsCursor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,7 +148,7 @@ public class FrequentContactsCursorBuilder {
|
||||
|
||||
// Now we have a list of rows containing frequent contacts in alphabetical order.
|
||||
// Therefore, sort all the rows according to their actual ranks in the frequents list.
|
||||
Collections.sort(rows, (lhs, rhs) -> {
|
||||
rows.sort((lhs, rhs) -> {
|
||||
final String lookupKeyLhs = (String) lhs[ContactUtil.INDEX_LOOKUP_KEY];
|
||||
final String lookupKeyRhs = (String) rhs[ContactUtil.INDEX_LOOKUP_KEY];
|
||||
Assert.isTrue(lookupKeyToRankMap.containsKey(lookupKeyLhs) &&
|
||||
@@ -179,8 +174,7 @@ public class FrequentContactsCursorBuilder {
|
||||
return 1;
|
||||
} else {
|
||||
// Use the default sort order, i.e. sort by phoneType value.
|
||||
return phoneTypeLhs < phoneTypeRhs ? -1 :
|
||||
(phoneTypeLhs == phoneTypeRhs ? 0 : 1);
|
||||
return Integer.compare(phoneTypeLhs, phoneTypeRhs);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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.
|
||||
@@ -52,7 +53,7 @@ public class FrequentContactsCursorQueryData extends CursorQueryData {
|
||||
|
||||
private abstract class StrequentContactsQueryStrategy implements Strategy<Void, Cursor> {
|
||||
@Override
|
||||
public Cursor execute(Void params) throws Exception {
|
||||
public Cursor execute(Void params) {
|
||||
final Uri uri = getUri();
|
||||
if (uri != null) {
|
||||
setUri(uri);
|
||||
|
||||
@@ -23,10 +23,6 @@ import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat.Builder;
|
||||
import androidx.core.app.NotificationCompat.WearableExtender;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import android.text.Html;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
@@ -38,6 +34,11 @@ import android.text.style.StyleSpan;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
import android.text.style.URLSpan;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat.Builder;
|
||||
import androidx.core.app.NotificationCompat.WearableExtender;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ConversationListItemData;
|
||||
@@ -46,7 +47,6 @@ import com.android.messaging.datamodel.data.ConversationParticipantsData;
|
||||
import com.android.messaging.datamodel.data.MessageData;
|
||||
import com.android.messaging.datamodel.data.MessagePartData;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.datamodel.media.VideoThumbnailRequest;
|
||||
import com.android.messaging.sms.MmsUtils;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.util.Assert;
|
||||
@@ -635,9 +635,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
continue;
|
||||
}
|
||||
|
||||
final int currentCount = firstNames.containsKey(firstName)
|
||||
? firstNames.get(firstName)
|
||||
: 0;
|
||||
final int currentCount = firstNames.getOrDefault(firstName, 0);
|
||||
firstNames.put(firstName, currentCount + 1);
|
||||
}
|
||||
return firstNames;
|
||||
|
||||
@@ -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.
|
||||
@@ -18,7 +19,6 @@ package com.android.messaging.datamodel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
|
||||
@@ -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.
|
||||
@@ -18,7 +19,6 @@ package com.android.messaging.datamodel;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.core.app.RemoteInput;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
@@ -106,15 +106,11 @@ public class BackgroundWorkerService extends JobIntentService {
|
||||
protected void onHandleWork(@NonNull final Intent intent) {
|
||||
final int opcode = intent.getIntExtra(EXTRA_OP_CODE, 0);
|
||||
|
||||
switch(opcode) {
|
||||
case OP_PROCESS_REQUEST: {
|
||||
if (opcode == OP_PROCESS_REQUEST) {
|
||||
final Action action = intent.getParcelableExtra(EXTRA_ACTION);
|
||||
final int attempt = intent.getIntExtra(EXTRA_ATTEMPT, -1);
|
||||
doBackgroundWork(action, attempt);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
} else {
|
||||
LogUtil.w(TAG, "Unrecognized opcode in BackgroundWorkerService " + opcode);
|
||||
throw new RuntimeException("Unrecognized opcode in BackgroundWorkerService");
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.android.messaging.datamodel.BugleDatabaseOperations;
|
||||
import com.android.messaging.datamodel.DataModel;
|
||||
import com.android.messaging.datamodel.DataModelImpl;
|
||||
import com.android.messaging.datamodel.DatabaseHelper;
|
||||
import com.android.messaging.datamodel.DatabaseHelper.MessageColumns;
|
||||
import com.android.messaging.datamodel.DatabaseWrapper;
|
||||
import com.android.messaging.datamodel.MessagingContentProvider;
|
||||
import com.android.messaging.datamodel.data.MessageData;
|
||||
@@ -43,9 +42,6 @@ import com.android.messaging.util.ConnectivityUtil.ConnectivityListener;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Action used to lookup any messages in the pending send/download state and either fail them or
|
||||
* retry their action based on subscriptions. This action only initiates one retry at a time for
|
||||
|
||||
@@ -106,11 +106,7 @@ public class SyncMessagesAction extends Action implements Parcelable {
|
||||
* sending/receiving).
|
||||
*/
|
||||
public static void immediateSync() {
|
||||
final long now = System.currentTimeMillis();
|
||||
// TODO: Could base this off most recent message in db but now should be okay...
|
||||
final long startTimestamp = now;
|
||||
|
||||
sync(startTimestamp);
|
||||
sync(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private static void sync(final long startTimestamp) {
|
||||
|
||||
@@ -47,7 +47,6 @@ import com.android.messaging.util.SafeAsyncTask;
|
||||
import com.android.messaging.util.UriUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Represents a single message part. Messages consist of one or more parts which may contain
|
||||
|
||||
@@ -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.
|
||||
@@ -17,10 +18,8 @@ package com.android.messaging.datamodel.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ConversationListItemData.ConversationListViewColumns;
|
||||
import com.android.messaging.util.Assert;
|
||||
|
||||
public class PeopleOptionsItemData {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.android.messaging.datamodel.data;
|
||||
|
||||
import android.database.Cursor;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
|
||||
import com.android.messaging.datamodel.data.MessagePartData;
|
||||
@@ -224,7 +223,7 @@ public abstract class ImageRequest<D extends ImageRequestDescriptor>
|
||||
final int backgroundColor = mDescriptor.circleBackgroundColor;
|
||||
final int strokeColor = mDescriptor.circleStrokeColor;
|
||||
ImageUtils.drawBitmapWithCircleOnCanvas(sourceBitmap, new Canvas(targetBitmap), source,
|
||||
dest, null, backgroundColor == 0 ? false : true /* fillBackground */,
|
||||
dest, null, backgroundColor != 0 /* fillBackground */,
|
||||
backgroundColor, strokeColor);
|
||||
return new DecodedImageResource(getKey(), targetBitmap,
|
||||
loadedResource.getOrientation());
|
||||
|
||||
@@ -188,10 +188,7 @@ public class MediaResourceManager {
|
||||
}
|
||||
final MediaCache<T> mediaCache = mediaRequest.getMediaCache();
|
||||
if (mediaCache != null) {
|
||||
final T mediaResource = mediaCache.fetchResourceFromCache(mediaRequest.getKey());
|
||||
if (mediaResource != null) {
|
||||
return mediaResource;
|
||||
}
|
||||
return mediaCache.fetchResourceFromCache(mediaRequest.getKey());
|
||||
}
|
||||
return 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.
|
||||
@@ -38,10 +39,7 @@ public final class SqliteWrapper {
|
||||
String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
try {
|
||||
return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
|
||||
} catch (SQLiteException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when query", e);
|
||||
return null;
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when query", e);
|
||||
return null;
|
||||
}
|
||||
@@ -51,10 +49,7 @@ public final class SqliteWrapper {
|
||||
ContentValues values, String where, String[] selectionArgs) {
|
||||
try {
|
||||
return resolver.update(uri, values, where, selectionArgs);
|
||||
} catch (SQLiteException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when update", e);
|
||||
return -1;
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when update", e);
|
||||
return -1;
|
||||
}
|
||||
@@ -64,10 +59,7 @@ public final class SqliteWrapper {
|
||||
String where, String[] selectionArgs) {
|
||||
try {
|
||||
return resolver.delete(uri, where, selectionArgs);
|
||||
} catch (SQLiteException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when delete", e);
|
||||
return -1;
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when delete", e);
|
||||
return -1;
|
||||
}
|
||||
@@ -77,10 +69,7 @@ public final class SqliteWrapper {
|
||||
Uri uri, ContentValues values) {
|
||||
try {
|
||||
return resolver.insert(uri, values);
|
||||
} catch (SQLiteException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when insert", e);
|
||||
return null;
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "SqliteWrapper: catch an exception when insert", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -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,13 +1277,10 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given address type, extract the recipients from the headers.
|
||||
@@ -1325,13 +1320,10 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a PDU object from one location to another.
|
||||
|
||||
@@ -28,17 +28,12 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.provider.Telephony;
|
||||
import android.provider.Telephony.Sms;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat.Builder;
|
||||
import androidx.core.app.NotificationCompat.Style;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.BugleNotifications;
|
||||
import com.android.messaging.datamodel.NoConfirmationSmsSendService;
|
||||
import com.android.messaging.datamodel.action.ReceiveSmsMessageAction;
|
||||
import com.android.messaging.sms.MmsUtils;
|
||||
@@ -49,6 +44,9 @@ import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PendingIntentConstants;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Class that receives incoming SMS messages through android.provider.Telephony.SMS_RECEIVED
|
||||
*
|
||||
|
||||
@@ -359,7 +359,7 @@ public class BugleApnSettingsLoader implements ApnSettingsLoader {
|
||||
} else {
|
||||
uri = Telephony.Carriers.CONTENT_URI;
|
||||
}
|
||||
Cursor cursor = null;
|
||||
Cursor cursor;
|
||||
try {
|
||||
for (; ; ) {
|
||||
// Try different combinations of queries. Some would work on some platforms.
|
||||
@@ -556,7 +556,7 @@ public class BugleApnSettingsLoader implements ApnSettingsLoader {
|
||||
return addr;
|
||||
}
|
||||
final StringBuilder builder = new StringBuilder(16);
|
||||
String result = null;
|
||||
String result;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
try {
|
||||
if (octets[i].length() > 3) {
|
||||
|
||||
@@ -107,9 +107,7 @@ public class BugleCarrierConfigValuesLoader implements CarrierConfigValuesLoader
|
||||
try {
|
||||
final Bundle systemValues =
|
||||
PhoneUtils.get(subId).getSmsManager().getCarrierConfigValues();
|
||||
if (systemValues != null) {
|
||||
values.putAll(systemValues);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
LogUtil.w(LogUtil.BUGLE_TAG, "Calling system getCarrierConfigValues exception", e);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import android.webkit.MimeTypeMap;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.data.MessageData;
|
||||
import com.android.messaging.datamodel.media.VideoThumbnailRequest;
|
||||
import com.android.messaging.mmslib.pdu.CharacterSets;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
@@ -65,7 +64,7 @@ public class DatabaseMessages {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null || !(other instanceof DatabaseMessage)) {
|
||||
if (!(other instanceof DatabaseMessage)) {
|
||||
return false;
|
||||
}
|
||||
final DatabaseMessage otherDbMsg = (DatabaseMessage) other;
|
||||
@@ -155,8 +154,8 @@ public class DatabaseMessages {
|
||||
mType = cursor.getInt(INDEX_TYPE);
|
||||
mThreadId = cursor.getLong(INDEX_THREAD_ID);
|
||||
mStatus = cursor.getInt(INDEX_STATUS);
|
||||
mRead = cursor.getInt(INDEX_READ) == 0 ? false : true;
|
||||
mSeen = cursor.getInt(INDEX_SEEN) == 0 ? false : true;
|
||||
mRead = cursor.getInt(INDEX_READ) != 0;
|
||||
mSeen = cursor.getInt(INDEX_SEEN) != 0;
|
||||
mUri = ContentUris.withAppendedId(Sms.CONTENT_URI, mRowId).toString();
|
||||
mSubId = PhoneUtils.getDefault().getSubIdFromTelephony(cursor, INDEX_SUB_ID);
|
||||
}
|
||||
@@ -351,8 +350,8 @@ public class DatabaseMessages {
|
||||
mThreadId = cursor.getLong(INDEX_THREAD_ID);
|
||||
mPriority = cursor.getInt(INDEX_PRIORITY);
|
||||
mStatus = cursor.getInt(INDEX_STATUS);
|
||||
mRead = cursor.getInt(INDEX_READ) == 0 ? false : true;
|
||||
mSeen = cursor.getInt(INDEX_SEEN) == 0 ? false : true;
|
||||
mRead = cursor.getInt(INDEX_READ) != 0;
|
||||
mSeen = cursor.getInt(INDEX_SEEN) != 0;
|
||||
mContentLocation = cursor.getString(INDEX_CONTENT_LOCATION);
|
||||
mTransactionId = cursor.getString(INDEX_TRANSACTION_ID);
|
||||
mMmsMessageType = cursor.getInt(INDEX_MESSAGE_TYPE);
|
||||
@@ -731,6 +730,7 @@ public class DatabaseMessages {
|
||||
/**
|
||||
* Get an instance of the MMS part from the part table cursor
|
||||
*
|
||||
* @param loadMedia Whether to load the media file of the part
|
||||
*/
|
||||
public static MmsPart get(final Cursor cursor, final boolean loadMedia) {
|
||||
final MmsPart part = new MmsPart();
|
||||
|
||||
@@ -29,12 +29,10 @@ import android.database.sqlite.SQLiteException;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Telephony;
|
||||
import android.provider.Telephony.Mms;
|
||||
import android.provider.Telephony.Sms;
|
||||
import android.provider.Telephony.Threads;
|
||||
import android.telephony.SmsManager;
|
||||
import android.telephony.SmsMessage;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -45,7 +43,6 @@ import com.android.messaging.datamodel.action.DownloadMmsAction;
|
||||
import com.android.messaging.datamodel.action.SendMessageAction;
|
||||
import com.android.messaging.datamodel.data.MessageData;
|
||||
import com.android.messaging.datamodel.data.MessagePartData;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.mmslib.InvalidHeaderValueException;
|
||||
import com.android.messaging.mmslib.MmsException;
|
||||
import com.android.messaging.mmslib.SqliteWrapper;
|
||||
@@ -122,7 +119,7 @@ public class MmsUtils {
|
||||
*/
|
||||
public static final int MMS_REQUEST_NO_RETRY = 3;
|
||||
|
||||
public static final String getRequestStatusDescription(final int status) {
|
||||
public static String getRequestStatusDescription(final int status) {
|
||||
switch (status) {
|
||||
case MMS_REQUEST_SUCCEEDED:
|
||||
return "SUCCEEDED";
|
||||
@@ -889,9 +886,7 @@ public class MmsUtils {
|
||||
LogUtil.d(TAG, "Mmsutils: Inserted SMS message into telephony (type = " + type + ")"
|
||||
+ ", uri: " + response);
|
||||
}
|
||||
} catch (final SQLiteException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: persist sms message failure " + e, e);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
} catch (final SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: persist sms message failure " + e, e);
|
||||
}
|
||||
return response;
|
||||
@@ -914,9 +909,7 @@ public class MmsUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} catch (final SQLiteException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: update sms message failure " + e, e);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
} catch (final SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: update sms message failure " + e, e);
|
||||
}
|
||||
return false;
|
||||
@@ -999,9 +992,7 @@ public class MmsUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} catch (final SQLiteException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: update mms message failure " + e, e);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
} catch (final SQLiteException | IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: update mms message failure " + e, e);
|
||||
}
|
||||
return false;
|
||||
@@ -1135,9 +1126,7 @@ public class MmsUtils {
|
||||
if (messageUri != null) {
|
||||
return ContentUris.parseId(messageUri);
|
||||
}
|
||||
} catch (final UnsupportedOperationException e) {
|
||||
// Nothing to do
|
||||
} catch (final NumberFormatException e) {
|
||||
} catch (final UnsupportedOperationException | NumberFormatException e) {
|
||||
// Nothing to do
|
||||
}
|
||||
return -1;
|
||||
@@ -1785,9 +1774,7 @@ public class MmsUtils {
|
||||
}
|
||||
MmsSender.sendNotifyResponseForMmsDownload(
|
||||
context, subId, transactionId, contentLocation, status);
|
||||
} catch (final MmsFailureException e) {
|
||||
LogUtil.e(TAG, "sendNotifyResponseForMmsDownload: failed to retrieve message " + e, e);
|
||||
} catch (final InvalidHeaderValueException e) {
|
||||
} catch (final MmsFailureException | InvalidHeaderValueException e) {
|
||||
LogUtil.e(TAG, "sendNotifyResponseForMmsDownload: failed to retrieve message " + e, e);
|
||||
}
|
||||
}
|
||||
@@ -1810,9 +1797,7 @@ public class MmsUtils {
|
||||
return;
|
||||
}
|
||||
MmsSender.sendAcknowledgeForMmsDownload(context, subId, transactionId, contentLocation);
|
||||
} catch (final MmsFailureException e) {
|
||||
LogUtil.e(TAG, "sendAcknowledgeForMmsDownload: failed to retrieve message " + e, e);
|
||||
} catch (final InvalidHeaderValueException e) {
|
||||
} catch (final MmsFailureException | InvalidHeaderValueException e) {
|
||||
LogUtil.e(TAG, "sendAcknowledgeForMmsDownload: failed to retrieve message " + e, e);
|
||||
}
|
||||
}
|
||||
@@ -1875,12 +1860,10 @@ public class MmsUtils {
|
||||
status = e.retryHint;
|
||||
rawStatus = e.rawStatus;
|
||||
LogUtil.e(TAG, "MmsUtils: failed to send message " + e, e);
|
||||
} catch (final InvalidHeaderValueException e) {
|
||||
} catch (final MmsException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: failed to send message " + e, e);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: invalid message to send " + e, e);
|
||||
} catch (final MmsException e) {
|
||||
LogUtil.e(TAG, "MmsUtils: failed to send message " + e, e);
|
||||
}
|
||||
// If we get here, some exception occurred
|
||||
return new StatusPlusUri(status, rawStatus, messageUri);
|
||||
@@ -1939,8 +1922,6 @@ public class MmsUtils {
|
||||
private static String[] getDupNotifications(final Context context, final NotificationInd nInd) {
|
||||
final byte[] rawTransactionId = nInd.getTransactionId();
|
||||
if (rawTransactionId != null) {
|
||||
// dedup algorithm
|
||||
String selection = DUP_NOTIFICATION_QUERY_SELECTION;
|
||||
final long nowSecs = System.currentTimeMillis() / 1000;
|
||||
String[] selectionArgs = new String[] {
|
||||
Integer.toString(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND),
|
||||
@@ -1952,7 +1933,7 @@ public class MmsUtils {
|
||||
try (Cursor cursor = SqliteWrapper.query(
|
||||
context, context.getContentResolver(),
|
||||
Mms.CONTENT_URI, new String[]{Mms._ID},
|
||||
selection, selectionArgs, null)) {
|
||||
DUP_NOTIFICATION_QUERY_SELECTION, selectionArgs, null)) {
|
||||
final int dupCount = cursor.getCount();
|
||||
if (dupCount > 0) {
|
||||
// We already received the same notification before.
|
||||
@@ -2015,7 +1996,7 @@ public class MmsUtils {
|
||||
}
|
||||
final String[] dups = getDupNotifications(context, nInd);
|
||||
if (dups == null) {
|
||||
Uri inboxUri = null;
|
||||
Uri inboxUri;
|
||||
try {
|
||||
inboxUri = p.persist(pdu, Mms.Inbox.CONTENT_URI, subId, subPhoneNumber,
|
||||
null);
|
||||
@@ -2299,9 +2280,7 @@ public class MmsUtils {
|
||||
if (pduData == null || pduData.length < 1) {
|
||||
throw new IllegalArgumentException("Empty or zero length PDU data");
|
||||
}
|
||||
} catch (final MmsFailureException e) {
|
||||
// Nothing to do
|
||||
} catch (final InvalidHeaderValueException e) {
|
||||
} catch (final MmsFailureException | InvalidHeaderValueException e) {
|
||||
// Nothing to do
|
||||
}
|
||||
return pduData;
|
||||
@@ -2349,7 +2328,6 @@ public class MmsUtils {
|
||||
}
|
||||
final String dumpFileName = MmsUtils.MMS_DUMP_PREFIX + getDumpFileId(pdu);
|
||||
final File dumpFile = DebugUtils.getDebugFile(dumpFileName, true);
|
||||
if (dumpFile != null) {
|
||||
try {
|
||||
final FileOutputStream fos = new FileOutputStream(dumpFile);
|
||||
try (BufferedOutputStream bos = new BufferedOutputStream(fos)) {
|
||||
@@ -2361,7 +2339,6 @@ public class MmsUtils {
|
||||
LogUtil.e(TAG, "dumpPdu: " + e, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dump file id based on the parsed PDU
|
||||
|
||||
@@ -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.
|
||||
@@ -32,20 +33,15 @@ class SystemProperties {
|
||||
sSystemPropertiesGetMethod =
|
||||
systemPropertiesClass.getMethod("get", String.class);
|
||||
}
|
||||
} catch (final ClassNotFoundException e) {
|
||||
// Nothing to do
|
||||
} catch (final NoSuchMethodException e) {
|
||||
} catch (final ClassNotFoundException | NoSuchMethodException e) {
|
||||
// Nothing to do
|
||||
}
|
||||
}
|
||||
if (sSystemPropertiesGetMethod != null) {
|
||||
try {
|
||||
return (String) sSystemPropertiesGetMethod.invoke(null, name);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
// Nothing to do
|
||||
} catch (final IllegalAccessException e) {
|
||||
// Nothing to do
|
||||
} catch (final InvocationTargetException e) {
|
||||
} catch (final IllegalArgumentException | InvocationTargetException |
|
||||
IllegalAccessException e) {
|
||||
// Nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,12 @@ import android.graphics.RectF;
|
||||
import android.graphics.drawable.AnimatedImageDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.binding.Binding;
|
||||
import com.android.messaging.datamodel.binding.BindingBase;
|
||||
|
||||
@@ -132,7 +132,7 @@ public class AttachmentPreview extends ScrollView implements OnAttachmentClickLi
|
||||
}
|
||||
|
||||
// returns true if we have attachments
|
||||
public boolean onAttachmentsChanged(final DraftMessageData draftMessageData) {
|
||||
public void onAttachmentsChanged(final DraftMessageData draftMessageData) {
|
||||
final boolean isFirstUpdate = mPendingFirstUpdate;
|
||||
final List<MessagePartData> attachments = draftMessageData.getReadOnlyAttachments();
|
||||
final List<PendingAttachmentData> pendingAttachments =
|
||||
@@ -163,7 +163,7 @@ public class AttachmentPreview extends ScrollView implements OnAttachmentClickLi
|
||||
// Run immediately when clearing attachments
|
||||
mHideRunnable.run();
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
cancelPendingHide(); // We're showing
|
||||
@@ -248,7 +248,6 @@ public class AttachmentPreview extends ScrollView implements OnAttachmentClickLi
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onMessageAnimationStart() {
|
||||
|
||||
@@ -30,11 +30,11 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.loader.app.LoaderManager;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.DataModel;
|
||||
import com.android.messaging.datamodel.binding.Binding;
|
||||
import com.android.messaging.datamodel.binding.BindingBase;
|
||||
import com.android.messaging.datamodel.data.BlockedParticipantsData;
|
||||
import com.android.messaging.datamodel.data.BlockedParticipantsData.BlockedParticipantsDataListener;
|
||||
import com.android.messaging.datamodel.DataModel;
|
||||
import com.android.messaging.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,16 +19,16 @@ package com.android.messaging.ui;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.view.ActionMode;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.BugleActivityUtil;
|
||||
import com.android.messaging.util.ImeUtil;
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.android.messaging.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SnackBar {
|
||||
public static final int LONG_DURATION_IN_MS = 5000;
|
||||
@@ -211,11 +212,7 @@ public class SnackBar {
|
||||
mAction = builder.mAction;
|
||||
mPlacement = builder.mPlacement;
|
||||
mParentView = builder.mParentView;
|
||||
if (builder.mInteractions == null) {
|
||||
mInteractions = new ArrayList<>();
|
||||
} else {
|
||||
mInteractions = builder.mInteractions;
|
||||
}
|
||||
mInteractions = Objects.requireNonNullElseGet(builder.mInteractions, ArrayList::new);
|
||||
|
||||
mActionTextView = (TextView) mRootView.findViewById(R.id.snack_bar_action);
|
||||
mMessageView = (TextView) mRootView.findViewById(R.id.snack_bar_message);
|
||||
|
||||
@@ -32,11 +32,11 @@ import android.os.Bundle;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.provider.ContactsContract.Intents;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.TaskStackBuilder;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.ex.photo.Intents.PhotoViewIntentBuilder;
|
||||
import com.android.messaging.R;
|
||||
@@ -345,9 +345,8 @@ public class UIIntentsImpl extends UIIntents {
|
||||
@Override
|
||||
public Intent getIntentForConversationActivity(final Context context,
|
||||
final String conversationId, final MessageData draft) {
|
||||
final Intent intent = getConversationActivityIntent(context, conversationId, draft,
|
||||
return getConversationActivityIntent(context, conversationId, draft,
|
||||
false /* withCustomTransition */);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.MessagePartData;
|
||||
import com.android.messaging.datamodel.media.ImageRequest;
|
||||
import com.android.messaging.datamodel.media.MessagePartVideoThumbnailRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.VideoThumbnailRequest;
|
||||
import com.android.messaging.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,9 +20,6 @@ import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
@@ -34,6 +31,9 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
|
||||
@@ -184,7 +184,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
position = getRtlPosition(position);
|
||||
int tabStripChildCount = mTabStrip.getChildCount();
|
||||
if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
|
||||
if (position < 0 || position >= tabStripChildCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
|
||||
public void onPageSelected(int position) {
|
||||
position = getRtlPosition(position);
|
||||
int tabStripChildCount = mTabStrip.getChildCount();
|
||||
if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
|
||||
if (position < 0 || position >= tabStripChildCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package com.android.messaging.ui.animation;
|
||||
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
|
||||
@@ -25,13 +25,14 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroupOverlay;
|
||||
import android.view.ViewOverlay;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.messaging.ui.contact;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import androidx.core.util.Pair;
|
||||
import android.text.TextUtils;
|
||||
import android.text.util.Rfc822Token;
|
||||
import android.text.util.Rfc822Tokenizer;
|
||||
@@ -222,7 +221,6 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
|
||||
* Compare two RecipientEntry's, first by locale-aware display name comparison, then by
|
||||
* contact id comparison, finally by first-level-ness comparison.
|
||||
*/
|
||||
@Override
|
||||
public int compare(RecipientEntry lhs, RecipientEntry rhs) {
|
||||
// Send-to-destinations always appear before everything else.
|
||||
final boolean sendToLhs = ContactRecipientEntryUtils
|
||||
|
||||
@@ -21,9 +21,6 @@ import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import android.text.Editable;
|
||||
import android.text.Html;
|
||||
import android.text.InputFilter;
|
||||
@@ -41,6 +38,8 @@ import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.binding.Binding;
|
||||
@@ -320,14 +319,12 @@ public class ComposeMessageView extends LinearLayout
|
||||
}
|
||||
|
||||
// returns true if it actually shows the subject editor and false if already showing
|
||||
private boolean showSubjectEditor() {
|
||||
private void showSubjectEditor() {
|
||||
// show the subject editor
|
||||
if (mSubjectView.getVisibility() == View.GONE) {
|
||||
mSubjectView.setVisibility(View.VISIBLE);
|
||||
mSubjectView.requestFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void hideSubjectEditor() {
|
||||
|
||||
@@ -24,12 +24,6 @@ import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
import android.util.StateSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -40,6 +34,11 @@ import android.view.ViewGroupOverlay;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ConversationMessageData;
|
||||
@@ -77,9 +76,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
private static final int HIDE_ANIMATION_DURATION_MS = 300;
|
||||
private static final int HIDE_DELAY_MS = 1500;
|
||||
|
||||
private final Context mContext;
|
||||
private final RecyclerView mRv;
|
||||
private final ViewGroupOverlay mOverlay;
|
||||
private final ImageView mTrackImageView;
|
||||
private final ImageView mThumbImageView;
|
||||
private final TextView mPreviewTextView;
|
||||
@@ -117,7 +114,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
};
|
||||
|
||||
private ConversationFastScroller(RecyclerView rv, int position) {
|
||||
mContext = rv.getContext();
|
||||
final Context context = rv.getContext();
|
||||
mRv = rv;
|
||||
mRv.addOnLayoutChangeListener(this);
|
||||
mRv.addOnScrollListener(this);
|
||||
@@ -131,7 +128,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
mPosRight = (position == POSITION_RIGHT_SIDE);
|
||||
|
||||
// Cache the dimensions we'll need during layout
|
||||
final Resources res = mContext.getResources();
|
||||
final Resources res = context.getResources();
|
||||
mTrackWidth = res.getDimensionPixelSize(R.dimen.fastscroll_track_width);
|
||||
mThumbHeight = res.getDimensionPixelSize(R.dimen.fastscroll_thumb_height);
|
||||
mPreviewHeight = res.getDimensionPixelSize(R.dimen.fastscroll_preview_height);
|
||||
@@ -141,7 +138,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
R.dimen.fastscroll_preview_margin_left_right);
|
||||
mTouchSlop = res.getDimensionPixelOffset(R.dimen.fastscroll_touch_slop);
|
||||
|
||||
final LayoutInflater inflator = LayoutInflater.from(mContext);
|
||||
final LayoutInflater inflator = LayoutInflater.from(context);
|
||||
mTrackImageView = (ImageView) inflator.inflate(R.layout.fastscroll_track, null);
|
||||
mThumbImageView = (ImageView) inflator.inflate(R.layout.fastscroll_thumb, null);
|
||||
mPreviewTextView = (TextView) inflator.inflate(R.layout.fastscroll_preview, null);
|
||||
@@ -149,10 +146,10 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
refreshConversationThemeColor();
|
||||
|
||||
// Add the fast scroll views to the overlay, so they are rendered above the list
|
||||
mOverlay = rv.getOverlay();
|
||||
mOverlay.add(mTrackImageView);
|
||||
mOverlay.add(mThumbImageView);
|
||||
mOverlay.add(mPreviewTextView);
|
||||
final ViewGroupOverlay overlay = rv.getOverlay();
|
||||
overlay.add(mTrackImageView);
|
||||
overlay.add(mThumbImageView);
|
||||
overlay.add(mPreviewTextView);
|
||||
|
||||
hide(false /* animate */);
|
||||
mPreviewTextView.setAlpha(0f);
|
||||
|
||||
@@ -177,8 +177,8 @@ public class ConversationInputManager implements ConversationInput.ConversationI
|
||||
}
|
||||
|
||||
public boolean onNavigationUpPressed() {
|
||||
for (int i = 0; i < mInputs.length; i++) {
|
||||
if (mInputs[i].onNavigationUpPressed()) {
|
||||
for (ConversationInput input : mInputs) {
|
||||
if (input.onNavigationUpPressed()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -209,8 +209,8 @@ public class ConversationInputManager implements ConversationInput.ConversationI
|
||||
|
||||
public void hideAllInputs(final boolean animate) {
|
||||
beginUpdate();
|
||||
for (int i = 0; i < mInputs.length; i++) {
|
||||
showHideInternal(mInputs[i], false, animate);
|
||||
for (ConversationInput input : mInputs) {
|
||||
showHideInternal(input, false, animate);
|
||||
}
|
||||
endUpdate();
|
||||
}
|
||||
@@ -225,9 +225,9 @@ public class ConversationInputManager implements ConversationInput.ConversationI
|
||||
}
|
||||
|
||||
public boolean updateActionBar(final ActionBar actionBar) {
|
||||
for (int i = 0; i < mInputs.length; i++) {
|
||||
if (mInputs[i].mShowing) {
|
||||
return mInputs[i].updateActionBar(actionBar);
|
||||
for (ConversationInput input : mInputs) {
|
||||
if (input.mShowing) {
|
||||
return input.updateActionBar(actionBar);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -271,8 +271,7 @@ public class ConversationInputManager implements ConversationInput.ConversationI
|
||||
// All inputs are mutually exclusive. Showing one will hide everything else.
|
||||
// The one exception, is that the keyboard and location media chooser can be open at the
|
||||
// time to enable searching within that chooser
|
||||
for (int i = 0; i < mInputs.length; i++) {
|
||||
final ConversationInput currInput = mInputs[i];
|
||||
for (final ConversationInput currInput : mInputs) {
|
||||
if (currInput != target) {
|
||||
// TODO : If there's more exceptions we will want to make this more
|
||||
// generic
|
||||
|
||||
@@ -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.
|
||||
@@ -23,15 +24,11 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.ui.AsyncImageView;
|
||||
import com.android.messaging.ui.CursorRecyclerAdapter;
|
||||
import com.android.messaging.ui.AsyncImageView.AsyncImageViewDelayLoader;
|
||||
import com.android.messaging.ui.conversation.ConversationMessageView.ConversationMessageViewHost;
|
||||
import com.android.messaging.util.Assert;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides an interface to expose Conversation Message Cursor data to a UI widget like a
|
||||
* RecyclerView.
|
||||
|
||||
@@ -73,7 +73,6 @@ import com.android.messaging.util.UiUtils;
|
||||
import com.android.messaging.util.YouTubeUtil;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -238,8 +237,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
* @param cursor The cursor from a MessageList that this view is in, pointing to its entry.
|
||||
* @param oneOnOne Whether this is a 1:1 conversation
|
||||
*/
|
||||
public void bind(final Cursor cursor,
|
||||
final boolean oneOnOne, final String selectedMessageId) {
|
||||
public void bind(final Cursor cursor, final boolean oneOnOne, final String selectedMessageId) {
|
||||
mOneOnOne = oneOnOne;
|
||||
|
||||
// Update our UI model
|
||||
@@ -494,7 +492,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
// Bind image attachments. If there are multiple, they are shown in a collage view.
|
||||
final List<MessagePartData> imageParts = mData.getAttachments(sImageFilter);
|
||||
if (imageParts.size() > 1) {
|
||||
Collections.sort(imageParts, sImageComparator);
|
||||
imageParts.sort(sImageComparator);
|
||||
mMultiAttachmentView.bindAttachments(imageParts, null, imageParts.size());
|
||||
mMultiAttachmentView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.android.messaging.datamodel.data.SubscriptionListData;
|
||||
import com.android.messaging.datamodel.data.SubscriptionListData.SubscriptionListEntry;
|
||||
import com.android.messaging.ui.conversation.SimSelectorView.SimSelectorViewListener;
|
||||
import com.android.messaging.util.AccessibilityUtil;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ThreadUtil;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -17,15 +18,12 @@ package com.android.messaging.ui.conversation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Outline;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
import com.android.messaging.ui.ContactIconView;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.AvatarUriUtil;
|
||||
|
||||
/**
|
||||
* Shows SIM avatar icon in the SIM switcher / Self-send button.
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.android.messaging.ui.contact.AddContactsConfirmationDialog;
|
||||
import com.android.messaging.ui.conversationlist.ConversationListFragment.ConversationListFragmentHost;
|
||||
import com.android.messaging.ui.conversationlist.MultiSelectActionModeCallback.SelectedConversation;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.Trace;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -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.
|
||||
@@ -24,7 +25,6 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.ui.CursorRecyclerAdapter;
|
||||
import com.android.messaging.ui.conversationlist.ConversationListItemView.HostInterface;
|
||||
|
||||
/**
|
||||
* Provides an interface to expose Conversation List Cursor data to a UI widget like a ListView.
|
||||
|
||||
@@ -33,7 +33,6 @@ import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.ViewGroupCompat;
|
||||
@@ -312,7 +311,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
||||
// It is recommended for the Floating Action button functionality to be duplicated as a
|
||||
// menu
|
||||
AccessibilityManager accessibilityManager = (AccessibilityManager)
|
||||
getActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
requireActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
startNewConversationMenuItem.setVisible(accessibilityManager
|
||||
.isTouchExplorationEnabled());
|
||||
}
|
||||
@@ -397,7 +396,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
||||
R.integer.fab_animation_duration_ms));
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator dismissFab() {
|
||||
public void dismissFab() {
|
||||
// To prevent clicking while animating.
|
||||
mStartNewConversationButton.setEnabled(false);
|
||||
final MarginLayoutParams lp =
|
||||
@@ -405,11 +404,11 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
||||
final float fabWidthWithLeftRightMargin = mStartNewConversationButton.getWidth()
|
||||
+ lp.leftMargin + lp.rightMargin;
|
||||
final int direction = AccessibilityUtil.isLayoutRtl(mStartNewConversationButton) ? -1 : 1;
|
||||
return getNormalizedFabAnimator().translationX(direction * fabWidthWithLeftRightMargin);
|
||||
getNormalizedFabAnimator().translationX(direction * fabWidthWithLeftRightMargin);
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator showFab() {
|
||||
return getNormalizedFabAnimator().translationX(0).withEndAction(() -> {
|
||||
public void showFab() {
|
||||
getNormalizedFabAnimator().translationX(0).withEndAction(() -> {
|
||||
// Re-enable clicks after the animation.
|
||||
mStartNewConversationButton.setEnabled(true);
|
||||
});
|
||||
|
||||
@@ -24,8 +24,6 @@ import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import androidx.core.text.BidiFormatter;
|
||||
import androidx.core.text.TextDirectionHeuristicsCompat;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
@@ -39,6 +37,8 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.text.BidiFormatter;
|
||||
import androidx.core.text.TextDirectionHeuristicsCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
@@ -61,6 +61,7 @@ import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.Typefaces;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
import com.android.messaging.util.UriUtil;
|
||||
|
||||
import org.lineageos.messaging.util.PrefsUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -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.
|
||||
@@ -30,7 +31,6 @@ import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.datamodel.data.PersonItemData;
|
||||
import com.android.messaging.ui.CursorRecyclerAdapter;
|
||||
import com.android.messaging.ui.PersonItemView;
|
||||
import com.android.messaging.ui.PersonItemView.PersonItemViewListener;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -50,10 +49,9 @@ import com.android.messaging.datamodel.data.PeopleOptionsItemData;
|
||||
import com.android.messaging.datamodel.data.PersonItemData;
|
||||
import com.android.messaging.ui.CompositeAdapter;
|
||||
import com.android.messaging.ui.PersonItemView;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.ui.conversation.ConversationActivity;
|
||||
import com.android.messaging.util.NotificationsUtil;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.NotificationsUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.messaging.ui.conversationsettings;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -238,7 +238,7 @@ public class AudioRecordView extends FrameLayout implements
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean onRecordButtonTouchDown() {
|
||||
void onRecordButtonTouchDown() {
|
||||
if (!mMediaRecorder.isRecording() && mCurrentMode == MODE_IDLE) {
|
||||
setMode(MODE_STARTING);
|
||||
playAudioStartSound(() -> {
|
||||
@@ -253,9 +253,7 @@ public class AudioRecordView extends FrameLayout implements
|
||||
}
|
||||
});
|
||||
mAudioRecordStartTimeMillis = System.currentTimeMillis();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -38,7 +38,6 @@ import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.messaging.datamodel.data.DraftMessageData.DraftMessageSubscriptionDataProvider;
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.datamodel.media.ImageRequest;
|
||||
import com.android.messaging.sms.MmsConfig;
|
||||
|
||||
@@ -27,10 +27,11 @@ import android.widget.ImageButton;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.binding.ImmutableBindingRef;
|
||||
import com.android.messaging.datamodel.data.MediaPickerData;
|
||||
import com.android.messaging.datamodel.data.DraftMessageData.DraftMessageSubscriptionDataProvider;
|
||||
import com.android.messaging.datamodel.data.MediaPickerData;
|
||||
import com.android.messaging.ui.BasePagerViewHolder;
|
||||
import com.android.messaging.util.Assert;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package com.android.messaging.ui.mediapicker;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -188,8 +187,8 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
|
||||
private boolean mAnimateOnAttach;
|
||||
|
||||
@Override
|
||||
public void onAttach (final Activity activity) {
|
||||
super.onAttach(activity);
|
||||
public void onAttach(@NonNull final Context context) {
|
||||
super.onAttach(context);
|
||||
mIsAttached = true;
|
||||
if (mStartingMediaTypeOnAttach != MEDA_TYPE_INVALID) {
|
||||
// open() was previously called. Do the pending open now.
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.widget.LinearLayout;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.ui.PagingAwareViewPager;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -545,7 +545,7 @@ public class FocusOverlayManager {
|
||||
}
|
||||
|
||||
public static boolean isSupported(String value, List<String> supported) {
|
||||
return supported != null && supported.indexOf(value) >= 0;
|
||||
return supported != null && supported.contains(value);
|
||||
}
|
||||
|
||||
public static boolean isMeteringAreaSupported(Parameters params) {
|
||||
|
||||
@@ -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.
|
||||
@@ -18,6 +19,7 @@ package com.android.messaging.ui.photoviewer;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimatedImageDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.loader.content.Loader;
|
||||
|
||||
import com.android.ex.photo.PhotoViewCallbacks;
|
||||
|
||||
@@ -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.
|
||||
@@ -17,8 +18,6 @@ package com.android.messaging.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import androidx.core.view.accessibility.AccessibilityEventCompat;
|
||||
import androidx.core.view.accessibility.AccessibilityRecordCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
@@ -69,10 +68,7 @@ public class AccessibilityUtil {
|
||||
event.setEnabled(view.isEnabled());
|
||||
event.setClassName(view.getClass().getName());
|
||||
event.setPackageName(context.getPackageName());
|
||||
|
||||
// JellyBean MR1 requires a source view to set the window ID.
|
||||
final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
|
||||
record.setSource(view);
|
||||
event.setSource(view);
|
||||
|
||||
// Sends the event directly through the accessibility manager. If we only supported SDK 14+
|
||||
// we could have done:
|
||||
|
||||
@@ -19,16 +19,12 @@ package com.android.messaging.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.UserManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.DataModel;
|
||||
import com.android.messaging.ui.conversation.ConversationActivity;
|
||||
import com.android.messaging.ui.conversationlist.ConversationListActivity;
|
||||
|
||||
/**
|
||||
* Utility class including logic to verify requirements to run Bugle and other activity startup
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ChangeDefaultSmsAppHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private class ChangeSmsAppSettingRunnable implements Runnable {
|
||||
private static class ChangeSmsAppSettingRunnable implements Runnable {
|
||||
private final Activity mActivity;
|
||||
|
||||
public ChangeSmsAppSettingRunnable(final Activity activity) {
|
||||
|
||||
@@ -22,8 +22,6 @@ import android.telephony.PhoneStateListener;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
|
||||
/**
|
||||
* ConnectivityUtil listens to the network service state changes.
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.messaging.util;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract;
|
||||
@@ -35,7 +34,6 @@ import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.ex.chips.RecipientEntry;
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.CursorQueryData;
|
||||
import com.android.messaging.datamodel.FrequentContactsCursorQueryData;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
|
||||
@@ -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.
|
||||
@@ -21,7 +22,7 @@ import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Utility class to make it easy to store multiple conversation id strings in a single string
|
||||
* with delimeters.
|
||||
* with delimiters.
|
||||
*/
|
||||
public class ConversationIdSet extends HashSet<String> {
|
||||
private static final String JOIN_DELIMITER = "|";
|
||||
|
||||
@@ -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.
|
||||
@@ -26,8 +27,8 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
@@ -18,16 +18,12 @@
|
||||
package com.android.messaging.util;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.messaging.sms.MmsUtils;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class DebugUtils {
|
||||
@@ -54,7 +50,6 @@ public class DebugUtils {
|
||||
byte[] data = null;
|
||||
try {
|
||||
final File inputFile = getDebugFile(dumpFileName, false);
|
||||
if (inputFile != null) {
|
||||
final FileInputStream fis = new FileInputStream(inputFile);
|
||||
try (BufferedInputStream bis = new BufferedInputStream(fis)) {
|
||||
// dump file
|
||||
@@ -63,7 +58,6 @@ public class DebugUtils {
|
||||
LogUtil.e(LogUtil.BUGLE_TAG, "receiveFromDumpFile: empty data");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
LogUtil.e(LogUtil.BUGLE_TAG, "receiveFromDumpFile: " + e, e);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public final class EmailAddress {
|
||||
}
|
||||
|
||||
// check if the host contains two continuous dots.
|
||||
if (host.indexOf("..") >= 0) {
|
||||
if (host.contains("..")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public final class EmailAddress {
|
||||
}
|
||||
|
||||
// the user cannot contain two continuous dots
|
||||
if (user.indexOf("..") >= 0) {
|
||||
if (user.contains("..")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@ import android.graphics.Shader.TileMode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.datamodel.MediaScratchFileProvider;
|
||||
import com.android.messaging.datamodel.MessagingContentProvider;
|
||||
|
||||
@@ -31,6 +31,7 @@ import androidx.annotation.NonNull;
|
||||
import com.android.messaging.Factory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This class is provides the same interface and functionality as android.media.AsyncPlayer
|
||||
@@ -257,11 +258,7 @@ public class NotificationPlayer implements OnCompletionListener {
|
||||
* @param tag a string to use for debugging
|
||||
*/
|
||||
public NotificationPlayer(final String tag) {
|
||||
if (tag != null) {
|
||||
mTag = tag;
|
||||
} else {
|
||||
mTag = "NotificationPlayer";
|
||||
}
|
||||
mTag = Objects.requireNonNullElse(tag, "NotificationPlayer");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -50,6 +51,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This class abstracts away platform dependency of calling telephony related
|
||||
@@ -356,10 +358,7 @@ public class PhoneUtils {
|
||||
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
|
||||
final List<SubscriptionInfo> subscriptionInfos =
|
||||
mSubscriptionManager.getActiveSubscriptionInfoList();
|
||||
if (subscriptionInfos != null) {
|
||||
return subscriptionInfos;
|
||||
}
|
||||
return EMPTY_SUBSCRIPTION_LIST;
|
||||
return Objects.requireNonNullElse(subscriptionInfos, EMPTY_SUBSCRIPTION_LIST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1222,10 +1222,10 @@ public class ExifInterface {
|
||||
*/
|
||||
public Long getTagLongValue(int tagId, int ifdId) {
|
||||
long[] l = getTagLongValues(tagId, ifdId);
|
||||
if (l == null || l.length <= 0) {
|
||||
if (l == null || l.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return new Long(l[0]);
|
||||
return l[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1241,10 +1241,10 @@ public class ExifInterface {
|
||||
*/
|
||||
public Integer getTagIntValue(int tagId, int ifdId) {
|
||||
int[] l = getTagIntValues(tagId, ifdId);
|
||||
if (l == null || l.length <= 0) {
|
||||
if (l == null || l.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return new Integer(l[0]);
|
||||
return l[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1260,10 +1260,10 @@ public class ExifInterface {
|
||||
*/
|
||||
public Byte getTagByteValue(int tagId, int ifdId) {
|
||||
byte[] l = getTagByteValues(tagId, ifdId);
|
||||
if (l == null || l.length <= 0) {
|
||||
if (l == null || l.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return new Byte(l[0]);
|
||||
return l[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,8 +45,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds);
|
||||
|
||||
for (int i = 0; i < appWidgetIds.length; ++i) {
|
||||
updateWidget(context, appWidgetIds[i]);
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateWidget(context, appWidgetId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ import com.android.messaging.datamodel.media.MediaResourceManager;
|
||||
import com.android.messaging.datamodel.media.MessagePartImageRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.MessagePartVideoThumbnailRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.UriImageRequestDescriptor;
|
||||
import com.android.messaging.datamodel.media.VideoThumbnailRequest;
|
||||
import com.android.messaging.sms.MmsUtils;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.util.AvatarUriUtil;
|
||||
|
||||
Reference in New Issue
Block a user