Messaging: We don't need to check for verbose logging everywhere

We can just do this in the actual method

Change-Id: I80e89b0ab97926749851628b1bd34e8cd9dc82f2
This commit is contained in:
Michael W
2025-05-18 09:18:48 +00:00
parent 8613b6bcc8
commit c4bbba9441
39 changed files with 293 additions and 547 deletions
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* Copyright (C) 2024-2025 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.
@@ -161,9 +161,7 @@ public class ApnDatabase extends SQLiteOpenHelper {
* Load APN table from app resources
*/
private static void loadApnTable(final SQLiteDatabase db) {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "ApnDatabase loadApnTable");
}
LogUtil.v(TAG, "ApnDatabase loadApnTable");
final Resources r = sContext.getResources();
final XmlResourceParser parser = r.getXml(R.xml.apns);
final ApnsXmlProcessor processor = ApnsXmlProcessor.get(parser);
+10 -24
View File
@@ -469,12 +469,10 @@ public class MmsUtils {
return 0;
}
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addPicturePart size: " + imageSize + " width: "
+ width + " widthLimit: " + widthLimit
+ " height: " + height
+ " heightLimit: " + heightLimit);
}
LogUtil.v(TAG, "addPicturePart size: " + imageSize + " width: "
+ width + " widthLimit: " + widthLimit
+ " height: " + height
+ " heightLimit: " + heightLimit);
PduPart part;
// Check if we're already within the limits - in which case we don't need to resize.
@@ -487,9 +485,7 @@ public class MmsUtils {
height <= heightLimit &&
(orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED ||
orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_NORMAL)) {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addPicturePart - already sized");
}
LogUtil.v(TAG, "addPicturePart - already sized");
part = new PduPart();
part.setDataUri(imageUri);
part.setContentType(contentType.getBytes());
@@ -508,9 +504,7 @@ public class MmsUtils {
pb.addPart(index, part);
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addPicturePart size: " + imageSize);
}
LogUtil.v(TAG, "addPicturePart size: " + imageSize);
return imageSize;
}
@@ -538,9 +532,7 @@ public class MmsUtils {
addPartForUri(context, pb, srcName, vcardUri, contentType);
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addVCardPart size: " + vcardSize);
}
LogUtil.v(TAG, "addVCardPart size: " + vcardSize);
return vcardSize;
}
@@ -554,9 +546,7 @@ public class MmsUtils {
final Uri attachmentUri = messagePart.getContentUri();
String contentType = messagePart.getContentType();
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addPart attachmentUrl: " + attachmentUri.toString());
}
LogUtil.v(TAG, "addPart attachmentUrl: " + attachmentUri.toString());
if (TextUtils.isEmpty(contentType)) {
contentType = ContentType.VIDEO_3G2;
@@ -571,9 +561,7 @@ public class MmsUtils {
final Uri attachmentUri = messagePart.getContentUri();
final String contentType = messagePart.getContentType();
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addPart attachmentUrl: " + attachmentUri.toString());
}
LogUtil.v(TAG, "addPart attachmentUrl: " + attachmentUri.toString());
final int dataSize = (int) getMediaFileSize(attachmentUri);
@@ -671,9 +659,7 @@ public class MmsUtils {
final byte[] data = ImageResizer.getResizedImageData(width, height, orientation,
widthLimit, heightLimit, byteLimit, imageUri, context, contentType);
if (data == null) {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "Resize image failed.");
}
LogUtil.v(TAG, "Resize image failed.");
return null;
}
+10 -16
View File
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* Copyright (C) 2024-2025 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.
@@ -148,10 +148,8 @@ public class SmsSender {
UiUtils.showToastAtBottom(getSendErrorToastMessage(context, subId, errorCode));
}
} else {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "SmsSender: received sent result. " + " requestId=" + requestId
+ " partId=" + partId + " resultCode=" + resultCode);
}
LogUtil.v(TAG, "SmsSender: received sent result. " + " requestId=" + requestId
+ " partId=" + partId + " resultCode=" + resultCode);
}
if (requestId != null) {
final SendResult result = sPendingMessageMap.get(requestId);
@@ -183,13 +181,11 @@ public class SmsSender {
public static SendResult sendMessage(final Context context, final int subId, String dest,
String message, final String serviceCenter, final boolean requireDeliveryReport,
final Uri messageUri) throws Exception {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "SmsSender: sending message. " +
"dest=" + dest + " message=" + message +
" serviceCenter=" + serviceCenter +
" requireDeliveryReport=" + requireDeliveryReport +
" requestId=" + messageUri);
}
LogUtil.v(TAG, "SmsSender: sending message. " +
"dest=" + dest + " message=" + message +
" serviceCenter=" + serviceCenter +
" requireDeliveryReport=" + requireDeliveryReport +
" requestId=" + messageUri);
if (TextUtils.isEmpty(message)) {
throw new Exception("SmsSender: empty text message");
}
@@ -242,10 +238,8 @@ public class SmsSender {
}
// Either we timed out or have all the results (success or failure)
sPendingMessageMap.remove(messageUri);
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "SmsSender: sending completed. " +
"dest=" + dest + " message=" + message + " result=" + pendingResult);
}
LogUtil.v(TAG, "SmsSender: sending completed. " +
"dest=" + dest + " message=" + message + " result=" + pendingResult);
return pendingResult;
}