diff --git a/src/com/android/messaging/datamodel/BugleDatabaseOperations.java b/src/com/android/messaging/datamodel/BugleDatabaseOperations.java index ca0f557..5188d76 100644 --- a/src/com/android/messaging/datamodel/BugleDatabaseOperations.java +++ b/src/com/android/messaging/datamodel/BugleDatabaseOperations.java @@ -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. @@ -1433,10 +1433,8 @@ public class BugleDatabaseOperations { cursor.close(); } } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, - "Updated draft message " + messageId + " for conversation " + conversationId); - } + LogUtil.v(TAG, "Updated draft message " + messageId + " for conversation " + + conversationId); return messageId; } @@ -1692,9 +1690,7 @@ public class BugleDatabaseOperations { } MessagingContentProvider.notifyConversationListChanged(); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Number of conversations refreshed:" + conversationIds.size()); - } + LogUtil.v(TAG, "Number of conversations refreshed:" + conversationIds.size()); } } diff --git a/src/com/android/messaging/datamodel/BugleNotifications.java b/src/com/android/messaging/datamodel/BugleNotifications.java index bbac006..76b530d 100644 --- a/src/com/android/messaging/datamodel/BugleNotifications.java +++ b/src/com/android/messaging/datamodel/BugleNotifications.java @@ -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,11 +161,9 @@ public class BugleNotifications { */ public static void update(final boolean silent, final String conversationId, final int coverage) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Update: silent = " + silent - + " conversationId = " + conversationId - + " coverage = " + coverage); - } + LogUtil.v(TAG, "Update: silent = " + silent + + " conversationId = " + conversationId + + " coverage = " + coverage); Assert.isNotMainThread(); checkInitialized(); if ((coverage & UPDATE_MESSAGES) != 0) { @@ -219,9 +217,7 @@ public class BugleNotifications { final NotificationState notifState = iter.next(); if (notifState.mType == type) { notifState.mCanceled = true; - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Canceling pending notification"); - } + LogUtil.v(TAG, "Canceling pending notification"); iter.remove(); } } @@ -369,11 +365,9 @@ public class BugleNotifications { // conversation list), then play a notification beep at a low volume and don't display an // actual notification. if (softSound) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "processAndSend: fromConversationId == " + - "sCurrentlyDisplayedConversationId so NOT showing notification," + - " but playing soft sound. conversationId: " + conversationId); - } + LogUtil.v(TAG, "processAndSend: fromConversationId == " + + "sCurrentlyDisplayedConversationId so NOT showing notification," + + " but playing soft sound. conversationId: " + conversationId); playObservableConversationNotificationSound(conversationId); return; } @@ -708,17 +702,12 @@ public class BugleNotifications { private static void fireOffNotification(final NotificationState notificationState, final Bitmap attachmentBitmap, final Bitmap avatarBitmap, Bitmap avatarHiResBitmap) { if (notificationState.mCanceled) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Firing off notification, but notification already canceled"); - } + LogUtil.v(TAG, "Firing off notification, but notification already canceled"); return; } final Context context = Factory.get().getApplicationContext(); - - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "MMS picture loaded, bitmap: " + attachmentBitmap); - } + LogUtil.v(TAG, "MMS picture loaded, bitmap: " + attachmentBitmap); final NotificationCompat.Builder notifBuilder = notificationState.mNotificationBuilder; notifBuilder.setStyle(notificationState.mNotificationStyle); @@ -759,9 +748,7 @@ public class BugleNotifications { private static void setWearableGroupOptions(final NotificationCompat.Builder notifBuilder, final NotificationState notificationState) { final String groupKey = "groupkey"; - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Group key (for wearables)=" + groupKey); - } + LogUtil.v(TAG, "Group key (for wearables)=" + groupKey); if (notificationState instanceof MultiConversationNotificationState) { notifBuilder.setGroup(groupKey).setGroupSummary(true); } else if (notificationState instanceof BundledMessageNotificationState) { diff --git a/src/com/android/messaging/datamodel/MessageNotificationState.java b/src/com/android/messaging/datamodel/MessageNotificationState.java index f217ee5..18bcea2 100644 --- a/src/com/android/messaging/datamodel/MessageNotificationState.java +++ b/src/com/android/messaging/datamodel/MessageNotificationState.java @@ -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. @@ -817,9 +817,7 @@ public abstract class MessageNotificationState extends NotificationState { null); if (convMessageCursor != null && convMessageCursor.moveToFirst()) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "MessageNotificationState: Found unseen message notifications."); - } + LogUtil.v(TAG, "MessageNotificationState: Found unseen message notifications."); final ConversationMessageData convMessageData = new ConversationMessageData(); @@ -1021,9 +1019,7 @@ public abstract class MessageNotificationState extends NotificationState { final ConversationInfoList convList = createConversationInfoList(); if (convList == null || convList.mConvInfos.size() == 0) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "MessageNotificationState: No unseen notifications"); - } + LogUtil.v(TAG, "MessageNotificationState: No unseen notifications"); } else { final ConversationLineInfo convInfo = convList.mConvInfos.get(0); state = new MultiMessageNotificationState(convList); @@ -1049,7 +1045,7 @@ public abstract class MessageNotificationState extends NotificationState { } } } - if (state != null && LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { + if (state != null) { LogUtil.v(TAG, "MessageNotificationState: Notification state created" + ", title = " + (state.mTickerSender != null ? state.mTickerSender : state.mTitle) diff --git a/src/com/android/messaging/datamodel/NoConfirmationSmsSendService.java b/src/com/android/messaging/datamodel/NoConfirmationSmsSendService.java index 718f9b4..2e34b5f 100644 --- a/src/com/android/messaging/datamodel/NoConfirmationSmsSendService.java +++ b/src/com/android/messaging/datamodel/NoConfirmationSmsSendService.java @@ -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. @@ -53,23 +53,16 @@ public class NoConfirmationSmsSendService extends IntentService { @Override protected void onHandleIntent(final Intent intent) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "NoConfirmationSmsSendService onHandleIntent"); - } + LogUtil.v(TAG, "NoConfirmationSmsSendService onHandleIntent"); final String action = intent.getAction(); if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(action)) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "NoConfirmationSmsSendService onHandleIntent wrong action: " + - action); - } + LogUtil.v(TAG, "NoConfirmationSmsSendService onHandleIntent wrong action: " + action); return; } final Bundle extras = intent.getExtras(); if (extras == null) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Called to send SMS but no extras"); - } + LogUtil.v(TAG, "Called to send SMS but no extras"); return; } @@ -87,9 +80,7 @@ public class NoConfirmationSmsSendService extends IntentService { final String recipients = UriUtil.parseRecipientsFromSmsMmsUri(intent.getData()); if (TextUtils.isEmpty(recipients) && TextUtils.isEmpty(conversationId)) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Both conversationId and recipient(s) cannot be empty"); - } + LogUtil.v(TAG, "Both conversationId and recipient(s) cannot be empty"); return; } @@ -97,9 +88,7 @@ public class NoConfirmationSmsSendService extends IntentService { startActivity(new Intent(this, ConversationListActivity.class)); } else { if (TextUtils.isEmpty(message)) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Message cannot be empty"); - } + LogUtil.v(TAG, "Message cannot be empty"); return; } @@ -111,17 +100,13 @@ public class NoConfirmationSmsSendService extends IntentService { } else { MessageData messageData; if (requiresMms) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Auto-sending MMS message in conversation: " + - conversationId); - } + LogUtil.v(TAG, "Auto-sending MMS message in conversation: " + + conversationId); messageData = MessageData.createDraftMmsMessage(conversationId, selfId, message, subject); } else { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Auto-sending SMS message in conversation: " + - conversationId); - } + LogUtil.v(TAG, "Auto-sending SMS message in conversation: " + + conversationId); messageData = MessageData.createDraftSmsMessage(conversationId, selfId, message); } diff --git a/src/com/android/messaging/datamodel/ParticipantRefresh.java b/src/com/android/messaging/datamodel/ParticipantRefresh.java index 4be83fd..901e2c4 100644 --- a/src/com/android/messaging/datamodel/ParticipantRefresh.java +++ b/src/com/android/messaging/datamodel/ParticipantRefresh.java @@ -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. @@ -115,9 +115,7 @@ public class ParticipantRefresh { @Override public void onChange(final boolean selfChange) { super.onChange(selfChange); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Contacts changed"); - } + LogUtil.v(TAG, "Contacts changed"); mContactChanged = true; } @@ -143,11 +141,9 @@ public class ParticipantRefresh { public static void refreshParticipantsIfNeeded() { if (ParticipantRefresh.getNeedFullRefresh() && sFullRefreshScheduled.compareAndSet(false, true)) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Started full participant refresh"); - } + LogUtil.v(TAG, "Started full participant refresh"); Executors.newSingleThreadExecutor().execute(sFullRefreshRunnable); - } else if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { + } else { LogUtil.v(TAG, "Skipped full participant refresh"); } } @@ -200,24 +196,20 @@ public class ParticipantRefresh { */ static void refreshParticipants(final int refreshMode) { Assert.inRange(refreshMode, REFRESH_MODE_FULL, REFRESH_MODE_SELF_ONLY); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - switch (refreshMode) { - case REFRESH_MODE_FULL: - LogUtil.v(TAG, "Start full participant refresh"); - break; - case REFRESH_MODE_INCREMENTAL: - LogUtil.v(TAG, "Start partial participant refresh"); - break; - case REFRESH_MODE_SELF_ONLY: - LogUtil.v(TAG, "Start self participant refresh"); - break; - } + switch (refreshMode) { + case REFRESH_MODE_FULL: + LogUtil.v(TAG, "Start full participant refresh"); + break; + case REFRESH_MODE_INCREMENTAL: + LogUtil.v(TAG, "Start partial participant refresh"); + break; + case REFRESH_MODE_SELF_ONLY: + LogUtil.v(TAG, "Start self participant refresh"); + break; } if (!ContactUtil.hasReadContactsPermission() || !OsUtil.hasPhonePermission()) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Skipping participant referesh because of permissions"); - } + LogUtil.v(TAG, "Skipping participant referesh because of permissions"); return; } @@ -281,9 +273,7 @@ public class ParticipantRefresh { } } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "Number of participants refreshed:" + changedParticipants.size()); - } + LogUtil.v(TAG, "Number of participants refreshed:" + changedParticipants.size()); // Refresh conversations for participants that are changed. if (changedParticipants.size() > 0) { diff --git a/src/com/android/messaging/datamodel/SyncManager.java b/src/com/android/messaging/datamodel/SyncManager.java index b8245fe..37b5bae 100644 --- a/src/com/android/messaging/datamodel/SyncManager.java +++ b/src/com/android/messaging/datamodel/SyncManager.java @@ -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. @@ -167,10 +167,8 @@ public class SyncManager { * @return - true if sync should start */ public synchronized boolean shouldSync(final boolean full, final long startTimestamp) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncManager: Checking shouldSync " + (full ? "full " : "") - + "at " + startTimestamp); - } + LogUtil.v(TAG, "SyncManager: Checking shouldSync " + (full ? "full " : "") + + "at " + startTimestamp); if (full) { final long delayUntilFullSync = delayUntilFullSync(startTimestamp); @@ -342,11 +340,9 @@ public class SyncManager { @Override public void onChange(final boolean selfChange, final Uri uri) { // Handle change. - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncManager: Sms/Mms DB changed @" + System.currentTimeMillis() - + " for " + (uri == null ? "" : uri.toString()) + " " - + mSyncOnChanges + "/" + mNotifyOnChanges); - } + LogUtil.v(TAG, "SyncManager: Sms/Mms DB changed @" + System.currentTimeMillis() + + " for " + (uri == null ? "" : uri.toString()) + " " + + mSyncOnChanges + "/" + mNotifyOnChanges); if (mSyncOnChanges) { // If sync is already running this will do nothing - but at end of each sync diff --git a/src/com/android/messaging/datamodel/action/ActionMonitor.java b/src/com/android/messaging/datamodel/action/ActionMonitor.java index ff83d10..379ff77 100644 --- a/src/com/android/messaging/datamodel/action/ActionMonitor.java +++ b/src/com/android/messaging/datamodel/action/ActionMonitor.java @@ -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. @@ -273,13 +273,11 @@ public class ActionMonitor { monitor.updateState(action, expectedOldState, newState); newMonitorState = monitor.mState; } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", - Locale.getDefault()); - df.setTimeZone(TimeZone.getTimeZone("UTC")); - LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date()) - + "UTC State = " + oldMonitorState + " - " + newMonitorState); - } + final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", + Locale.getDefault()); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date()) + + "UTC State = " + oldMonitorState + " - " + newMonitorState); } /** @@ -342,13 +340,11 @@ public class ActionMonitor { monitor.complete(action, expectedOldState, result, succeeded); unregisterActionMonitorIfComplete(action.actionKey, monitor); } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", - Locale.getDefault()); - df.setTimeZone(TimeZone.getTimeZone("UTC")); - LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date()) - + "UTC State = " + oldMonitorState + " - " + STATE_COMPLETE); - } + final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", + Locale.getDefault()); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date()) + + "UTC State = " + oldMonitorState + " - " + STATE_COMPLETE); } /** @@ -401,13 +397,11 @@ public class ActionMonitor { oldMonitorState = monitor.mState; monitor.executed(action, expectedOldState, hasBackgroundActions, result); } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", - Locale.getDefault()); - df.setTimeZone(TimeZone.getTimeZone("UTC")); - LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date()) - + "UTC State = " + oldMonitorState + " - EXECUTED"); - } + final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", + Locale.getDefault()); + df.setTimeZone(TimeZone.getTimeZone("UTC")); + LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date()) + + "UTC State = " + oldMonitorState + " - EXECUTED"); } /** diff --git a/src/com/android/messaging/datamodel/action/ActionServiceImpl.java b/src/com/android/messaging/datamodel/action/ActionServiceImpl.java index e021033..1dced72 100644 --- a/src/com/android/messaging/datamodel/action/ActionServiceImpl.java +++ b/src/com/android/messaging/datamodel/action/ActionServiceImpl.java @@ -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. @@ -38,7 +38,6 @@ import com.android.messaging.util.LoggingTimer; */ public class ActionServiceImpl extends JobIntentService { private static final String TAG = LogUtil.BUGLE_DATAMODEL_TAG; - private static final boolean VERBOSE = false; /** * Unique job ID for this service. diff --git a/src/com/android/messaging/datamodel/action/BackgroundWorkerService.java b/src/com/android/messaging/datamodel/action/BackgroundWorkerService.java index a97521f..6d306d4 100644 --- a/src/com/android/messaging/datamodel/action/BackgroundWorkerService.java +++ b/src/com/android/messaging/datamodel/action/BackgroundWorkerService.java @@ -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. @@ -39,7 +39,6 @@ import java.util.List; */ public class BackgroundWorkerService extends JobIntentService { private static final String TAG = LogUtil.BUGLE_DATAMODEL_TAG; - private static final boolean VERBOSE = false; /** * Unique job ID for this service. diff --git a/src/com/android/messaging/datamodel/action/InsertNewMessageAction.java b/src/com/android/messaging/datamodel/action/InsertNewMessageAction.java index 00b9658..754b58c 100644 --- a/src/com/android/messaging/datamodel/action/InsertNewMessageAction.java +++ b/src/com/android/messaging/datamodel/action/InsertNewMessageAction.java @@ -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. @@ -290,10 +290,8 @@ public class InsertNewMessageAction extends Action implements Parcelable { private void insertBroadcastSmsMessage(final String conversationId, final MessageData message, final int subId, final long laterTimestamp, final ArrayList recipients) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "InsertNewMessageAction: Inserting broadcast SMS message " - + message.getMessageId()); - } + LogUtil.v(TAG, "InsertNewMessageAction: Inserting broadcast SMS message " + + message.getMessageId()); final Context context = Factory.get().getApplicationContext(); final DatabaseWrapper db = DataModel.get().getDatabase(); diff --git a/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java b/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java index 26c56e0..e6dbefe 100644 --- a/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java +++ b/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java @@ -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. @@ -222,10 +222,8 @@ public class ProcessDownloadedMmsAction extends Action { // Send a response indicating that auto-download failed if (sendDeferredRespStatus) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "DownloadMmsAction: Auto-download of message " + messageId - + " failed; sending DEFERRED NotifyRespInd"); - } + LogUtil.v(TAG, "DownloadMmsAction: Auto-download of message " + messageId + + " failed; sending DEFERRED NotifyRespInd"); MmsUtils.sendNotifyResponseForMmsDownload( context, subId, diff --git a/src/com/android/messaging/datamodel/action/ProcessPendingMessagesAction.java b/src/com/android/messaging/datamodel/action/ProcessPendingMessagesAction.java index d58a60f..c387558 100644 --- a/src/com/android/messaging/datamodel/action/ProcessPendingMessagesAction.java +++ b/src/com/android/messaging/datamodel/action/ProcessPendingMessagesAction.java @@ -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. @@ -90,12 +90,10 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable { // return true. final ProcessPendingMessagesAction action = new ProcessPendingMessagesAction(); if (action.queueActions(processingAction)) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - if (processingAction.hasBackgroundActions()) { - LogUtil.v(TAG, "ProcessPendingMessagesAction: Action queued"); - } else { - LogUtil.v(TAG, "ProcessPendingMessagesAction: No actions to queue"); - } + if (processingAction.hasBackgroundActions()) { + LogUtil.v(TAG, "ProcessPendingMessagesAction: Action queued"); + } else { + LogUtil.v(TAG, "ProcessPendingMessagesAction: No actions to queue"); } // Have queued next action if needed, nothing more to do return; @@ -175,10 +173,8 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable { final ProcessPendingMessagesAction action = new ProcessPendingMessagesAction(); action.schedule(PENDING_INTENT_BASE_REQUEST_CODE + subId, Long.MAX_VALUE); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "ProcessPendingMessagesAction: Unregistering for connectivity changed " - + "events and clearing scheduled alarm for subId " + subId); - } + LogUtil.v(TAG, "ProcessPendingMessagesAction: Unregistering for connectivity changed " + + "events and clearing scheduled alarm for subId " + subId); } private static void setRetry(final int retryAttempt, int subId) { @@ -293,9 +289,7 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable { scheduleProcessPendingMessagesAction(true /* failed */, this); } } else { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "ProcessPendingMessagesAction: Not default SMS app; rescheduling"); - } + LogUtil.v(TAG, "ProcessPendingMessagesAction: Not default SMS app; rescheduling"); scheduleProcessPendingMessagesAction(true /* failed */, this); } diff --git a/src/com/android/messaging/datamodel/action/ProcessSentMessageAction.java b/src/com/android/messaging/datamodel/action/ProcessSentMessageAction.java index df3e20a..e8d6d21 100644 --- a/src/com/android/messaging/datamodel/action/ProcessSentMessageAction.java +++ b/src/com/android/messaging/datamodel/action/ProcessSentMessageAction.java @@ -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 ProcessSentMessageAction extends Action { if (tempFile.exists()) { messageSize = tempFile.length(); tempFile.delete(); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "ProcessSentMessageAction: Deleted temp file with outgoing " - + "MMS pdu: " + contentUri); - } + LogUtil.v(TAG, "ProcessSentMessageAction: Deleted temp file with outgoing " + + "MMS pdu: " + contentUri); } final int resultCode = actionParameters.getInt(KEY_RESULT_CODE); @@ -194,10 +192,8 @@ public class ProcessSentMessageAction extends Action { messageId, updatedMessageUri, status, rawStatus, isSms, this, subId, resultCode, httpStatusCode); } else { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "ProcessSentMessageAction: No sent message to process (it was " - + "probably a notify response for an MMS download)"); - } + LogUtil.v(TAG, "ProcessSentMessageAction: No sent message to process (it was " + + "probably a notify response for an MMS download)"); } return null; } diff --git a/src/com/android/messaging/datamodel/action/SendMessageAction.java b/src/com/android/messaging/datamodel/action/SendMessageAction.java index ffac134..e6e1129 100644 --- a/src/com/android/messaging/datamodel/action/SendMessageAction.java +++ b/src/com/android/messaging/datamodel/action/SendMessageAction.java @@ -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. @@ -235,11 +235,9 @@ public class SendMessageAction extends Action implements Parcelable { // To prevent Sync seeing inconsistent state must write to DB on this thread updateMessageUri(messageId, updatedMessageUri); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SendMessageAction: Updated message " + messageId - + " with new uri " + messageUri); - } - } + LogUtil.v(TAG, "SendMessageAction: Updated message " + messageId + + " with new uri " + messageUri); + } } if (messageUri != null) { // Actually send the MMS @@ -378,11 +376,9 @@ public class SendMessageAction extends Action implements Parcelable { } } if (updatedTelephony) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS") - + " message " + message.getMessageId() - + " in telephony (" + message.getSmsMessageUri() + ")"); - } + LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS") + + " message " + message.getMessageId() + + " in telephony (" + message.getSmsMessageUri() + ")"); } else { LogUtil.w(TAG, "SendMessageAction: Failed to update " + (isSms ? "SMS" : "MMS") + " message " + message.getMessageId() @@ -414,11 +410,9 @@ public class SendMessageAction extends Action implements Parcelable { values); } db.setTransactionSuccessful(); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS") - + " message " + message.getMessageId() + " in local db. Timestamp = " - + message.getReceivedTimeStamp()); - } + LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS") + + " message " + message.getMessageId() + " in local db. Timestamp = " + + message.getReceivedTimeStamp()); } finally { db.endTransaction(); } diff --git a/src/com/android/messaging/datamodel/action/SyncCursorPair.java b/src/com/android/messaging/datamodel/action/SyncCursorPair.java index d9bf0b3..f4136ed 100644 --- a/src/com/android/messaging/datamodel/action/SyncCursorPair.java +++ b/src/com/android/messaging/datamodel/action/SyncCursorPair.java @@ -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. @@ -375,10 +375,8 @@ class SyncCursorPair { throws SQLiteException { mDatabase = database; try { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncCursorPair: Querying for local messages; selection = " - + selection); - } + LogUtil.v(TAG, "SyncCursorPair: Querying for local messages; selection = " + + selection); mCursor = mDatabase.query( DatabaseHelper.MESSAGES_TABLE, LocalMessageQuery.PROJECTION, @@ -440,10 +438,8 @@ class SyncCursorPair { mMmsCursor = null; try { final Context context = Factory.get().getApplicationContext(); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncCursorPair: Querying for remote SMS; selection = " - + smsSelection); - } + LogUtil.v(TAG, "SyncCursorPair: Querying for remote SMS; selection = " + + smsSelection); mSmsCursor = SqliteWrapper.query( context, context.getContentResolver(), @@ -457,10 +453,8 @@ class SyncCursorPair { + "need to cancel sync"); throw new RuntimeException("Null cursor from remote SMS query"); } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncCursorPair: Querying for remote MMS; selection = " - + mmsSelection); - } + LogUtil.v(TAG, "SyncCursorPair: Querying for remote MMS; selection = " + + mmsSelection); mMmsCursor = SqliteWrapper.query( context, context.getContentResolver(), diff --git a/src/com/android/messaging/datamodel/action/SyncMessageBatch.java b/src/com/android/messaging/datamodel/action/SyncMessageBatch.java index a9880f2..cc94451 100644 --- a/src/com/android/messaging/datamodel/action/SyncMessageBatch.java +++ b/src/com/android/messaging/datamodel/action/SyncMessageBatch.java @@ -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. @@ -98,11 +98,9 @@ class SyncMessageBatch { messageListToIds(mMessagesToDelete)); for (final LocalDatabaseMessage message : mMessagesToDelete) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncMessageBatch: Deleted message " + message.getLocalId() - + " for SMS/MMS " + message.getUri() + " with timestamp " - + message.getTimestampInMillis()); - } + LogUtil.v(TAG, "SyncMessageBatch: Deleted message " + message.getLocalId() + + " for SMS/MMS " + message.getUri() + " with timestamp " + + message.getTimestampInMillis()); } // Update conversation state for imported messages, like snippet, @@ -185,11 +183,9 @@ class SyncMessageBatch { conversationId, selfId, participantId); } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId() - + " for SMS " + message.getSmsMessageUri() + " received at " - + message.getReceivedTimeStamp()); - } + LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId() + + " for SMS " + message.getSmsMessageUri() + " received at " + + message.getReceivedTimeStamp()); // Keep track of updated conversation for later updating the conversation snippet, etc. mConversationsToUpdate.add(conversationId); @@ -273,11 +269,9 @@ class SyncMessageBatch { conversationId, selfId, participantId); } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId() - + " for MMS " + message.getSmsMessageUri() + " received at " - + message.getReceivedTimeStamp()); - } + LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId() + + " for MMS " + message.getSmsMessageUri() + " received at " + + message.getReceivedTimeStamp()); // Keep track of updated conversation for later updating the conversation snippet, etc. mConversationsToUpdate.add(conversationId); diff --git a/src/com/android/messaging/datamodel/media/MediaCache.java b/src/com/android/messaging/datamodel/media/MediaCache.java index 510da2d..7019d26 100644 --- a/src/com/android/messaging/datamodel/media/MediaCache.java +++ b/src/com/android/messaging/datamodel/media/MediaCache.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 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. @@ -68,13 +69,11 @@ public class MediaCache extends LruCache { final long timeSinceLastRef = SystemClock.elapsedRealtime() - imageToUse.getLastRefAddTimestamp(); if (timeSinceLastRef < MIN_TIME_IN_POOL) { - if (LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "Not reusing reusing " + - "first available bitmap from the pool because it " + - "has not been in the pool long enough. " + - "timeSinceLastRef=" + timeSinceLastRef); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "Not reusing reusing " + + "first available bitmap from the pool because it " + + "has not been in the pool long enough. " + + "timeSinceLastRef=" + timeSinceLastRef); // Put back the image and return no reuseable bitmap. images.addLast(imageToUse); return null; diff --git a/src/com/android/messaging/receiver/NotificationReceiver.java b/src/com/android/messaging/receiver/NotificationReceiver.java index bbb847d..52866b2 100644 --- a/src/com/android/messaging/receiver/NotificationReceiver.java +++ b/src/com/android/messaging/receiver/NotificationReceiver.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 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. @@ -31,13 +32,10 @@ import com.android.messaging.util.LogUtil; public class NotificationReceiver extends BroadcastReceiver { // Logging public static final String TAG = LogUtil.BUGLE_TAG; - public static final boolean VERBOSE = false; @Override public void onReceive(final Context context, final Intent intent) { - if (VERBOSE) { - LogUtil.v(TAG, "NotificationReceiver.onReceive: intent " + intent); - } + LogUtil.v(TAG, "NotificationReceiver.onReceive: intent " + intent); if (intent.getAction().equals(UIIntents.ACTION_RESET_NOTIFICATIONS)) { final String conversationIdSetString = intent.getStringExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID_SET); @@ -54,4 +52,4 @@ public class NotificationReceiver extends BroadcastReceiver { } } } -} \ No newline at end of file +} diff --git a/src/com/android/messaging/receiver/SmsReceiver.java b/src/com/android/messaging/receiver/SmsReceiver.java index cbf8588..f86c0d9 100644 --- a/src/com/android/messaging/receiver/SmsReceiver.java +++ b/src/com/android/messaging/receiver/SmsReceiver.java @@ -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. @@ -75,26 +75,19 @@ public final class SmsReceiver extends BroadcastReceiver { boolean smsReceiverEnabled = OsUtil.isSecondaryUser(); final PackageManager packageManager = context.getPackageManager(); - final boolean logv = LogUtil.isLoggable(TAG, LogUtil.VERBOSE); if (smsReceiverEnabled) { - if (logv) { - LogUtil.v(TAG, "Enabling SMS message receiving"); - } + LogUtil.v(TAG, "Enabling SMS message receiving"); packageManager.setComponentEnabledSetting( new ComponentName(context, SmsReceiver.class), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); } else { - if (logv) { - LogUtil.v(TAG, "Disabling SMS message receiving"); - } + LogUtil.v(TAG, "Disabling SMS message receiving"); packageManager.setComponentEnabledSetting( new ComponentName(context, SmsReceiver.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } - if (logv) { - LogUtil.v(TAG, "Enabling respond via message intent"); - } + LogUtil.v(TAG, "Enabling respond via message intent"); packageManager.setComponentEnabledSetting( new ComponentName(context, NoConfirmationSmsSendService.class), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); diff --git a/src/com/android/messaging/sms/ApnDatabase.java b/src/com/android/messaging/sms/ApnDatabase.java index 4cfc61f..9bcb8f2 100644 --- a/src/com/android/messaging/sms/ApnDatabase.java +++ b/src/com/android/messaging/sms/ApnDatabase.java @@ -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); diff --git a/src/com/android/messaging/sms/MmsUtils.java b/src/com/android/messaging/sms/MmsUtils.java index 53521c9..5702a7c 100644 --- a/src/com/android/messaging/sms/MmsUtils.java +++ b/src/com/android/messaging/sms/MmsUtils.java @@ -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; } diff --git a/src/com/android/messaging/sms/SmsSender.java b/src/com/android/messaging/sms/SmsSender.java index 4d737aa..3657e0d 100644 --- a/src/com/android/messaging/sms/SmsSender.java +++ b/src/com/android/messaging/sms/SmsSender.java @@ -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; } diff --git a/src/com/android/messaging/ui/AsyncImageView.java b/src/com/android/messaging/ui/AsyncImageView.java index 64d1c6a..db721b7 100644 --- a/src/com/android/messaging/ui/AsyncImageView.java +++ b/src/com/android/messaging/ui/AsyncImageView.java @@ -210,14 +210,12 @@ public class AsyncImageView extends AppCompatImageView implements } } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - if (mImageResource instanceof GifImageResource) { - LogUtil.v(TAG, "setImage size unknown -- it's a GIF"); - } else { - LogUtil.v(TAG, "setImage size: " + mImageResource.getMediaSize() + - " width: " + mImageResource.getBitmap().getWidth() + - " heigh: " + mImageResource.getBitmap().getHeight()); - } + if (mImageResource instanceof GifImageResource) { + LogUtil.v(TAG, "setImage size unknown -- it's a GIF"); + } else { + LogUtil.v(TAG, "setImage size: " + mImageResource.getMediaSize() + + " width: " + mImageResource.getBitmap().getWidth() + + " heigh: " + mImageResource.getBitmap().getHeight()); } } invalidate(); diff --git a/src/com/android/messaging/ui/BugleActionBarActivity.java b/src/com/android/messaging/ui/BugleActionBarActivity.java index 981a73c..98d1ad5 100644 --- a/src/com/android/messaging/ui/BugleActionBarActivity.java +++ b/src/com/android/messaging/ui/BugleActionBarActivity.java @@ -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. @@ -69,9 +69,7 @@ public class BugleActionBarActivity extends AppCompatActivity implements ImeUtil } mLastScreenHeight = getResources().getDisplayMetrics().heightPixels; - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onCreate"); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onCreate"); getWindow().setStatusBarColor(getResources().getColor(R.color.action_bar_background_color, getTheme())); @@ -80,42 +78,32 @@ public class BugleActionBarActivity extends AppCompatActivity implements ImeUtil @Override protected void onStart() { super.onStart(); - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onStart"); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onStart"); } @Override protected void onRestart() { super.onRestart(); - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onRestart"); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onRestart"); } @Override protected void onResume() { super.onResume(); - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onResume"); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onResume"); BugleActivityUtil.onActivityResume(this, BugleActionBarActivity.this); } @Override protected void onPause() { super.onPause(); - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onPause"); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onPause"); } @Override protected void onStop() { super.onStop(); - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onStop"); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onStop"); } private boolean mDestroyed; @@ -151,11 +139,9 @@ public class BugleActionBarActivity extends AppCompatActivity implements ImeUtil final boolean imeWasOpen = mImeOpen; mImeOpen = screenHeight - height > 100; - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onDisplayHeightChanged " + - "imeWasOpen: " + imeWasOpen + " mImeOpen: " + mImeOpen + " screenHeight: " + - screenHeight + " height: " + height); - } + LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onDisplayHeightChanged " + + "imeWasOpen: " + imeWasOpen + " mImeOpen: " + mImeOpen + " screenHeight: " + + screenHeight + " height: " + height); if (imeWasOpen != mImeOpen) { for (final ImeUtil.ImeStateObserver observer : mImeStateObservers) { diff --git a/src/com/android/messaging/ui/ImeDetectFrameLayout.java b/src/com/android/messaging/ui/ImeDetectFrameLayout.java index 32564ea..8ece5db 100644 --- a/src/com/android/messaging/ui/ImeDetectFrameLayout.java +++ b/src/com/android/messaging/ui/ImeDetectFrameLayout.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 The Android Open Source Project + * Copyright (C) 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. @@ -33,11 +34,9 @@ public class ImeDetectFrameLayout extends FrameLayout { final int measuredHeight = getMeasuredHeight(); super.onMeasure(widthMeasureSpec, heightMeasureSpec); - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, "ImeDetectFrameLayout " + - "measuredHeight: " + measuredHeight + " getMeasuredHeight(): " + - getMeasuredHeight()); - } + LogUtil.v(LogUtil.BUGLE_TAG, "ImeDetectFrameLayout " + + "measuredHeight: " + measuredHeight + " getMeasuredHeight(): " + + getMeasuredHeight()); if (measuredHeight != getMeasuredHeight() && getContext() instanceof ImeUtil.ImeStateHost) { ((ImeUtil.ImeStateHost) getContext()).onDisplayHeightChanged(heightMeasureSpec); diff --git a/src/com/android/messaging/ui/conversation/ConversationFragment.java b/src/com/android/messaging/ui/conversation/ConversationFragment.java index bde0e02..52075d3 100644 --- a/src/com/android/messaging/ui/conversation/ConversationFragment.java +++ b/src/com/android/messaging/ui/conversation/ConversationFragment.java @@ -901,11 +901,9 @@ public class ConversationFragment extends Fragment implements ConversationDataLi // Are we coming from a widget click where we're told to scroll to a particular item? final int scrollToPos = getScrollToMessagePosition(); if (scrollToPos >= 0) { - if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) { - LogUtil.v(LogUtil.BUGLE_TAG, "onConversationMessagesCursorUpdated " + - " scrollToPos: " + scrollToPos + - " cursorCount: " + cursor.getCount()); - } + LogUtil.v(LogUtil.BUGLE_TAG, "onConversationMessagesCursorUpdated " + + " scrollToPos: " + scrollToPos + + " cursorCount: " + cursor.getCount()); scrollToPosition(scrollToPos, true /*smoothScroll*/); clearScrollToMessagePosition(); } diff --git a/src/com/android/messaging/ui/conversationlist/ConversationListFragment.java b/src/com/android/messaging/ui/conversationlist/ConversationListFragment.java index bea8166..abc2f36 100644 --- a/src/com/android/messaging/ui/conversationlist/ConversationListFragment.java +++ b/src/com/android/messaging/ui/conversationlist/ConversationListFragment.java @@ -68,7 +68,6 @@ public class ConversationListFragment extends Fragment implements ConversationLi ConversationListItemView.HostInterface { private static final String BUNDLE_ARCHIVED_MODE = "archived_mode"; private static final String BUNDLE_FORWARD_MESSAGE_MODE = "forward_message_mode"; - private static final boolean VERBOSE = false; private MenuItem mShowBlockedMenuItem; private boolean mArchiveMode; @@ -241,9 +240,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi @Override public void onAttach(@NonNull final Context context) { super.onAttach(context); - if (VERBOSE) { - LogUtil.v(LogUtil.BUGLE_TAG, "Attaching List"); - } + LogUtil.v(LogUtil.BUGLE_TAG, "Attaching List"); final Bundle arguments = getArguments(); if (arguments != null) { mArchiveMode = arguments.getBoolean(BUNDLE_ARCHIVED_MODE, false); diff --git a/src/com/android/messaging/util/ImageUtils.java b/src/com/android/messaging/util/ImageUtils.java index 6ffb5e8..278bad9 100644 --- a/src/com/android/messaging/util/ImageUtils.java +++ b/src/com/android/messaging/util/ImageUtils.java @@ -577,8 +577,6 @@ public class ImageUtils { * @return whether the image can be down subsampled */ private boolean canBeCompressed() { - final boolean logv = LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE); - int imageHeight = mHeight; int imageWidth = mWidth; @@ -611,13 +609,11 @@ public class ImageUtils { Assert.fail("Image cannot be resized"); // http://b/18926934 return false; } - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "computeInitialSampleSize: Increasing sampleSize to " + sampleSize - + " as h=" + imageHeight + " vs " + heightLimitWithSlop - + " w=" + imageWidth + " vs " + widthLimitWithSlop - + " p=" + imageHeight * imageWidth + " vs " + pixelLimit); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "computeInitialSampleSize: Increasing sampleSize to " + sampleSize + + " as h=" + imageHeight + " vs " + heightLimitWithSlop + + " w=" + imageWidth + " vs " + widthLimitWithSlop + + " p=" + imageHeight * imageWidth + " vs " + pixelLimit); imageHeight = mHeight / sampleSize; imageWidth = mWidth / sampleSize; fits = (imageHeight < heightLimitWithSlop && @@ -625,13 +621,11 @@ public class ImageUtils { imageHeight * imageWidth < pixelLimit); } - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "computeInitialSampleSize: Initial sampleSize " + sampleSize - + " for h=" + imageHeight + " vs " + heightLimitWithSlop - + " w=" + imageWidth + " vs " + widthLimitWithSlop - + " p=" + imageHeight * imageWidth + " vs " + pixelLimit); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "computeInitialSampleSize: Initial sampleSize " + sampleSize + + " for h=" + imageHeight + " vs " + heightLimitWithSlop + + " w=" + imageWidth + " vs " + widthLimitWithSlop + + " p=" + imageHeight * imageWidth + " vs " + pixelLimit); mSampleSize = sampleSize; return true; @@ -646,12 +640,9 @@ public class ImageUtils { byte[] encoded = null; try { final ContentResolver cr = mContext.getContentResolver(); - final boolean logv = LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE); - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: attempt=" + attempt - + " limit (w=" + mWidthLimit + " h=" + mHeightLimit + ") quality=" - + mQuality + " scale=" + mScaleFactor + " sampleSize=" + mSampleSize); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: attempt=" + attempt + + " limit (w=" + mWidthLimit + " h=" + mHeightLimit + ") quality=" + + mQuality + " scale=" + mScaleFactor + " sampleSize=" + mSampleSize); if (mScaled == null) { if (mDecoded == null) { mOptions.inSampleSize = mSampleSize; @@ -661,17 +652,13 @@ public class ImageUtils { // Ignore } if (mDecoded == null) { - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "getResizedImageData: got empty decoded bitmap"); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "getResizedImageData: got empty decoded bitmap"); return null; } } - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: decoded w,h=" - + mDecoded.getWidth() + "," + mDecoded.getHeight()); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: decoded w,h=" + + mDecoded.getWidth() + "," + mDecoded.getHeight()); // Make sure to scale the decoded image if dimension is not within limit final int decodedWidth = mDecoded.getWidth(); final int decodedHeight = mDecoded.getHeight(); @@ -693,23 +680,19 @@ public class ImageUtils { mScaled = Bitmap.createBitmap(mDecoded, 0, 0, decodedWidth, decodedHeight, mMatrix, false /* filter */); if (mScaled == null) { - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "getResizedImageData: got empty scaled bitmap"); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "getResizedImageData: got empty scaled bitmap"); return null; } - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: scaled w,h=" - + mScaled.getWidth() + "," + mScaled.getHeight()); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: scaled w,h=" + + mScaled.getWidth() + "," + mScaled.getHeight()); } else { mScaled = mDecoded; } } // Now encode it at current quality encoded = ImageUtils.bitmapToBytes(mScaled, mQuality); - if (encoded != null && logv) { + if (encoded != null) { LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: Encoded down to " + encoded.length + "@" + mScaled.getWidth() + "/" + mScaled.getHeight() + "~" @@ -729,7 +712,6 @@ public class ImageUtils { * @param currentSize encoded image size (will be 0 if OOM) */ private void updateRecodeParameters(final int currentSize) { - final boolean logv = LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE); // Only return data within the limit if (currentSize > 0 && mQuality > MINIMUM_IMAGE_COMPRESSION_QUALITY) { @@ -738,10 +720,8 @@ public class ImageUtils { mQuality = Math.max(MINIMUM_IMAGE_COMPRESSION_QUALITY, Math.min((int) (mQuality * Math.sqrt((1.0 * mByteLimit) / currentSize)), (int) (mQuality * QUALITY_SCALE_DOWN_RATIO))); - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "getResizedImageData: Retrying at quality " + mQuality); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "getResizedImageData: Retrying at quality " + mQuality); } else if (currentSize > 0 && mScaleFactor < 2.0 * MIN_SCALE_DOWN_RATIO * MIN_SCALE_DOWN_RATIO) { // JPEG compression failed to hit target size - need smaller image @@ -751,10 +731,8 @@ public class ImageUtils { // 2.0 / MIN_SCALE_DOWN_RATIO (arbitrary limit) mQuality = IMAGE_COMPRESSION_QUALITY; mScaleFactor = mScaleFactor / MIN_SCALE_DOWN_RATIO; - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "getResizedImageData: Retrying at scale " + mScaleFactor); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "getResizedImageData: Retrying at scale " + mScaleFactor); // Release scaled bitmap to trigger rescaling if (mScaled != null && mScaled != mDecoded) { mScaled.recycle(); @@ -764,19 +742,15 @@ public class ImageUtils { // Then before we subsample try cleaning up our cached memory Factory.get().reclaimMemory(); mHasReclaimedMemory = true; - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "getResizedImageData: Retrying after reclaiming memory "); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, + "getResizedImageData: Retrying after reclaiming memory "); } else { // Last resort - subsample image by another factor of 2 and try again mSampleSize = mSampleSize * 2; mQuality = IMAGE_COMPRESSION_QUALITY; mScaleFactor = 1.0f; - if (logv) { - LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, - "getResizedImageData: Retrying at sampleSize " + mSampleSize); - } + LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: Retrying at sampleSize " + + mSampleSize); // Release all bitmaps to trigger subsampling if (mScaled != null && mScaled != mDecoded) { mScaled.recycle(); diff --git a/src/com/android/messaging/util/LogUtil.java b/src/com/android/messaging/util/LogUtil.java index 9db8f4f..e0871ed 100644 --- a/src/com/android/messaging/util/LogUtil.java +++ b/src/com/android/messaging/util/LogUtil.java @@ -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. @@ -17,6 +17,8 @@ package com.android.messaging.util; +import android.util.Log; + /** * Log utility class. */ @@ -43,7 +45,9 @@ public class LogUtil { * @param msg The message you would like logged. */ public static void v(final String tag, final String msg) { - println(android.util.Log.VERBOSE, tag, msg); + if (isLoggable(tag, VERBOSE)) { + println(VERBOSE, tag, msg); + } } /** @@ -54,8 +58,7 @@ public class LogUtil { * @param tr An exception to log */ public static void v(final String tag, final String msg, final Throwable tr) { - println(android.util.Log.VERBOSE, tag, msg + '\n' - + android.util.Log.getStackTraceString(tr)); + println(VERBOSE, tag, msg + '\n' + Log.getStackTraceString(tr)); } /** @@ -65,7 +68,7 @@ public class LogUtil { * @param msg The message you would like logged. */ public static void d(final String tag, final String msg) { - println(android.util.Log.DEBUG, tag, msg); + println(DEBUG, tag, msg); } /** @@ -76,8 +79,7 @@ public class LogUtil { * @param tr An exception to log */ public static void d(final String tag, final String msg, final Throwable tr) { - println(android.util.Log.DEBUG, tag, msg + '\n' - + android.util.Log.getStackTraceString(tr)); + println(DEBUG, tag, msg + '\n' + Log.getStackTraceString(tr)); } /** @@ -87,7 +89,7 @@ public class LogUtil { * @param msg The message you would like logged. */ public static void i(final String tag, final String msg) { - println(android.util.Log.INFO, tag, msg); + println(INFO, tag, msg); } /** @@ -98,8 +100,7 @@ public class LogUtil { * @param tr An exception to log */ public static void i(final String tag, final String msg, final Throwable tr) { - println(android.util.Log.INFO, tag, msg + '\n' - + android.util.Log.getStackTraceString(tr)); + println(INFO, tag, msg + '\n' + Log.getStackTraceString(tr)); } /** @@ -109,7 +110,7 @@ public class LogUtil { * @param msg The message you would like logged. */ public static void w(final String tag, final String msg) { - println(android.util.Log.WARN, tag, msg); + println(WARN, tag, msg); } /** @@ -120,8 +121,8 @@ public class LogUtil { * @param tr An exception to log */ public static void w(final String tag, final String msg, final Throwable tr) { - println(android.util.Log.WARN, tag, msg); - println(android.util.Log.WARN, tag, android.util.Log.getStackTraceString(tr)); + println(WARN, tag, msg); + println(WARN, tag, android.util.Log.getStackTraceString(tr)); } /** @@ -131,7 +132,7 @@ public class LogUtil { * @param msg The message you would like logged. */ public static void e(final String tag, final String msg) { - println(android.util.Log.ERROR, tag, msg); + println(ERROR, tag, msg); } /** @@ -142,8 +143,8 @@ public class LogUtil { * @param tr An exception to log */ public static void e(final String tag, final String msg, final Throwable tr) { - println(android.util.Log.ERROR, tag, msg); - println(android.util.Log.ERROR, tag, android.util.Log.getStackTraceString(tr)); + println(ERROR, tag, msg); + println(ERROR, tag, Log.getStackTraceString(tr)); } /** @@ -158,7 +159,7 @@ public class LogUtil { public static void wtf(final String tag, final String msg) { // Make sure this goes into our log buffer println(android.util.Log.ASSERT, tag, "wtf\n" + msg); - android.util.Log.wtf(tag, msg, new Exception()); + wtf(tag, msg, new Exception()); } /** @@ -174,8 +175,8 @@ public class LogUtil { public static void wtf(final String tag, final String msg, final Throwable tr) { // Make sure this goes into our log buffer println(android.util.Log.ASSERT, tag, "wtf\n" + msg + '\n' + - android.util.Log.getStackTraceString(tr)); - android.util.Log.wtf(tag, msg, tr); + Log.getStackTraceString(tr)); + Log.wtf(tag, msg, tr); } /** @@ -186,7 +187,7 @@ public class LogUtil { * @param msg The message you would like logged. */ private static void println(final int level, final String tag, final String msg) { - android.util.Log.println(level, tag, msg); + Log.println(level, tag, msg); } /** @@ -194,7 +195,7 @@ public class LogUtil { * See {@link android.util.Log#isLoggable(String, int)} for more discussion. */ public static boolean isLoggable(final String tag, final int level) { - return android.util.Log.isLoggable(tag, level); + return Log.isLoggable(tag, level); } /** @@ -207,7 +208,7 @@ public class LogUtil { return null; } - if (android.util.Log.isLoggable(BUGLE_TAG, android.util.Log.DEBUG)) { + if (Log.isLoggable(BUGLE_TAG, DEBUG)) { return text; } else { return "Redacted-" + text.length(); diff --git a/src/com/android/messaging/util/LoggingTimer.java b/src/com/android/messaging/util/LoggingTimer.java index efa8950..1425a2b 100644 --- a/src/com/android/messaging/util/LoggingTimer.java +++ b/src/com/android/messaging/util/LoggingTimer.java @@ -47,10 +47,7 @@ public class LoggingTimer { */ public void start() { mStartMillis = SystemClock.elapsedRealtime(); - - if (LogUtil.isLoggable(mTag, LogUtil.VERBOSE)) { - LogUtil.v(mTag, "Timer start for " + mName); - } + LogUtil.v(mTag, "Timer start for " + mName); } /** @@ -65,7 +62,7 @@ public class LoggingTimer { if (mWarnLimitMillis != NO_WARN_LIMIT && elapsedMs > mWarnLimitMillis) { LogUtil.w(mTag, logMessage); - } else if (LogUtil.isLoggable(mTag, LogUtil.VERBOSE)) { + } else { LogUtil.v(mTag, logMessage); } } diff --git a/src/com/android/messaging/util/Trace.java b/src/com/android/messaging/util/Trace.java index 14b4d12..476ab36 100644 --- a/src/com/android/messaging/util/Trace.java +++ b/src/com/android/messaging/util/Trace.java @@ -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. @@ -54,9 +54,7 @@ public final class Trace { * most 127 Unicode code units long. */ public static void beginSection(String sectionName) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "beginSection() " + sectionName); - } + LogUtil.v(TAG, "beginSection() " + sectionName); sTrace.beginSection(sectionName); } @@ -69,9 +67,7 @@ public final class Trace { */ public static void endSection() { sTrace.endSection(); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "endSection()"); - } + LogUtil.v(TAG, "endSection()"); } /** diff --git a/src/com/android/messaging/widget/BaseWidgetFactory.java b/src/com/android/messaging/widget/BaseWidgetFactory.java index 1929b43..5807498 100644 --- a/src/com/android/messaging/widget/BaseWidgetFactory.java +++ b/src/com/android/messaging/widget/BaseWidgetFactory.java @@ -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. @@ -67,9 +67,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor mAppWidgetId = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); mAppWidgetManager = AppWidgetManager.getInstance(context); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BaseWidgetFactory intent: " + intent + "widget id: " + mAppWidgetId); - } + LogUtil.v(TAG, "BaseWidgetFactory intent: " + intent + "widget id: " + mAppWidgetId); mIconSize = (int) context.getResources() .getDimension(R.dimen.contact_icon_view_normal_size); @@ -77,16 +75,12 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor @Override public void onCreate() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onCreate"); - } + LogUtil.v(TAG, "onCreate"); } @Override public void onDestroy() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onDestroy"); - } + LogUtil.v(TAG, "onDestroy"); synchronized (sWidgetLock) { if (mCursor != null && !mCursor.isClosed()) { mCursor.close(); @@ -97,9 +91,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor @Override public void onDataSetChanged() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onDataSetChanged"); - } + LogUtil.v(TAG, "onDataSetChanged"); synchronized (sWidgetLock) { if (mCursor != null) { mCursor.close(); @@ -126,15 +118,11 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor public int getCount() { synchronized (sWidgetLock) { if (mCursor == null) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getCount: 0"); - } + LogUtil.v(TAG, "getCount: 0"); return 0; } final int count = getItemCount(); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getCount: " + count); - } + LogUtil.v(TAG, "getCount: " + count); mShouldShowViewMore = count < mCursor.getCount(); return count + (mShouldShowViewMore ? 1 : 0); } @@ -146,9 +134,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor * in the list. */ protected int getItemCount() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getItemCount: " + mCursor.getCount()); - } + LogUtil.v(TAG, "getItemCount: " + mCursor.getCount()); return Math.min(mCursor.getCount(), MAX_ITEMS_TO_SHOW); } @@ -205,9 +191,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor } private void onLoadComplete() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onLoadComplete"); - } + LogUtil.v(TAG, "onLoadComplete"); final RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(), getMainLayoutId()); mAppWidgetManager.partiallyUpdateAppWidget(mAppWidgetId, remoteViews); diff --git a/src/com/android/messaging/widget/BaseWidgetProvider.java b/src/com/android/messaging/widget/BaseWidgetProvider.java index 267978f..49086ed 100644 --- a/src/com/android/messaging/widget/BaseWidgetProvider.java +++ b/src/com/android/messaging/widget/BaseWidgetProvider.java @@ -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. @@ -52,9 +52,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { @Override public void onReceive(Context context, Intent intent) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onReceive intent: " + intent + " for " + this.getClass()); - } + LogUtil.v(TAG, "onReceive intent: " + intent + " for " + this.getClass()); final String action = intent.getAction(); // The base class AppWidgetProvider's onReceive handles the normal widget intents. Here @@ -68,10 +66,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { if (appWidgetIds.length > 0) { // We need to update all Bugle app widgets on the home screen. - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onReceive notifyAppWidgetViewDataChanged listId: " + - getListId() + " first widgetId: " + appWidgetIds[0]); - } + LogUtil.v(TAG, "onReceive notifyAppWidgetViewDataChanged listId: " + + getListId() + " first widgetId: " + appWidgetIds[0]); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, getListId()); } } else { @@ -95,9 +91,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { protected abstract void updateWidget(Context context, int appWidgetId); private int getWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize"); - } + LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize"); // Get the dimensions final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId); @@ -110,10 +104,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { final int rows = getCellsForSize(minHeight); final int columns = getCellsForSize(minWidth); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize row: " + rows - + " columns: " + columns); - } + LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize row: " + rows + + " columns: " + columns); int size = SIZE_MEDIUM; if (rows == 1) { @@ -132,10 +124,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { // The size changed. We have to force the widget to rebuild the list. appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, getListId()); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize old size: " + savedSize - + " new size saved: " + size); - } + LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize old size: " + savedSize + + " new size saved: " + size); } return size; @@ -159,11 +149,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { int appWidgetId, Bundle newOptions) { final int widgetSize = getWidgetSize(appWidgetManager, appWidgetId); - - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BaseWidgetProvider.onAppWidgetOptionsChanged new size: " + - widgetSize); - } + LogUtil.v(TAG, "BaseWidgetProvider.onAppWidgetOptionsChanged new size: " + + widgetSize); super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions); } @@ -177,10 +164,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider { @Override public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); - - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BaseWidgetProvider.onDeleted"); - } + LogUtil.v(TAG, "BaseWidgetProvider.onDeleted"); for (final int widgetId : appWidgetIds) { deletePreferences(widgetId); diff --git a/src/com/android/messaging/widget/BugleWidgetProvider.java b/src/com/android/messaging/widget/BugleWidgetProvider.java index 34cf351..b2b52bd 100644 --- a/src/com/android/messaging/widget/BugleWidgetProvider.java +++ b/src/com/android/messaging/widget/BugleWidgetProvider.java @@ -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. @@ -62,9 +62,7 @@ public class BugleWidgetProvider extends BaseWidgetProvider { } public static void rebuildWidget(final Context context, final int appWidgetId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BugleWidgetProvider.rebuildWidget appWidgetId: " + appWidgetId); - } + LogUtil.v(TAG, "BugleWidgetProvider.rebuildWidget appWidgetId: " + appWidgetId); final RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_conversation_list); PendingIntent clickIntent; @@ -102,9 +100,7 @@ public class BugleWidgetProvider extends BaseWidgetProvider { * update and reflect the changes */ public static void notifyConversationListChanged(final Context context) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "notifyConversationListChanged"); - } + LogUtil.v(TAG, "notifyConversationListChanged"); final Intent intent = new Intent(ACTION_NOTIFY_CONVERSATIONS_CHANGED); context.sendBroadcast(intent); } diff --git a/src/com/android/messaging/widget/WidgetConversationListService.java b/src/com/android/messaging/widget/WidgetConversationListService.java index e289f8d..096783b 100644 --- a/src/com/android/messaging/widget/WidgetConversationListService.java +++ b/src/com/android/messaging/widget/WidgetConversationListService.java @@ -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. @@ -51,9 +51,7 @@ public class WidgetConversationListService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onGetViewFactory intent: " + intent); - } + LogUtil.v(TAG, "onGetViewFactory intent: " + intent); return new WidgetConversationListFactory(getApplicationContext(), intent); } @@ -80,9 +78,7 @@ public class WidgetConversationListService extends RemoteViewsService { */ @Override public RemoteViews getViewAt(int position) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getViewAt position: " + position); - } + LogUtil.v(TAG, "getViewAt position: " + position); synchronized (sWidgetLock) { // "View more conversations" view. if (mCursor == null @@ -129,10 +125,8 @@ public class WidgetConversationListService extends RemoteViewsService { // Avatar boolean includeAvatar; final Bundle options = mAppWidgetManager.getAppWidgetOptions(mAppWidgetId); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " + - options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY)); - } + LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " + + options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY)); includeAvatar = options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY) == BugleWidgetProvider.SIZE_LARGE; @@ -231,9 +225,7 @@ public class WidgetConversationListService extends RemoteViewsService { */ @Override protected RemoteViews getViewMoreItemsView() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getViewMoreItemsView"); - } + LogUtil.v(TAG, "getViewMoreItemsView"); final RemoteViews view = new RemoteViews(mContext.getPackageName(), R.layout.widget_loading); view.setTextViewText( diff --git a/src/com/android/messaging/widget/WidgetConversationProvider.java b/src/com/android/messaging/widget/WidgetConversationProvider.java index fa79044..2fda640 100644 --- a/src/com/android/messaging/widget/WidgetConversationProvider.java +++ b/src/com/android/messaging/widget/WidgetConversationProvider.java @@ -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. @@ -56,9 +56,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { */ @Override protected void updateWidget(final Context context, final int appWidgetId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "updateWidget appWidgetId: " + appWidgetId); - } + LogUtil.v(TAG, "updateWidget appWidgetId: " + appWidgetId); if (OsUtil.hasRequiredPermissions()) { rebuildWidget(context, appWidgetId); } else { @@ -78,9 +76,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { } public static void rebuildWidget(final Context context, final int appWidgetId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "WidgetConversationProvider.rebuildWidget appWidgetId: " + appWidgetId); - } + LogUtil.v(TAG, "WidgetConversationProvider.rebuildWidget appWidgetId: " + appWidgetId); final RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_conversation); PendingIntent clickIntent; @@ -100,10 +96,8 @@ public class WidgetConversationProvider extends BaseWidgetProvider { clickIntent = uiIntents.getWidgetPendingIntentForConversationListActivity(context); remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "WidgetConversationProvider.rebuildWidget appWidgetId: " + - appWidgetId + " going into configure state"); - } + LogUtil.v(TAG, "WidgetConversationProvider.rebuildWidget appWidgetId: " + + appWidgetId + " going into configure state"); } else { remoteViews.setViewVisibility(R.id.widget_label, View.VISIBLE); remoteViews.setViewVisibility(R.id.message_list, View.VISIBLE); @@ -164,9 +158,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { * update and reflect the changes */ public static void notifyMessagesChanged(final Context context, final String conversationId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "notifyMessagesChanged"); - } + LogUtil.v(TAG, "notifyMessagesChanged"); final Intent intent = new Intent(ACTION_NOTIFY_MESSAGES_CHANGED); intent.putExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID, conversationId); context.sendBroadcast(intent); @@ -179,9 +171,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { */ public static void notifyConversationDeleted(final Context context, final String conversationId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "notifyConversationDeleted convId: " + conversationId); - } + LogUtil.v(TAG, "notifyConversationDeleted convId: " + conversationId); final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); for (final int appWidgetId : appWidgetManager.getAppWidgetIds(new ComponentName(context, @@ -205,9 +195,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { */ public static void notifyConversationRenamed(final Context context, final String conversationId) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "notifyConversationRenamed convId: " + conversationId); - } + LogUtil.v(TAG, "notifyConversationRenamed convId: " + conversationId); final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); for (final int appWidgetId : appWidgetManager.getAppWidgetIds(new ComponentName(context, @@ -224,9 +212,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { @Override public void onReceive(final Context context, final Intent intent) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "WidgetConversationProvider onReceive intent: " + intent); - } + LogUtil.v(TAG, "WidgetConversationProvider onReceive intent: " + intent); final String action = intent.getAction(); // The base class AppWidgetProvider's onReceive handles the normal widget intents. Here @@ -239,9 +225,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider { this.getClass())); if (appWidgetIds.length == 0) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "WidgetConversationProvider onReceive no widget ids"); - } + LogUtil.v(TAG, "WidgetConversationProvider onReceive no widget ids"); return; } // Normally the conversation id points to a specific conversation and we only update diff --git a/src/com/android/messaging/widget/WidgetConversationService.java b/src/com/android/messaging/widget/WidgetConversationService.java index 2d9b6b4..6b854c3 100644 --- a/src/com/android/messaging/widget/WidgetConversationService.java +++ b/src/com/android/messaging/widget/WidgetConversationService.java @@ -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. @@ -61,9 +61,7 @@ public class WidgetConversationService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onGetViewFactory intent: " + intent); - } + LogUtil.v(TAG, "onGetViewFactory intent: " + intent); return new WidgetConversationFactory(getApplicationContext(), intent); } @@ -78,18 +76,14 @@ public class WidgetConversationService extends RemoteViewsService { super(context, intent); mConversationId = intent.getStringExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "BugleFactory intent: " + intent + "widget id: " + mAppWidgetId); - } + LogUtil.v(TAG, "BugleFactory intent: " + intent + "widget id: " + mAppWidgetId); mIconSize = (int) context.getResources() .getDimension(R.dimen.contact_icon_view_normal_size); } @Override public void onCreate() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "onCreate"); - } + LogUtil.v(TAG, "onCreate"); super.onCreate(); // If the conversation for this widget has been removed, we want to update the widget to @@ -167,13 +161,11 @@ public class WidgetConversationService extends RemoteViewsService { if (cursorCount > MAX_ITEMS_TO_SHOW) { scrollToPosition += cursorCount - MAX_ITEMS_TO_SHOW; } - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getViewAt position: " + originalPosition + - " computed position: " + position + - " scrollToPosition: " + scrollToPosition + - " cursorCount: " + cursorCount + - " MAX_ITEMS_TO_SHOW: " + MAX_ITEMS_TO_SHOW); - } + LogUtil.v(TAG, "getViewAt position: " + originalPosition + + " computed position: " + position + + " scrollToPosition: " + scrollToPosition + + " cursorCount: " + cursorCount + + " MAX_ITEMS_TO_SHOW: " + MAX_ITEMS_TO_SHOW); intent.putExtra(UIIntents.UI_INTENT_EXTRA_MESSAGE_POSITION, scrollToPosition); if (message.hasAttachments()) { @@ -214,10 +206,8 @@ public class WidgetConversationService extends RemoteViewsService { // Avatar final Bundle options = mAppWidgetManager.getAppWidgetOptions(mAppWidgetId); - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " + - options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY)); - } + LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " + + options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY)); boolean includeAvatar = options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY) == BugleWidgetProvider.SIZE_LARGE; @@ -460,9 +450,7 @@ public class WidgetConversationService extends RemoteViewsService { */ @Override protected RemoteViews getViewMoreItemsView() { - if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { - LogUtil.v(TAG, "getViewMoreConversationsView"); - } + LogUtil.v(TAG, "getViewMoreConversationsView"); final RemoteViews view = new RemoteViews(mContext.getPackageName(), R.layout.widget_loading); view.setTextViewText(