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:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -1433,10 +1433,8 @@ public class BugleDatabaseOperations {
|
|||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Updated draft message " + messageId + " for conversation "
|
||||||
LogUtil.v(TAG,
|
+ conversationId);
|
||||||
"Updated draft message " + messageId + " for conversation " + conversationId);
|
|
||||||
}
|
|
||||||
return messageId;
|
return messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1692,9 +1690,7 @@ public class BugleDatabaseOperations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessagingContentProvider.notifyConversationListChanged();
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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,
|
public static void update(final boolean silent, final String conversationId,
|
||||||
final int coverage) {
|
final int coverage) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Update: silent = " + silent
|
||||||
LogUtil.v(TAG, "Update: silent = " + silent
|
+ " conversationId = " + conversationId
|
||||||
+ " conversationId = " + conversationId
|
+ " coverage = " + coverage);
|
||||||
+ " coverage = " + coverage);
|
|
||||||
}
|
|
||||||
Assert.isNotMainThread();
|
Assert.isNotMainThread();
|
||||||
checkInitialized();
|
checkInitialized();
|
||||||
if ((coverage & UPDATE_MESSAGES) != 0) {
|
if ((coverage & UPDATE_MESSAGES) != 0) {
|
||||||
@@ -219,9 +217,7 @@ public class BugleNotifications {
|
|||||||
final NotificationState notifState = iter.next();
|
final NotificationState notifState = iter.next();
|
||||||
if (notifState.mType == type) {
|
if (notifState.mType == type) {
|
||||||
notifState.mCanceled = true;
|
notifState.mCanceled = true;
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Canceling pending notification");
|
||||||
LogUtil.v(TAG, "Canceling pending notification");
|
|
||||||
}
|
|
||||||
iter.remove();
|
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
|
// conversation list), then play a notification beep at a low volume and don't display an
|
||||||
// actual notification.
|
// actual notification.
|
||||||
if (softSound) {
|
if (softSound) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "processAndSend: fromConversationId == " +
|
||||||
LogUtil.v(TAG, "processAndSend: fromConversationId == " +
|
"sCurrentlyDisplayedConversationId so NOT showing notification," +
|
||||||
"sCurrentlyDisplayedConversationId so NOT showing notification," +
|
" but playing soft sound. conversationId: " + conversationId);
|
||||||
" but playing soft sound. conversationId: " + conversationId);
|
|
||||||
}
|
|
||||||
playObservableConversationNotificationSound(conversationId);
|
playObservableConversationNotificationSound(conversationId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -708,17 +702,12 @@ public class BugleNotifications {
|
|||||||
private static void fireOffNotification(final NotificationState notificationState,
|
private static void fireOffNotification(final NotificationState notificationState,
|
||||||
final Bitmap attachmentBitmap, final Bitmap avatarBitmap, Bitmap avatarHiResBitmap) {
|
final Bitmap attachmentBitmap, final Bitmap avatarBitmap, Bitmap avatarHiResBitmap) {
|
||||||
if (notificationState.mCanceled) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Context context = Factory.get().getApplicationContext();
|
final Context context = Factory.get().getApplicationContext();
|
||||||
|
LogUtil.v(TAG, "MMS picture loaded, bitmap: " + attachmentBitmap);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
|
||||||
LogUtil.v(TAG, "MMS picture loaded, bitmap: " + attachmentBitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
final NotificationCompat.Builder notifBuilder = notificationState.mNotificationBuilder;
|
final NotificationCompat.Builder notifBuilder = notificationState.mNotificationBuilder;
|
||||||
notifBuilder.setStyle(notificationState.mNotificationStyle);
|
notifBuilder.setStyle(notificationState.mNotificationStyle);
|
||||||
@@ -759,9 +748,7 @@ public class BugleNotifications {
|
|||||||
private static void setWearableGroupOptions(final NotificationCompat.Builder notifBuilder,
|
private static void setWearableGroupOptions(final NotificationCompat.Builder notifBuilder,
|
||||||
final NotificationState notificationState) {
|
final NotificationState notificationState) {
|
||||||
final String groupKey = "groupkey";
|
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) {
|
if (notificationState instanceof MultiConversationNotificationState) {
|
||||||
notifBuilder.setGroup(groupKey).setGroupSummary(true);
|
notifBuilder.setGroup(groupKey).setGroupSummary(true);
|
||||||
} else if (notificationState instanceof BundledMessageNotificationState) {
|
} else if (notificationState instanceof BundledMessageNotificationState) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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);
|
null);
|
||||||
|
|
||||||
if (convMessageCursor != null && convMessageCursor.moveToFirst()) {
|
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 =
|
final ConversationMessageData convMessageData =
|
||||||
new ConversationMessageData();
|
new ConversationMessageData();
|
||||||
|
|
||||||
@@ -1021,9 +1019,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
|||||||
final ConversationInfoList convList = createConversationInfoList();
|
final ConversationInfoList convList = createConversationInfoList();
|
||||||
|
|
||||||
if (convList == null || convList.mConvInfos.size() == 0) {
|
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 {
|
} else {
|
||||||
final ConversationLineInfo convInfo = convList.mConvInfos.get(0);
|
final ConversationLineInfo convInfo = convList.mConvInfos.get(0);
|
||||||
state = new MultiMessageNotificationState(convList);
|
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"
|
LogUtil.v(TAG, "MessageNotificationState: Notification state created"
|
||||||
+ ", title = "
|
+ ", title = "
|
||||||
+ (state.mTickerSender != null ? state.mTickerSender : state.mTitle)
|
+ (state.mTickerSender != null ? state.mTickerSender : state.mTitle)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -53,23 +53,16 @@ public class NoConfirmationSmsSendService extends IntentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHandleIntent(final Intent intent) {
|
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();
|
final String action = intent.getAction();
|
||||||
if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(action)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
final Bundle extras = intent.getExtras();
|
final Bundle extras = intent.getExtras();
|
||||||
if (extras == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,9 +80,7 @@ public class NoConfirmationSmsSendService extends IntentService {
|
|||||||
final String recipients = UriUtil.parseRecipientsFromSmsMmsUri(intent.getData());
|
final String recipients = UriUtil.parseRecipientsFromSmsMmsUri(intent.getData());
|
||||||
|
|
||||||
if (TextUtils.isEmpty(recipients) && TextUtils.isEmpty(conversationId)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +88,7 @@ public class NoConfirmationSmsSendService extends IntentService {
|
|||||||
startActivity(new Intent(this, ConversationListActivity.class));
|
startActivity(new Intent(this, ConversationListActivity.class));
|
||||||
} else {
|
} else {
|
||||||
if (TextUtils.isEmpty(message)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,17 +100,13 @@ public class NoConfirmationSmsSendService extends IntentService {
|
|||||||
} else {
|
} else {
|
||||||
MessageData messageData;
|
MessageData messageData;
|
||||||
if (requiresMms) {
|
if (requiresMms) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Auto-sending MMS message in conversation: " +
|
||||||
LogUtil.v(TAG, "Auto-sending MMS message in conversation: " +
|
conversationId);
|
||||||
conversationId);
|
|
||||||
}
|
|
||||||
messageData = MessageData.createDraftMmsMessage(conversationId, selfId, message,
|
messageData = MessageData.createDraftMmsMessage(conversationId, selfId, message,
|
||||||
subject);
|
subject);
|
||||||
} else {
|
} else {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Auto-sending SMS message in conversation: " +
|
||||||
LogUtil.v(TAG, "Auto-sending SMS message in conversation: " +
|
conversationId);
|
||||||
conversationId);
|
|
||||||
}
|
|
||||||
messageData = MessageData.createDraftSmsMessage(conversationId, selfId,
|
messageData = MessageData.createDraftSmsMessage(conversationId, selfId,
|
||||||
message);
|
message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -115,9 +115,7 @@ public class ParticipantRefresh {
|
|||||||
@Override
|
@Override
|
||||||
public void onChange(final boolean selfChange) {
|
public void onChange(final boolean selfChange) {
|
||||||
super.onChange(selfChange);
|
super.onChange(selfChange);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Contacts changed");
|
||||||
LogUtil.v(TAG, "Contacts changed");
|
|
||||||
}
|
|
||||||
mContactChanged = true;
|
mContactChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,11 +141,9 @@ public class ParticipantRefresh {
|
|||||||
public static void refreshParticipantsIfNeeded() {
|
public static void refreshParticipantsIfNeeded() {
|
||||||
if (ParticipantRefresh.getNeedFullRefresh() &&
|
if (ParticipantRefresh.getNeedFullRefresh() &&
|
||||||
sFullRefreshScheduled.compareAndSet(false, true)) {
|
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);
|
Executors.newSingleThreadExecutor().execute(sFullRefreshRunnable);
|
||||||
} else if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
} else {
|
||||||
LogUtil.v(TAG, "Skipped full participant refresh");
|
LogUtil.v(TAG, "Skipped full participant refresh");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,24 +196,20 @@ public class ParticipantRefresh {
|
|||||||
*/
|
*/
|
||||||
static void refreshParticipants(final int refreshMode) {
|
static void refreshParticipants(final int refreshMode) {
|
||||||
Assert.inRange(refreshMode, REFRESH_MODE_FULL, REFRESH_MODE_SELF_ONLY);
|
Assert.inRange(refreshMode, REFRESH_MODE_FULL, REFRESH_MODE_SELF_ONLY);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
switch (refreshMode) {
|
||||||
switch (refreshMode) {
|
case REFRESH_MODE_FULL:
|
||||||
case REFRESH_MODE_FULL:
|
LogUtil.v(TAG, "Start full participant refresh");
|
||||||
LogUtil.v(TAG, "Start full participant refresh");
|
break;
|
||||||
break;
|
case REFRESH_MODE_INCREMENTAL:
|
||||||
case REFRESH_MODE_INCREMENTAL:
|
LogUtil.v(TAG, "Start partial participant refresh");
|
||||||
LogUtil.v(TAG, "Start partial participant refresh");
|
break;
|
||||||
break;
|
case REFRESH_MODE_SELF_ONLY:
|
||||||
case REFRESH_MODE_SELF_ONLY:
|
LogUtil.v(TAG, "Start self participant refresh");
|
||||||
LogUtil.v(TAG, "Start self participant refresh");
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ContactUtil.hasReadContactsPermission() || !OsUtil.hasPhonePermission()) {
|
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;
|
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.
|
// Refresh conversations for participants that are changed.
|
||||||
if (changedParticipants.size() > 0) {
|
if (changedParticipants.size() > 0) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* @return - true if sync should start
|
||||||
*/
|
*/
|
||||||
public synchronized boolean shouldSync(final boolean full, final long startTimestamp) {
|
public synchronized boolean shouldSync(final boolean full, final long startTimestamp) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncManager: Checking shouldSync " + (full ? "full " : "")
|
||||||
LogUtil.v(TAG, "SyncManager: Checking shouldSync " + (full ? "full " : "")
|
+ "at " + startTimestamp);
|
||||||
+ "at " + startTimestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (full) {
|
if (full) {
|
||||||
final long delayUntilFullSync = delayUntilFullSync(startTimestamp);
|
final long delayUntilFullSync = delayUntilFullSync(startTimestamp);
|
||||||
@@ -342,11 +340,9 @@ public class SyncManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onChange(final boolean selfChange, final Uri uri) {
|
public void onChange(final boolean selfChange, final Uri uri) {
|
||||||
// Handle change.
|
// Handle change.
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncManager: Sms/Mms DB changed @" + System.currentTimeMillis()
|
||||||
LogUtil.v(TAG, "SyncManager: Sms/Mms DB changed @" + System.currentTimeMillis()
|
+ " for " + (uri == null ? "<unk>" : uri.toString()) + " "
|
||||||
+ " for " + (uri == null ? "<unk>" : uri.toString()) + " "
|
+ mSyncOnChanges + "/" + mNotifyOnChanges);
|
||||||
+ mSyncOnChanges + "/" + mNotifyOnChanges);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mSyncOnChanges) {
|
if (mSyncOnChanges) {
|
||||||
// If sync is already running this will do nothing - but at end of each sync
|
// If sync is already running this will do nothing - but at end of each sync
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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);
|
monitor.updateState(action, expectedOldState, newState);
|
||||||
newMonitorState = monitor.mState;
|
newMonitorState = monitor.mState;
|
||||||
}
|
}
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",
|
||||||
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",
|
Locale.getDefault());
|
||||||
Locale.getDefault());
|
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date())
|
||||||
LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date())
|
+ "UTC State = " + oldMonitorState + " - " + newMonitorState);
|
||||||
+ "UTC State = " + oldMonitorState + " - " + newMonitorState);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,13 +340,11 @@ public class ActionMonitor {
|
|||||||
monitor.complete(action, expectedOldState, result, succeeded);
|
monitor.complete(action, expectedOldState, result, succeeded);
|
||||||
unregisterActionMonitorIfComplete(action.actionKey, monitor);
|
unregisterActionMonitorIfComplete(action.actionKey, monitor);
|
||||||
}
|
}
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",
|
||||||
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",
|
Locale.getDefault());
|
||||||
Locale.getDefault());
|
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date())
|
||||||
LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date())
|
+ "UTC State = " + oldMonitorState + " - " + STATE_COMPLETE);
|
||||||
+ "UTC State = " + oldMonitorState + " - " + STATE_COMPLETE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -401,13 +397,11 @@ public class ActionMonitor {
|
|||||||
oldMonitorState = monitor.mState;
|
oldMonitorState = monitor.mState;
|
||||||
monitor.executed(action, expectedOldState, hasBackgroundActions, result);
|
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",
|
||||||
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",
|
Locale.getDefault());
|
||||||
Locale.getDefault());
|
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date())
|
||||||
LogUtil.v(TAG, "Operation-" + action.actionKey + ": @" + df.format(new Date())
|
+ "UTC State = " + oldMonitorState + " - EXECUTED");
|
||||||
+ "UTC State = " + oldMonitorState + " - EXECUTED");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 {
|
public class ActionServiceImpl extends JobIntentService {
|
||||||
private static final String TAG = LogUtil.BUGLE_DATAMODEL_TAG;
|
private static final String TAG = LogUtil.BUGLE_DATAMODEL_TAG;
|
||||||
private static final boolean VERBOSE = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique job ID for this service.
|
* Unique job ID for this service.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 {
|
public class BackgroundWorkerService extends JobIntentService {
|
||||||
private static final String TAG = LogUtil.BUGLE_DATAMODEL_TAG;
|
private static final String TAG = LogUtil.BUGLE_DATAMODEL_TAG;
|
||||||
private static final boolean VERBOSE = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique job ID for this service.
|
* Unique job ID for this service.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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,
|
private void insertBroadcastSmsMessage(final String conversationId,
|
||||||
final MessageData message, final int subId, final long laterTimestamp,
|
final MessageData message, final int subId, final long laterTimestamp,
|
||||||
final ArrayList<String> recipients) {
|
final ArrayList<String> recipients) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "InsertNewMessageAction: Inserting broadcast SMS message "
|
||||||
LogUtil.v(TAG, "InsertNewMessageAction: Inserting broadcast SMS message "
|
+ message.getMessageId());
|
||||||
+ message.getMessageId());
|
|
||||||
}
|
|
||||||
final Context context = Factory.get().getApplicationContext();
|
final Context context = Factory.get().getApplicationContext();
|
||||||
final DatabaseWrapper db = DataModel.get().getDatabase();
|
final DatabaseWrapper db = DataModel.get().getDatabase();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
// Send a response indicating that auto-download failed
|
||||||
if (sendDeferredRespStatus) {
|
if (sendDeferredRespStatus) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "DownloadMmsAction: Auto-download of message " + messageId
|
||||||
LogUtil.v(TAG, "DownloadMmsAction: Auto-download of message " + messageId
|
+ " failed; sending DEFERRED NotifyRespInd");
|
||||||
+ " failed; sending DEFERRED NotifyRespInd");
|
|
||||||
}
|
|
||||||
MmsUtils.sendNotifyResponseForMmsDownload(
|
MmsUtils.sendNotifyResponseForMmsDownload(
|
||||||
context,
|
context,
|
||||||
subId,
|
subId,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.
|
// return true.
|
||||||
final ProcessPendingMessagesAction action = new ProcessPendingMessagesAction();
|
final ProcessPendingMessagesAction action = new ProcessPendingMessagesAction();
|
||||||
if (action.queueActions(processingAction)) {
|
if (action.queueActions(processingAction)) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
if (processingAction.hasBackgroundActions()) {
|
||||||
if (processingAction.hasBackgroundActions()) {
|
LogUtil.v(TAG, "ProcessPendingMessagesAction: Action queued");
|
||||||
LogUtil.v(TAG, "ProcessPendingMessagesAction: Action queued");
|
} else {
|
||||||
} else {
|
LogUtil.v(TAG, "ProcessPendingMessagesAction: No actions to queue");
|
||||||
LogUtil.v(TAG, "ProcessPendingMessagesAction: No actions to queue");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Have queued next action if needed, nothing more to do
|
// Have queued next action if needed, nothing more to do
|
||||||
return;
|
return;
|
||||||
@@ -175,10 +173,8 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
|
|||||||
final ProcessPendingMessagesAction action = new ProcessPendingMessagesAction();
|
final ProcessPendingMessagesAction action = new ProcessPendingMessagesAction();
|
||||||
action.schedule(PENDING_INTENT_BASE_REQUEST_CODE + subId, Long.MAX_VALUE);
|
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 "
|
||||||
LogUtil.v(TAG, "ProcessPendingMessagesAction: Unregistering for connectivity changed "
|
+ "events and clearing scheduled alarm for subId " + subId);
|
||||||
+ "events and clearing scheduled alarm for subId " + subId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setRetry(final int retryAttempt, int 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);
|
scheduleProcessPendingMessagesAction(true /* failed */, this);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
scheduleProcessPendingMessagesAction(true /* failed */, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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()) {
|
if (tempFile.exists()) {
|
||||||
messageSize = tempFile.length();
|
messageSize = tempFile.length();
|
||||||
tempFile.delete();
|
tempFile.delete();
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "ProcessSentMessageAction: Deleted temp file with outgoing "
|
||||||
LogUtil.v(TAG, "ProcessSentMessageAction: Deleted temp file with outgoing "
|
+ "MMS pdu: " + contentUri);
|
||||||
+ "MMS pdu: " + contentUri);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final int resultCode = actionParameters.getInt(KEY_RESULT_CODE);
|
final int resultCode = actionParameters.getInt(KEY_RESULT_CODE);
|
||||||
@@ -194,10 +192,8 @@ public class ProcessSentMessageAction extends Action {
|
|||||||
messageId, updatedMessageUri, status, rawStatus, isSms, this, subId,
|
messageId, updatedMessageUri, status, rawStatus, isSms, this, subId,
|
||||||
resultCode, httpStatusCode);
|
resultCode, httpStatusCode);
|
||||||
} else {
|
} else {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "ProcessSentMessageAction: No sent message to process (it was "
|
||||||
LogUtil.v(TAG, "ProcessSentMessageAction: No sent message to process (it was "
|
+ "probably a notify response for an MMS download)");
|
||||||
+ "probably a notify response for an MMS download)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
// To prevent Sync seeing inconsistent state must write to DB on this thread
|
||||||
updateMessageUri(messageId, updatedMessageUri);
|
updateMessageUri(messageId, updatedMessageUri);
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SendMessageAction: Updated message " + messageId
|
||||||
LogUtil.v(TAG, "SendMessageAction: Updated message " + messageId
|
+ " with new uri " + messageUri);
|
||||||
+ " with new uri " + messageUri);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (messageUri != null) {
|
if (messageUri != null) {
|
||||||
// Actually send the MMS
|
// Actually send the MMS
|
||||||
@@ -378,11 +376,9 @@ public class SendMessageAction extends Action implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updatedTelephony) {
|
if (updatedTelephony) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS")
|
||||||
LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS")
|
+ " message " + message.getMessageId()
|
||||||
+ " message " + message.getMessageId()
|
+ " in telephony (" + message.getSmsMessageUri() + ")");
|
||||||
+ " in telephony (" + message.getSmsMessageUri() + ")");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LogUtil.w(TAG, "SendMessageAction: Failed to update " + (isSms ? "SMS" : "MMS")
|
LogUtil.w(TAG, "SendMessageAction: Failed to update " + (isSms ? "SMS" : "MMS")
|
||||||
+ " message " + message.getMessageId()
|
+ " message " + message.getMessageId()
|
||||||
@@ -414,11 +410,9 @@ public class SendMessageAction extends Action implements Parcelable {
|
|||||||
values);
|
values);
|
||||||
}
|
}
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS")
|
||||||
LogUtil.v(TAG, "SendMessageAction: Updated " + (isSms ? "SMS" : "MMS")
|
+ " message " + message.getMessageId() + " in local db. Timestamp = "
|
||||||
+ " message " + message.getMessageId() + " in local db. Timestamp = "
|
+ message.getReceivedTimeStamp());
|
||||||
+ message.getReceivedTimeStamp());
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -375,10 +375,8 @@ class SyncCursorPair {
|
|||||||
throws SQLiteException {
|
throws SQLiteException {
|
||||||
mDatabase = database;
|
mDatabase = database;
|
||||||
try {
|
try {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncCursorPair: Querying for local messages; selection = "
|
||||||
LogUtil.v(TAG, "SyncCursorPair: Querying for local messages; selection = "
|
+ selection);
|
||||||
+ selection);
|
|
||||||
}
|
|
||||||
mCursor = mDatabase.query(
|
mCursor = mDatabase.query(
|
||||||
DatabaseHelper.MESSAGES_TABLE,
|
DatabaseHelper.MESSAGES_TABLE,
|
||||||
LocalMessageQuery.PROJECTION,
|
LocalMessageQuery.PROJECTION,
|
||||||
@@ -440,10 +438,8 @@ class SyncCursorPair {
|
|||||||
mMmsCursor = null;
|
mMmsCursor = null;
|
||||||
try {
|
try {
|
||||||
final Context context = Factory.get().getApplicationContext();
|
final Context context = Factory.get().getApplicationContext();
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncCursorPair: Querying for remote SMS; selection = "
|
||||||
LogUtil.v(TAG, "SyncCursorPair: Querying for remote SMS; selection = "
|
+ smsSelection);
|
||||||
+ smsSelection);
|
|
||||||
}
|
|
||||||
mSmsCursor = SqliteWrapper.query(
|
mSmsCursor = SqliteWrapper.query(
|
||||||
context,
|
context,
|
||||||
context.getContentResolver(),
|
context.getContentResolver(),
|
||||||
@@ -457,10 +453,8 @@ class SyncCursorPair {
|
|||||||
+ "need to cancel sync");
|
+ "need to cancel sync");
|
||||||
throw new RuntimeException("Null cursor from remote SMS query");
|
throw new RuntimeException("Null cursor from remote SMS query");
|
||||||
}
|
}
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncCursorPair: Querying for remote MMS; selection = "
|
||||||
LogUtil.v(TAG, "SyncCursorPair: Querying for remote MMS; selection = "
|
+ mmsSelection);
|
||||||
+ mmsSelection);
|
|
||||||
}
|
|
||||||
mMmsCursor = SqliteWrapper.query(
|
mMmsCursor = SqliteWrapper.query(
|
||||||
context,
|
context,
|
||||||
context.getContentResolver(),
|
context.getContentResolver(),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -98,11 +98,9 @@ class SyncMessageBatch {
|
|||||||
messageListToIds(mMessagesToDelete));
|
messageListToIds(mMessagesToDelete));
|
||||||
|
|
||||||
for (final LocalDatabaseMessage message : mMessagesToDelete) {
|
for (final LocalDatabaseMessage message : mMessagesToDelete) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncMessageBatch: Deleted message " + message.getLocalId()
|
||||||
LogUtil.v(TAG, "SyncMessageBatch: Deleted message " + message.getLocalId()
|
+ " for SMS/MMS " + message.getUri() + " with timestamp "
|
||||||
+ " for SMS/MMS " + message.getUri() + " with timestamp "
|
+ message.getTimestampInMillis());
|
||||||
+ message.getTimestampInMillis());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update conversation state for imported messages, like snippet,
|
// Update conversation state for imported messages, like snippet,
|
||||||
@@ -185,11 +183,9 @@ class SyncMessageBatch {
|
|||||||
conversationId, selfId, participantId);
|
conversationId, selfId, participantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId()
|
||||||
LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId()
|
+ " for SMS " + message.getSmsMessageUri() + " received at "
|
||||||
+ " for SMS " + message.getSmsMessageUri() + " received at "
|
+ message.getReceivedTimeStamp());
|
||||||
+ message.getReceivedTimeStamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep track of updated conversation for later updating the conversation snippet, etc.
|
// Keep track of updated conversation for later updating the conversation snippet, etc.
|
||||||
mConversationsToUpdate.add(conversationId);
|
mConversationsToUpdate.add(conversationId);
|
||||||
@@ -273,11 +269,9 @@ class SyncMessageBatch {
|
|||||||
conversationId, selfId, participantId);
|
conversationId, selfId, participantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId()
|
||||||
LogUtil.v(TAG, "SyncMessageBatch: Inserted new message " + message.getMessageId()
|
+ " for MMS " + message.getSmsMessageUri() + " received at "
|
||||||
+ " for MMS " + message.getSmsMessageUri() + " received at "
|
+ message.getReceivedTimeStamp());
|
||||||
+ message.getReceivedTimeStamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep track of updated conversation for later updating the conversation snippet, etc.
|
// Keep track of updated conversation for later updating the conversation snippet, etc.
|
||||||
mConversationsToUpdate.add(conversationId);
|
mConversationsToUpdate.add(conversationId);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* Copyright (C) 2015 The Android Open Source Project
|
||||||
|
* Copyright (C) 2025 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -68,13 +69,11 @@ public class MediaCache<T extends RefCountedMediaResource> extends LruCache<Stri
|
|||||||
public synchronized T fetchResourceFromCache(final String key) {
|
public synchronized T fetchResourceFromCache(final String key) {
|
||||||
final T ret = get(key);
|
final T ret = get(key);
|
||||||
if (ret != null) {
|
if (ret != null) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "cache hit in mediaCache @ " + getName() +
|
||||||
LogUtil.v(TAG, "cache hit in mediaCache @ " + getName() +
|
", total cache hit = " + hitCount() +
|
||||||
", total cache hit = " + hitCount() +
|
", total cache miss = " + missCount());
|
||||||
", total cache miss = " + missCount());
|
|
||||||
}
|
|
||||||
ret.addRef();
|
ret.addRef();
|
||||||
} else if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
} else {
|
||||||
LogUtil.v(TAG, "cache miss in mediaCache @ " + getName() +
|
LogUtil.v(TAG, "cache miss in mediaCache @ " + getName() +
|
||||||
", total cache hit = " + hitCount() +
|
", total cache hit = " + hitCount() +
|
||||||
", total cache miss = " + missCount());
|
", total cache miss = " + missCount());
|
||||||
@@ -110,4 +109,4 @@ public class MediaCache<T extends RefCountedMediaResource> extends LruCache<Stri
|
|||||||
// Never zero-count any resource, count as at least 1KB.
|
// Never zero-count any resource, count as at least 1KB.
|
||||||
return mediaSizeInKilobytes == 0 ? 1 : mediaSizeInKilobytes;
|
return mediaSizeInKilobytes == 0 ? 1 : mediaSizeInKilobytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,10 +262,8 @@ public class MediaResourceManager {
|
|||||||
bindableRequest.onMediaResourceLoadError(bindableRequest, mException);
|
bindableRequest.onMediaResourceLoadError(bindableRequest, mException);
|
||||||
} else {
|
} else {
|
||||||
Assert.isTrue(bindableRequest == null || !bindableRequest.isBound());
|
Assert.isTrue(bindableRequest == null || !bindableRequest.isBound());
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "media request not processed, no longer bound; key=" +
|
||||||
LogUtil.v(TAG, "media request not processed, no longer bound; key=" +
|
LogUtil.sanitizePII(mediaRequest.getKey()) /* key with phone# */);
|
||||||
LogUtil.sanitizePII(mediaRequest.getKey()) /* key with phone# */);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -278,10 +276,8 @@ public class MediaResourceManager {
|
|||||||
final MediaCache<T> mediaCache = mediaRequest.getMediaCache();
|
final MediaCache<T> mediaCache = mediaRequest.getMediaCache();
|
||||||
if (mediaCache != null) {
|
if (mediaCache != null) {
|
||||||
mediaCache.addResourceToCache(mediaRequest.getKey(), mediaResource);
|
mediaCache.addResourceToCache(mediaRequest.getKey(), mediaResource);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "added media resource to " + mediaCache.getName() + ". key=" +
|
||||||
LogUtil.v(TAG, "added media resource to " + mediaCache.getName() + ". key=" +
|
LogUtil.sanitizePII(mediaRequest.getKey()) /* key can contain phone# */);
|
||||||
LogUtil.sanitizePII(mediaRequest.getKey()) /* key can contain phone# */);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -297,12 +297,10 @@ public class PoolableImageCache extends MediaCache<ImageResource> {
|
|||||||
final long timeSinceLastRef = SystemClock.elapsedRealtime() -
|
final long timeSinceLastRef = SystemClock.elapsedRealtime() -
|
||||||
imageToUse.getLastRefAddTimestamp();
|
imageToUse.getLastRefAddTimestamp();
|
||||||
if (timeSinceLastRef < MIN_TIME_IN_POOL) {
|
if (timeSinceLastRef < MIN_TIME_IN_POOL) {
|
||||||
if (LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "Not reusing reusing " +
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "Not reusing reusing " +
|
"first available bitmap from the pool because it " +
|
||||||
"first available bitmap from the pool because it " +
|
"has not been in the pool long enough. " +
|
||||||
"has not been in the pool long enough. " +
|
"timeSinceLastRef=" + timeSinceLastRef);
|
||||||
"timeSinceLastRef=" + timeSinceLastRef);
|
|
||||||
}
|
|
||||||
// Put back the image and return no reuseable bitmap.
|
// Put back the image and return no reuseable bitmap.
|
||||||
images.addLast(imageToUse);
|
images.addLast(imageToUse);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* Copyright (C) 2015 The Android Open Source Project
|
||||||
|
* Copyright (C) 2025 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 {
|
public class NotificationReceiver extends BroadcastReceiver {
|
||||||
// Logging
|
// Logging
|
||||||
public static final String TAG = LogUtil.BUGLE_TAG;
|
public static final String TAG = LogUtil.BUGLE_TAG;
|
||||||
public static final boolean VERBOSE = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
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)) {
|
if (intent.getAction().equals(UIIntents.ACTION_RESET_NOTIFICATIONS)) {
|
||||||
final String conversationIdSetString =
|
final String conversationIdSetString =
|
||||||
intent.getStringExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID_SET);
|
intent.getStringExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID_SET);
|
||||||
@@ -54,4 +52,4 @@ public class NotificationReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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();
|
boolean smsReceiverEnabled = OsUtil.isSecondaryUser();
|
||||||
|
|
||||||
final PackageManager packageManager = context.getPackageManager();
|
final PackageManager packageManager = context.getPackageManager();
|
||||||
final boolean logv = LogUtil.isLoggable(TAG, LogUtil.VERBOSE);
|
|
||||||
if (smsReceiverEnabled) {
|
if (smsReceiverEnabled) {
|
||||||
if (logv) {
|
LogUtil.v(TAG, "Enabling SMS message receiving");
|
||||||
LogUtil.v(TAG, "Enabling SMS message receiving");
|
|
||||||
}
|
|
||||||
packageManager.setComponentEnabledSetting(
|
packageManager.setComponentEnabledSetting(
|
||||||
new ComponentName(context, SmsReceiver.class),
|
new ComponentName(context, SmsReceiver.class),
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (logv) {
|
LogUtil.v(TAG, "Disabling SMS message receiving");
|
||||||
LogUtil.v(TAG, "Disabling SMS message receiving");
|
|
||||||
}
|
|
||||||
packageManager.setComponentEnabledSetting(
|
packageManager.setComponentEnabledSetting(
|
||||||
new ComponentName(context, SmsReceiver.class),
|
new ComponentName(context, SmsReceiver.class),
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
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(
|
packageManager.setComponentEnabledSetting(
|
||||||
new ComponentName(context, NoConfirmationSmsSendService.class),
|
new ComponentName(context, NoConfirmationSmsSendService.class),
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* Load APN table from app resources
|
||||||
*/
|
*/
|
||||||
private static void loadApnTable(final SQLiteDatabase db) {
|
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 Resources r = sContext.getResources();
|
||||||
final XmlResourceParser parser = r.getXml(R.xml.apns);
|
final XmlResourceParser parser = r.getXml(R.xml.apns);
|
||||||
final ApnsXmlProcessor processor = ApnsXmlProcessor.get(parser);
|
final ApnsXmlProcessor processor = ApnsXmlProcessor.get(parser);
|
||||||
|
|||||||
@@ -469,12 +469,10 @@ public class MmsUtils {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "addPicturePart size: " + imageSize + " width: "
|
||||||
LogUtil.v(TAG, "addPicturePart size: " + imageSize + " width: "
|
+ width + " widthLimit: " + widthLimit
|
||||||
+ width + " widthLimit: " + widthLimit
|
+ " height: " + height
|
||||||
+ " height: " + height
|
+ " heightLimit: " + heightLimit);
|
||||||
+ " heightLimit: " + heightLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
PduPart part;
|
PduPart part;
|
||||||
// Check if we're already within the limits - in which case we don't need to resize.
|
// 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 &&
|
height <= heightLimit &&
|
||||||
(orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED ||
|
(orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED ||
|
||||||
orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_NORMAL)) {
|
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 = new PduPart();
|
||||||
part.setDataUri(imageUri);
|
part.setDataUri(imageUri);
|
||||||
part.setContentType(contentType.getBytes());
|
part.setContentType(contentType.getBytes());
|
||||||
@@ -508,9 +504,7 @@ public class MmsUtils {
|
|||||||
|
|
||||||
pb.addPart(index, part);
|
pb.addPart(index, part);
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "addPicturePart size: " + imageSize);
|
||||||
LogUtil.v(TAG, "addPicturePart size: " + imageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return imageSize;
|
return imageSize;
|
||||||
}
|
}
|
||||||
@@ -538,9 +532,7 @@ public class MmsUtils {
|
|||||||
|
|
||||||
addPartForUri(context, pb, srcName, vcardUri, contentType);
|
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;
|
return vcardSize;
|
||||||
}
|
}
|
||||||
@@ -554,9 +546,7 @@ public class MmsUtils {
|
|||||||
final Uri attachmentUri = messagePart.getContentUri();
|
final Uri attachmentUri = messagePart.getContentUri();
|
||||||
String contentType = messagePart.getContentType();
|
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)) {
|
if (TextUtils.isEmpty(contentType)) {
|
||||||
contentType = ContentType.VIDEO_3G2;
|
contentType = ContentType.VIDEO_3G2;
|
||||||
@@ -571,9 +561,7 @@ public class MmsUtils {
|
|||||||
final Uri attachmentUri = messagePart.getContentUri();
|
final Uri attachmentUri = messagePart.getContentUri();
|
||||||
final String contentType = messagePart.getContentType();
|
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);
|
final int dataSize = (int) getMediaFileSize(attachmentUri);
|
||||||
|
|
||||||
@@ -671,9 +659,7 @@ public class MmsUtils {
|
|||||||
final byte[] data = ImageResizer.getResizedImageData(width, height, orientation,
|
final byte[] data = ImageResizer.getResizedImageData(width, height, orientation,
|
||||||
widthLimit, heightLimit, byteLimit, imageUri, context, contentType);
|
widthLimit, heightLimit, byteLimit, imageUri, context, contentType);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "Resize image failed.");
|
||||||
LogUtil.v(TAG, "Resize image failed.");
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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));
|
UiUtils.showToastAtBottom(getSendErrorToastMessage(context, subId, errorCode));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SmsSender: received sent result. " + " requestId=" + requestId
|
||||||
LogUtil.v(TAG, "SmsSender: received sent result. " + " requestId=" + requestId
|
+ " partId=" + partId + " resultCode=" + resultCode);
|
||||||
+ " partId=" + partId + " resultCode=" + resultCode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (requestId != null) {
|
if (requestId != null) {
|
||||||
final SendResult result = sPendingMessageMap.get(requestId);
|
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,
|
public static SendResult sendMessage(final Context context, final int subId, String dest,
|
||||||
String message, final String serviceCenter, final boolean requireDeliveryReport,
|
String message, final String serviceCenter, final boolean requireDeliveryReport,
|
||||||
final Uri messageUri) throws Exception {
|
final Uri messageUri) throws Exception {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SmsSender: sending message. " +
|
||||||
LogUtil.v(TAG, "SmsSender: sending message. " +
|
"dest=" + dest + " message=" + message +
|
||||||
"dest=" + dest + " message=" + message +
|
" serviceCenter=" + serviceCenter +
|
||||||
" serviceCenter=" + serviceCenter +
|
" requireDeliveryReport=" + requireDeliveryReport +
|
||||||
" requireDeliveryReport=" + requireDeliveryReport +
|
" requestId=" + messageUri);
|
||||||
" requestId=" + messageUri);
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(message)) {
|
if (TextUtils.isEmpty(message)) {
|
||||||
throw new Exception("SmsSender: empty text 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)
|
// Either we timed out or have all the results (success or failure)
|
||||||
sPendingMessageMap.remove(messageUri);
|
sPendingMessageMap.remove(messageUri);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "SmsSender: sending completed. " +
|
||||||
LogUtil.v(TAG, "SmsSender: sending completed. " +
|
"dest=" + dest + " message=" + message + " result=" + pendingResult);
|
||||||
"dest=" + dest + " message=" + message + " result=" + pendingResult);
|
|
||||||
}
|
|
||||||
return pendingResult;
|
return pendingResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,14 +210,12 @@ public class AsyncImageView extends AppCompatImageView implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
if (mImageResource instanceof GifImageResource) {
|
||||||
if (mImageResource instanceof GifImageResource) {
|
LogUtil.v(TAG, "setImage size unknown -- it's a GIF");
|
||||||
LogUtil.v(TAG, "setImage size unknown -- it's a GIF");
|
} else {
|
||||||
} else {
|
LogUtil.v(TAG, "setImage size: " + mImageResource.getMediaSize() +
|
||||||
LogUtil.v(TAG, "setImage size: " + mImageResource.getMediaSize() +
|
" width: " + mImageResource.getBitmap().getWidth() +
|
||||||
" width: " + mImageResource.getBitmap().getWidth() +
|
" heigh: " + mImageResource.getBitmap().getHeight());
|
||||||
" heigh: " + mImageResource.getBitmap().getHeight());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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;
|
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,
|
getWindow().setStatusBarColor(getResources().getColor(R.color.action_bar_background_color,
|
||||||
getTheme()));
|
getTheme()));
|
||||||
@@ -80,42 +78,32 @@ public class BugleActionBarActivity extends AppCompatActivity implements ImeUtil
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.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
|
@Override
|
||||||
protected void onRestart() {
|
protected void onRestart() {
|
||||||
super.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
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.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);
|
BugleActivityUtil.onActivityResume(this, BugleActionBarActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.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
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.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;
|
private boolean mDestroyed;
|
||||||
@@ -151,11 +139,9 @@ public class BugleActionBarActivity extends AppCompatActivity implements ImeUtil
|
|||||||
final boolean imeWasOpen = mImeOpen;
|
final boolean imeWasOpen = mImeOpen;
|
||||||
mImeOpen = screenHeight - height > 100;
|
mImeOpen = screenHeight - height > 100;
|
||||||
|
|
||||||
if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onDisplayHeightChanged " +
|
||||||
LogUtil.v(LogUtil.BUGLE_TAG, this.getLocalClassName() + ".onDisplayHeightChanged " +
|
"imeWasOpen: " + imeWasOpen + " mImeOpen: " + mImeOpen + " screenHeight: " +
|
||||||
"imeWasOpen: " + imeWasOpen + " mImeOpen: " + mImeOpen + " screenHeight: " +
|
screenHeight + " height: " + height);
|
||||||
screenHeight + " height: " + height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imeWasOpen != mImeOpen) {
|
if (imeWasOpen != mImeOpen) {
|
||||||
for (final ImeUtil.ImeStateObserver observer : mImeStateObservers) {
|
for (final ImeUtil.ImeStateObserver observer : mImeStateObservers) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* Copyright (C) 2015 The Android Open Source Project
|
||||||
|
* Copyright (C) 2025 The LineageOS Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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();
|
final int measuredHeight = getMeasuredHeight();
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(LogUtil.BUGLE_TAG, "ImeDetectFrameLayout " +
|
||||||
LogUtil.v(LogUtil.BUGLE_TAG, "ImeDetectFrameLayout " +
|
"measuredHeight: " + measuredHeight + " getMeasuredHeight(): " +
|
||||||
"measuredHeight: " + measuredHeight + " getMeasuredHeight(): " +
|
getMeasuredHeight());
|
||||||
getMeasuredHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (measuredHeight != getMeasuredHeight() && getContext() instanceof ImeUtil.ImeStateHost) {
|
if (measuredHeight != getMeasuredHeight() && getContext() instanceof ImeUtil.ImeStateHost) {
|
||||||
((ImeUtil.ImeStateHost) getContext()).onDisplayHeightChanged(heightMeasureSpec);
|
((ImeUtil.ImeStateHost) getContext()).onDisplayHeightChanged(heightMeasureSpec);
|
||||||
|
|||||||
@@ -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?
|
// Are we coming from a widget click where we're told to scroll to a particular item?
|
||||||
final int scrollToPos = getScrollToMessagePosition();
|
final int scrollToPos = getScrollToMessagePosition();
|
||||||
if (scrollToPos >= 0) {
|
if (scrollToPos >= 0) {
|
||||||
if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(LogUtil.BUGLE_TAG, "onConversationMessagesCursorUpdated " +
|
||||||
LogUtil.v(LogUtil.BUGLE_TAG, "onConversationMessagesCursorUpdated " +
|
" scrollToPos: " + scrollToPos +
|
||||||
" scrollToPos: " + scrollToPos +
|
" cursorCount: " + cursor.getCount());
|
||||||
" cursorCount: " + cursor.getCount());
|
|
||||||
}
|
|
||||||
scrollToPosition(scrollToPos, true /*smoothScroll*/);
|
scrollToPosition(scrollToPos, true /*smoothScroll*/);
|
||||||
clearScrollToMessagePosition();
|
clearScrollToMessagePosition();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
|||||||
ConversationListItemView.HostInterface {
|
ConversationListItemView.HostInterface {
|
||||||
private static final String BUNDLE_ARCHIVED_MODE = "archived_mode";
|
private static final String BUNDLE_ARCHIVED_MODE = "archived_mode";
|
||||||
private static final String BUNDLE_FORWARD_MESSAGE_MODE = "forward_message_mode";
|
private static final String BUNDLE_FORWARD_MESSAGE_MODE = "forward_message_mode";
|
||||||
private static final boolean VERBOSE = false;
|
|
||||||
|
|
||||||
private MenuItem mShowBlockedMenuItem;
|
private MenuItem mShowBlockedMenuItem;
|
||||||
private boolean mArchiveMode;
|
private boolean mArchiveMode;
|
||||||
@@ -241,9 +240,7 @@ public class ConversationListFragment extends Fragment implements ConversationLi
|
|||||||
@Override
|
@Override
|
||||||
public void onAttach(@NonNull final Context context) {
|
public void onAttach(@NonNull final Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
if (VERBOSE) {
|
LogUtil.v(LogUtil.BUGLE_TAG, "Attaching List");
|
||||||
LogUtil.v(LogUtil.BUGLE_TAG, "Attaching List");
|
|
||||||
}
|
|
||||||
final Bundle arguments = getArguments();
|
final Bundle arguments = getArguments();
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
mArchiveMode = arguments.getBoolean(BUNDLE_ARCHIVED_MODE, false);
|
mArchiveMode = arguments.getBoolean(BUNDLE_ARCHIVED_MODE, false);
|
||||||
|
|||||||
@@ -577,8 +577,6 @@ public class ImageUtils {
|
|||||||
* @return whether the image can be down subsampled
|
* @return whether the image can be down subsampled
|
||||||
*/
|
*/
|
||||||
private boolean canBeCompressed() {
|
private boolean canBeCompressed() {
|
||||||
final boolean logv = LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE);
|
|
||||||
|
|
||||||
int imageHeight = mHeight;
|
int imageHeight = mHeight;
|
||||||
int imageWidth = mWidth;
|
int imageWidth = mWidth;
|
||||||
|
|
||||||
@@ -611,13 +609,11 @@ public class ImageUtils {
|
|||||||
Assert.fail("Image cannot be resized"); // http://b/18926934
|
Assert.fail("Image cannot be resized"); // http://b/18926934
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"computeInitialSampleSize: Increasing sampleSize to " + sampleSize
|
||||||
"computeInitialSampleSize: Increasing sampleSize to " + sampleSize
|
+ " as h=" + imageHeight + " vs " + heightLimitWithSlop
|
||||||
+ " as h=" + imageHeight + " vs " + heightLimitWithSlop
|
+ " w=" + imageWidth + " vs " + widthLimitWithSlop
|
||||||
+ " w=" + imageWidth + " vs " + widthLimitWithSlop
|
+ " p=" + imageHeight * imageWidth + " vs " + pixelLimit);
|
||||||
+ " p=" + imageHeight * imageWidth + " vs " + pixelLimit);
|
|
||||||
}
|
|
||||||
imageHeight = mHeight / sampleSize;
|
imageHeight = mHeight / sampleSize;
|
||||||
imageWidth = mWidth / sampleSize;
|
imageWidth = mWidth / sampleSize;
|
||||||
fits = (imageHeight < heightLimitWithSlop &&
|
fits = (imageHeight < heightLimitWithSlop &&
|
||||||
@@ -625,13 +621,11 @@ public class ImageUtils {
|
|||||||
imageHeight * imageWidth < pixelLimit);
|
imageHeight * imageWidth < pixelLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"computeInitialSampleSize: Initial sampleSize " + sampleSize
|
||||||
"computeInitialSampleSize: Initial sampleSize " + sampleSize
|
+ " for h=" + imageHeight + " vs " + heightLimitWithSlop
|
||||||
+ " for h=" + imageHeight + " vs " + heightLimitWithSlop
|
+ " w=" + imageWidth + " vs " + widthLimitWithSlop
|
||||||
+ " w=" + imageWidth + " vs " + widthLimitWithSlop
|
+ " p=" + imageHeight * imageWidth + " vs " + pixelLimit);
|
||||||
+ " p=" + imageHeight * imageWidth + " vs " + pixelLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
mSampleSize = sampleSize;
|
mSampleSize = sampleSize;
|
||||||
return true;
|
return true;
|
||||||
@@ -646,12 +640,9 @@ public class ImageUtils {
|
|||||||
byte[] encoded = null;
|
byte[] encoded = null;
|
||||||
try {
|
try {
|
||||||
final ContentResolver cr = mContext.getContentResolver();
|
final ContentResolver cr = mContext.getContentResolver();
|
||||||
final boolean logv = LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE);
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: attempt=" + attempt
|
||||||
if (logv) {
|
+ " limit (w=" + mWidthLimit + " h=" + mHeightLimit + ") quality="
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: attempt=" + attempt
|
+ mQuality + " scale=" + mScaleFactor + " sampleSize=" + mSampleSize);
|
||||||
+ " limit (w=" + mWidthLimit + " h=" + mHeightLimit + ") quality="
|
|
||||||
+ mQuality + " scale=" + mScaleFactor + " sampleSize=" + mSampleSize);
|
|
||||||
}
|
|
||||||
if (mScaled == null) {
|
if (mScaled == null) {
|
||||||
if (mDecoded == null) {
|
if (mDecoded == null) {
|
||||||
mOptions.inSampleSize = mSampleSize;
|
mOptions.inSampleSize = mSampleSize;
|
||||||
@@ -661,17 +652,13 @@ public class ImageUtils {
|
|||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
if (mDecoded == null) {
|
if (mDecoded == null) {
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"getResizedImageData: got empty decoded bitmap");
|
||||||
"getResizedImageData: got empty decoded bitmap");
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: decoded w,h="
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: decoded w,h="
|
+ mDecoded.getWidth() + "," + mDecoded.getHeight());
|
||||||
+ mDecoded.getWidth() + "," + mDecoded.getHeight());
|
|
||||||
}
|
|
||||||
// Make sure to scale the decoded image if dimension is not within limit
|
// Make sure to scale the decoded image if dimension is not within limit
|
||||||
final int decodedWidth = mDecoded.getWidth();
|
final int decodedWidth = mDecoded.getWidth();
|
||||||
final int decodedHeight = mDecoded.getHeight();
|
final int decodedHeight = mDecoded.getHeight();
|
||||||
@@ -693,23 +680,19 @@ public class ImageUtils {
|
|||||||
mScaled = Bitmap.createBitmap(mDecoded, 0, 0, decodedWidth, decodedHeight,
|
mScaled = Bitmap.createBitmap(mDecoded, 0, 0, decodedWidth, decodedHeight,
|
||||||
mMatrix, false /* filter */);
|
mMatrix, false /* filter */);
|
||||||
if (mScaled == null) {
|
if (mScaled == null) {
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"getResizedImageData: got empty scaled bitmap");
|
||||||
"getResizedImageData: got empty scaled bitmap");
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: scaled w,h="
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: scaled w,h="
|
+ mScaled.getWidth() + "," + mScaled.getHeight());
|
||||||
+ mScaled.getWidth() + "," + mScaled.getHeight());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mScaled = mDecoded;
|
mScaled = mDecoded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now encode it at current quality
|
// Now encode it at current quality
|
||||||
encoded = ImageUtils.bitmapToBytes(mScaled, mQuality);
|
encoded = ImageUtils.bitmapToBytes(mScaled, mQuality);
|
||||||
if (encoded != null && logv) {
|
if (encoded != null) {
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
"getResizedImageData: Encoded down to " + encoded.length + "@"
|
"getResizedImageData: Encoded down to " + encoded.length + "@"
|
||||||
+ mScaled.getWidth() + "/" + mScaled.getHeight() + "~"
|
+ mScaled.getWidth() + "/" + mScaled.getHeight() + "~"
|
||||||
@@ -729,7 +712,6 @@ public class ImageUtils {
|
|||||||
* @param currentSize encoded image size (will be 0 if OOM)
|
* @param currentSize encoded image size (will be 0 if OOM)
|
||||||
*/
|
*/
|
||||||
private void updateRecodeParameters(final int currentSize) {
|
private void updateRecodeParameters(final int currentSize) {
|
||||||
final boolean logv = LogUtil.isLoggable(LogUtil.BUGLE_IMAGE_TAG, LogUtil.VERBOSE);
|
|
||||||
// Only return data within the limit
|
// Only return data within the limit
|
||||||
if (currentSize > 0 &&
|
if (currentSize > 0 &&
|
||||||
mQuality > MINIMUM_IMAGE_COMPRESSION_QUALITY) {
|
mQuality > MINIMUM_IMAGE_COMPRESSION_QUALITY) {
|
||||||
@@ -738,10 +720,8 @@ public class ImageUtils {
|
|||||||
mQuality = Math.max(MINIMUM_IMAGE_COMPRESSION_QUALITY,
|
mQuality = Math.max(MINIMUM_IMAGE_COMPRESSION_QUALITY,
|
||||||
Math.min((int) (mQuality * Math.sqrt((1.0 * mByteLimit) / currentSize)),
|
Math.min((int) (mQuality * Math.sqrt((1.0 * mByteLimit) / currentSize)),
|
||||||
(int) (mQuality * QUALITY_SCALE_DOWN_RATIO)));
|
(int) (mQuality * QUALITY_SCALE_DOWN_RATIO)));
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"getResizedImageData: Retrying at quality " + mQuality);
|
||||||
"getResizedImageData: Retrying at quality " + mQuality);
|
|
||||||
}
|
|
||||||
} else if (currentSize > 0 &&
|
} else if (currentSize > 0 &&
|
||||||
mScaleFactor < 2.0 * MIN_SCALE_DOWN_RATIO * MIN_SCALE_DOWN_RATIO) {
|
mScaleFactor < 2.0 * MIN_SCALE_DOWN_RATIO * MIN_SCALE_DOWN_RATIO) {
|
||||||
// JPEG compression failed to hit target size - need smaller image
|
// 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)
|
// 2.0 / MIN_SCALE_DOWN_RATIO (arbitrary limit)
|
||||||
mQuality = IMAGE_COMPRESSION_QUALITY;
|
mQuality = IMAGE_COMPRESSION_QUALITY;
|
||||||
mScaleFactor = mScaleFactor / MIN_SCALE_DOWN_RATIO;
|
mScaleFactor = mScaleFactor / MIN_SCALE_DOWN_RATIO;
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"getResizedImageData: Retrying at scale " + mScaleFactor);
|
||||||
"getResizedImageData: Retrying at scale " + mScaleFactor);
|
|
||||||
}
|
|
||||||
// Release scaled bitmap to trigger rescaling
|
// Release scaled bitmap to trigger rescaling
|
||||||
if (mScaled != null && mScaled != mDecoded) {
|
if (mScaled != null && mScaled != mDecoded) {
|
||||||
mScaled.recycle();
|
mScaled.recycle();
|
||||||
@@ -764,19 +742,15 @@ public class ImageUtils {
|
|||||||
// Then before we subsample try cleaning up our cached memory
|
// Then before we subsample try cleaning up our cached memory
|
||||||
Factory.get().reclaimMemory();
|
Factory.get().reclaimMemory();
|
||||||
mHasReclaimedMemory = true;
|
mHasReclaimedMemory = true;
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
"getResizedImageData: Retrying after reclaiming memory ");
|
||||||
"getResizedImageData: Retrying after reclaiming memory ");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Last resort - subsample image by another factor of 2 and try again
|
// Last resort - subsample image by another factor of 2 and try again
|
||||||
mSampleSize = mSampleSize * 2;
|
mSampleSize = mSampleSize * 2;
|
||||||
mQuality = IMAGE_COMPRESSION_QUALITY;
|
mQuality = IMAGE_COMPRESSION_QUALITY;
|
||||||
mScaleFactor = 1.0f;
|
mScaleFactor = 1.0f;
|
||||||
if (logv) {
|
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG, "getResizedImageData: Retrying at sampleSize "
|
||||||
LogUtil.v(LogUtil.BUGLE_IMAGE_TAG,
|
+ mSampleSize);
|
||||||
"getResizedImageData: Retrying at sampleSize " + mSampleSize);
|
|
||||||
}
|
|
||||||
// Release all bitmaps to trigger subsampling
|
// Release all bitmaps to trigger subsampling
|
||||||
if (mScaled != null && mScaled != mDecoded) {
|
if (mScaled != null && mScaled != mDecoded) {
|
||||||
mScaled.recycle();
|
mScaled.recycle();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package com.android.messaging.util;
|
package com.android.messaging.util;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log utility class.
|
* Log utility class.
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +45,9 @@ public class LogUtil {
|
|||||||
* @param msg The message you would like logged.
|
* @param msg The message you would like logged.
|
||||||
*/
|
*/
|
||||||
public static void v(final String tag, final String msg) {
|
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
|
* @param tr An exception to log
|
||||||
*/
|
*/
|
||||||
public static void v(final String tag, final String msg, final Throwable tr) {
|
public static void v(final String tag, final String msg, final Throwable tr) {
|
||||||
println(android.util.Log.VERBOSE, tag, msg + '\n'
|
println(VERBOSE, tag, msg + '\n' + Log.getStackTraceString(tr));
|
||||||
+ android.util.Log.getStackTraceString(tr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +68,7 @@ public class LogUtil {
|
|||||||
* @param msg The message you would like logged.
|
* @param msg The message you would like logged.
|
||||||
*/
|
*/
|
||||||
public static void d(final String tag, final String msg) {
|
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
|
* @param tr An exception to log
|
||||||
*/
|
*/
|
||||||
public static void d(final String tag, final String msg, final Throwable tr) {
|
public static void d(final String tag, final String msg, final Throwable tr) {
|
||||||
println(android.util.Log.DEBUG, tag, msg + '\n'
|
println(DEBUG, tag, msg + '\n' + Log.getStackTraceString(tr));
|
||||||
+ android.util.Log.getStackTraceString(tr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +89,7 @@ public class LogUtil {
|
|||||||
* @param msg The message you would like logged.
|
* @param msg The message you would like logged.
|
||||||
*/
|
*/
|
||||||
public static void i(final String tag, final String msg) {
|
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
|
* @param tr An exception to log
|
||||||
*/
|
*/
|
||||||
public static void i(final String tag, final String msg, final Throwable tr) {
|
public static void i(final String tag, final String msg, final Throwable tr) {
|
||||||
println(android.util.Log.INFO, tag, msg + '\n'
|
println(INFO, tag, msg + '\n' + Log.getStackTraceString(tr));
|
||||||
+ android.util.Log.getStackTraceString(tr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,7 +110,7 @@ public class LogUtil {
|
|||||||
* @param msg The message you would like logged.
|
* @param msg The message you would like logged.
|
||||||
*/
|
*/
|
||||||
public static void w(final String tag, final String msg) {
|
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
|
* @param tr An exception to log
|
||||||
*/
|
*/
|
||||||
public static void w(final String tag, final String msg, final Throwable tr) {
|
public static void w(final String tag, final String msg, final Throwable tr) {
|
||||||
println(android.util.Log.WARN, tag, msg);
|
println(WARN, tag, msg);
|
||||||
println(android.util.Log.WARN, tag, android.util.Log.getStackTraceString(tr));
|
println(WARN, tag, android.util.Log.getStackTraceString(tr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +132,7 @@ public class LogUtil {
|
|||||||
* @param msg The message you would like logged.
|
* @param msg The message you would like logged.
|
||||||
*/
|
*/
|
||||||
public static void e(final String tag, final String msg) {
|
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
|
* @param tr An exception to log
|
||||||
*/
|
*/
|
||||||
public static void e(final String tag, final String msg, final Throwable tr) {
|
public static void e(final String tag, final String msg, final Throwable tr) {
|
||||||
println(android.util.Log.ERROR, tag, msg);
|
println(ERROR, tag, msg);
|
||||||
println(android.util.Log.ERROR, tag, android.util.Log.getStackTraceString(tr));
|
println(ERROR, tag, Log.getStackTraceString(tr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,7 +159,7 @@ public class LogUtil {
|
|||||||
public static void wtf(final String tag, final String msg) {
|
public static void wtf(final String tag, final String msg) {
|
||||||
// Make sure this goes into our log buffer
|
// Make sure this goes into our log buffer
|
||||||
println(android.util.Log.ASSERT, tag, "wtf\n" + msg);
|
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) {
|
public static void wtf(final String tag, final String msg, final Throwable tr) {
|
||||||
// Make sure this goes into our log buffer
|
// Make sure this goes into our log buffer
|
||||||
println(android.util.Log.ASSERT, tag, "wtf\n" + msg + '\n' +
|
println(android.util.Log.ASSERT, tag, "wtf\n" + msg + '\n' +
|
||||||
android.util.Log.getStackTraceString(tr));
|
Log.getStackTraceString(tr));
|
||||||
android.util.Log.wtf(tag, msg, tr);
|
Log.wtf(tag, msg, tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +187,7 @@ public class LogUtil {
|
|||||||
* @param msg The message you would like logged.
|
* @param msg The message you would like logged.
|
||||||
*/
|
*/
|
||||||
private static void println(final int level, final String tag, final String msg) {
|
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.
|
* See {@link android.util.Log#isLoggable(String, int)} for more discussion.
|
||||||
*/
|
*/
|
||||||
public static boolean isLoggable(final String tag, final int level) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (android.util.Log.isLoggable(BUGLE_TAG, android.util.Log.DEBUG)) {
|
if (Log.isLoggable(BUGLE_TAG, DEBUG)) {
|
||||||
return text;
|
return text;
|
||||||
} else {
|
} else {
|
||||||
return "Redacted-" + text.length();
|
return "Redacted-" + text.length();
|
||||||
|
|||||||
@@ -47,10 +47,7 @@ public class LoggingTimer {
|
|||||||
*/
|
*/
|
||||||
public void start() {
|
public void start() {
|
||||||
mStartMillis = SystemClock.elapsedRealtime();
|
mStartMillis = SystemClock.elapsedRealtime();
|
||||||
|
LogUtil.v(mTag, "Timer start for " + mName);
|
||||||
if (LogUtil.isLoggable(mTag, LogUtil.VERBOSE)) {
|
|
||||||
LogUtil.v(mTag, "Timer start for " + mName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +62,7 @@ public class LoggingTimer {
|
|||||||
|
|
||||||
if (mWarnLimitMillis != NO_WARN_LIMIT && elapsedMs > mWarnLimitMillis) {
|
if (mWarnLimitMillis != NO_WARN_LIMIT && elapsedMs > mWarnLimitMillis) {
|
||||||
LogUtil.w(mTag, logMessage);
|
LogUtil.w(mTag, logMessage);
|
||||||
} else if (LogUtil.isLoggable(mTag, LogUtil.VERBOSE)) {
|
} else {
|
||||||
LogUtil.v(mTag, logMessage);
|
LogUtil.v(mTag, logMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.
|
* most 127 Unicode code units long.
|
||||||
*/
|
*/
|
||||||
public static void beginSection(String sectionName) {
|
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);
|
sTrace.beginSection(sectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,9 +67,7 @@ public final class Trace {
|
|||||||
*/
|
*/
|
||||||
public static void endSection() {
|
public static void endSection() {
|
||||||
sTrace.endSection();
|
sTrace.endSection();
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "endSection()");
|
||||||
LogUtil.v(TAG, "endSection()");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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(
|
mAppWidgetId = intent.getIntExtra(
|
||||||
AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
||||||
mAppWidgetManager = AppWidgetManager.getInstance(context);
|
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()
|
mIconSize = (int) context.getResources()
|
||||||
.getDimension(R.dimen.contact_icon_view_normal_size);
|
.getDimension(R.dimen.contact_icon_view_normal_size);
|
||||||
|
|
||||||
@@ -77,16 +75,12 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "onCreate");
|
||||||
LogUtil.v(TAG, "onCreate");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "onDestroy");
|
||||||
LogUtil.v(TAG, "onDestroy");
|
|
||||||
}
|
|
||||||
synchronized (sWidgetLock) {
|
synchronized (sWidgetLock) {
|
||||||
if (mCursor != null && !mCursor.isClosed()) {
|
if (mCursor != null && !mCursor.isClosed()) {
|
||||||
mCursor.close();
|
mCursor.close();
|
||||||
@@ -97,9 +91,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataSetChanged() {
|
public void onDataSetChanged() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "onDataSetChanged");
|
||||||
LogUtil.v(TAG, "onDataSetChanged");
|
|
||||||
}
|
|
||||||
synchronized (sWidgetLock) {
|
synchronized (sWidgetLock) {
|
||||||
if (mCursor != null) {
|
if (mCursor != null) {
|
||||||
mCursor.close();
|
mCursor.close();
|
||||||
@@ -126,15 +118,11 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor
|
|||||||
public int getCount() {
|
public int getCount() {
|
||||||
synchronized (sWidgetLock) {
|
synchronized (sWidgetLock) {
|
||||||
if (mCursor == null) {
|
if (mCursor == null) {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getCount: 0");
|
||||||
LogUtil.v(TAG, "getCount: 0");
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
final int count = getItemCount();
|
final int count = getItemCount();
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getCount: " + count);
|
||||||
LogUtil.v(TAG, "getCount: " + count);
|
|
||||||
}
|
|
||||||
mShouldShowViewMore = count < mCursor.getCount();
|
mShouldShowViewMore = count < mCursor.getCount();
|
||||||
return count + (mShouldShowViewMore ? 1 : 0);
|
return count + (mShouldShowViewMore ? 1 : 0);
|
||||||
}
|
}
|
||||||
@@ -146,9 +134,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor
|
|||||||
* in the list.
|
* in the list.
|
||||||
*/
|
*/
|
||||||
protected int getItemCount() {
|
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);
|
return Math.min(mCursor.getCount(), MAX_ITEMS_TO_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,9 +191,7 @@ abstract class BaseWidgetFactory implements RemoteViewsService.RemoteViewsFactor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onLoadComplete() {
|
private void onLoadComplete() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "onLoadComplete");
|
||||||
LogUtil.v(TAG, "onLoadComplete");
|
|
||||||
}
|
|
||||||
final RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(),
|
final RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(),
|
||||||
getMainLayoutId());
|
getMainLayoutId());
|
||||||
mAppWidgetManager.partiallyUpdateAppWidget(mAppWidgetId, remoteViews);
|
mAppWidgetManager.partiallyUpdateAppWidget(mAppWidgetId, remoteViews);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
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();
|
final String action = intent.getAction();
|
||||||
|
|
||||||
// The base class AppWidgetProvider's onReceive handles the normal widget intents. Here
|
// 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) {
|
if (appWidgetIds.length > 0) {
|
||||||
// We need to update all Bugle app widgets on the home screen.
|
// We need to update all Bugle app widgets on the home screen.
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "onReceive notifyAppWidgetViewDataChanged listId: " +
|
||||||
LogUtil.v(TAG, "onReceive notifyAppWidgetViewDataChanged listId: " +
|
getListId() + " first widgetId: " + appWidgetIds[0]);
|
||||||
getListId() + " first widgetId: " + appWidgetIds[0]);
|
|
||||||
}
|
|
||||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, getListId());
|
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, getListId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -95,9 +91,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
protected abstract void updateWidget(Context context, int appWidgetId);
|
protected abstract void updateWidget(Context context, int appWidgetId);
|
||||||
|
|
||||||
private int getWidgetSize(AppWidgetManager appWidgetManager, 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
|
// Get the dimensions
|
||||||
final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||||
@@ -110,10 +104,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
final int rows = getCellsForSize(minHeight);
|
final int rows = getCellsForSize(minHeight);
|
||||||
final int columns = getCellsForSize(minWidth);
|
final int columns = getCellsForSize(minWidth);
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize row: " + rows
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize row: " + rows
|
+ " columns: " + columns);
|
||||||
+ " columns: " + columns);
|
|
||||||
}
|
|
||||||
|
|
||||||
int size = SIZE_MEDIUM;
|
int size = SIZE_MEDIUM;
|
||||||
if (rows == 1) {
|
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.
|
// The size changed. We have to force the widget to rebuild the list.
|
||||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, getListId());
|
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, getListId());
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize old size: " + savedSize
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize old size: " + savedSize
|
+ " new size saved: " + size);
|
||||||
+ " new size saved: " + size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
@@ -159,11 +149,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
int appWidgetId, Bundle newOptions) {
|
int appWidgetId, Bundle newOptions) {
|
||||||
|
|
||||||
final int widgetSize = getWidgetSize(appWidgetManager, appWidgetId);
|
final int widgetSize = getWidgetSize(appWidgetManager, appWidgetId);
|
||||||
|
LogUtil.v(TAG, "BaseWidgetProvider.onAppWidgetOptionsChanged new size: " +
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
widgetSize);
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.onAppWidgetOptionsChanged new size: " +
|
|
||||||
widgetSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
|
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
|
||||||
}
|
}
|
||||||
@@ -177,10 +164,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void onDeleted(Context context, int[] appWidgetIds) {
|
public void onDeleted(Context context, int[] appWidgetIds) {
|
||||||
super.onDeleted(context, appWidgetIds);
|
super.onDeleted(context, appWidgetIds);
|
||||||
|
LogUtil.v(TAG, "BaseWidgetProvider.onDeleted");
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.onDeleted");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final int widgetId : appWidgetIds) {
|
for (final int widgetId : appWidgetIds) {
|
||||||
deletePreferences(widgetId);
|
deletePreferences(widgetId);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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) {
|
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(),
|
final RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
|
||||||
R.layout.widget_conversation_list);
|
R.layout.widget_conversation_list);
|
||||||
PendingIntent clickIntent;
|
PendingIntent clickIntent;
|
||||||
@@ -102,9 +100,7 @@ public class BugleWidgetProvider extends BaseWidgetProvider {
|
|||||||
* update and reflect the changes
|
* update and reflect the changes
|
||||||
*/
|
*/
|
||||||
public static void notifyConversationListChanged(final Context context) {
|
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);
|
final Intent intent = new Intent(ACTION_NOTIFY_CONVERSATIONS_CHANGED);
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -51,9 +51,7 @@ public class WidgetConversationListService extends RemoteViewsService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteViewsFactory onGetViewFactory(Intent intent) {
|
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);
|
return new WidgetConversationListFactory(getApplicationContext(), intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,9 +78,7 @@ public class WidgetConversationListService extends RemoteViewsService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public RemoteViews getViewAt(int position) {
|
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) {
|
synchronized (sWidgetLock) {
|
||||||
// "View more conversations" view.
|
// "View more conversations" view.
|
||||||
if (mCursor == null
|
if (mCursor == null
|
||||||
@@ -129,10 +125,8 @@ public class WidgetConversationListService extends RemoteViewsService {
|
|||||||
// Avatar
|
// Avatar
|
||||||
boolean includeAvatar;
|
boolean includeAvatar;
|
||||||
final Bundle options = mAppWidgetManager.getAppWidgetOptions(mAppWidgetId);
|
final Bundle options = mAppWidgetManager.getAppWidgetOptions(mAppWidgetId);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " +
|
||||||
LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " +
|
options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY));
|
||||||
options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY));
|
|
||||||
}
|
|
||||||
|
|
||||||
includeAvatar = options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY) ==
|
includeAvatar = options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY) ==
|
||||||
BugleWidgetProvider.SIZE_LARGE;
|
BugleWidgetProvider.SIZE_LARGE;
|
||||||
@@ -231,9 +225,7 @@ public class WidgetConversationListService extends RemoteViewsService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected RemoteViews getViewMoreItemsView() {
|
protected RemoteViews getViewMoreItemsView() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getViewMoreItemsView");
|
||||||
LogUtil.v(TAG, "getViewMoreItemsView");
|
|
||||||
}
|
|
||||||
final RemoteViews view = new RemoteViews(mContext.getPackageName(),
|
final RemoteViews view = new RemoteViews(mContext.getPackageName(),
|
||||||
R.layout.widget_loading);
|
R.layout.widget_loading);
|
||||||
view.setTextViewText(
|
view.setTextViewText(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -56,9 +56,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void updateWidget(final Context context, final int appWidgetId) {
|
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()) {
|
if (OsUtil.hasRequiredPermissions()) {
|
||||||
rebuildWidget(context, appWidgetId);
|
rebuildWidget(context, appWidgetId);
|
||||||
} else {
|
} else {
|
||||||
@@ -78,9 +76,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void rebuildWidget(final Context context, final int appWidgetId) {
|
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(),
|
final RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
|
||||||
R.layout.widget_conversation);
|
R.layout.widget_conversation);
|
||||||
PendingIntent clickIntent;
|
PendingIntent clickIntent;
|
||||||
@@ -100,10 +96,8 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
clickIntent = uiIntents.getWidgetPendingIntentForConversationListActivity(context);
|
clickIntent = uiIntents.getWidgetPendingIntentForConversationListActivity(context);
|
||||||
remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);
|
remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent);
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "WidgetConversationProvider.rebuildWidget appWidgetId: " +
|
||||||
LogUtil.v(TAG, "WidgetConversationProvider.rebuildWidget appWidgetId: " +
|
appWidgetId + " going into configure state");
|
||||||
appWidgetId + " going into configure state");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
remoteViews.setViewVisibility(R.id.widget_label, View.VISIBLE);
|
remoteViews.setViewVisibility(R.id.widget_label, View.VISIBLE);
|
||||||
remoteViews.setViewVisibility(R.id.message_list, View.VISIBLE);
|
remoteViews.setViewVisibility(R.id.message_list, View.VISIBLE);
|
||||||
@@ -164,9 +158,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
* update and reflect the changes
|
* update and reflect the changes
|
||||||
*/
|
*/
|
||||||
public static void notifyMessagesChanged(final Context context, final String conversationId) {
|
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);
|
final Intent intent = new Intent(ACTION_NOTIFY_MESSAGES_CHANGED);
|
||||||
intent.putExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID, conversationId);
|
intent.putExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID, conversationId);
|
||||||
context.sendBroadcast(intent);
|
context.sendBroadcast(intent);
|
||||||
@@ -179,9 +171,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
*/
|
*/
|
||||||
public static void notifyConversationDeleted(final Context context,
|
public static void notifyConversationDeleted(final Context context,
|
||||||
final String conversationId) {
|
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);
|
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
for (final int appWidgetId : appWidgetManager.getAppWidgetIds(new ComponentName(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,
|
public static void notifyConversationRenamed(final Context context,
|
||||||
final String conversationId) {
|
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);
|
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
for (final int appWidgetId : appWidgetManager.getAppWidgetIds(new ComponentName(context,
|
for (final int appWidgetId : appWidgetManager.getAppWidgetIds(new ComponentName(context,
|
||||||
@@ -224,9 +212,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
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();
|
final String action = intent.getAction();
|
||||||
|
|
||||||
// The base class AppWidgetProvider's onReceive handles the normal widget intents. Here
|
// The base class AppWidgetProvider's onReceive handles the normal widget intents. Here
|
||||||
@@ -239,9 +225,7 @@ public class WidgetConversationProvider extends BaseWidgetProvider {
|
|||||||
this.getClass()));
|
this.getClass()));
|
||||||
|
|
||||||
if (appWidgetIds.length == 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
// Normally the conversation id points to a specific conversation and we only update
|
// Normally the conversation id points to a specific conversation and we only update
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 The Android Open Source Project
|
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -61,9 +61,7 @@ public class WidgetConversationService extends RemoteViewsService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RemoteViewsFactory onGetViewFactory(Intent intent) {
|
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);
|
return new WidgetConversationFactory(getApplicationContext(), intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,18 +76,14 @@ public class WidgetConversationService extends RemoteViewsService {
|
|||||||
super(context, intent);
|
super(context, intent);
|
||||||
|
|
||||||
mConversationId = intent.getStringExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID);
|
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()
|
mIconSize = (int) context.getResources()
|
||||||
.getDimension(R.dimen.contact_icon_view_normal_size);
|
.getDimension(R.dimen.contact_icon_view_normal_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "onCreate");
|
||||||
LogUtil.v(TAG, "onCreate");
|
|
||||||
}
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
// If the conversation for this widget has been removed, we want to update the widget to
|
// 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) {
|
if (cursorCount > MAX_ITEMS_TO_SHOW) {
|
||||||
scrollToPosition += cursorCount - MAX_ITEMS_TO_SHOW;
|
scrollToPosition += cursorCount - MAX_ITEMS_TO_SHOW;
|
||||||
}
|
}
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getViewAt position: " + originalPosition +
|
||||||
LogUtil.v(TAG, "getViewAt position: " + originalPosition +
|
" computed position: " + position +
|
||||||
" computed position: " + position +
|
" scrollToPosition: " + scrollToPosition +
|
||||||
" scrollToPosition: " + scrollToPosition +
|
" cursorCount: " + cursorCount +
|
||||||
" cursorCount: " + cursorCount +
|
" MAX_ITEMS_TO_SHOW: " + MAX_ITEMS_TO_SHOW);
|
||||||
" MAX_ITEMS_TO_SHOW: " + MAX_ITEMS_TO_SHOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
intent.putExtra(UIIntents.UI_INTENT_EXTRA_MESSAGE_POSITION, scrollToPosition);
|
intent.putExtra(UIIntents.UI_INTENT_EXTRA_MESSAGE_POSITION, scrollToPosition);
|
||||||
if (message.hasAttachments()) {
|
if (message.hasAttachments()) {
|
||||||
@@ -214,10 +206,8 @@ public class WidgetConversationService extends RemoteViewsService {
|
|||||||
|
|
||||||
// Avatar
|
// Avatar
|
||||||
final Bundle options = mAppWidgetManager.getAppWidgetOptions(mAppWidgetId);
|
final Bundle options = mAppWidgetManager.getAppWidgetOptions(mAppWidgetId);
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " +
|
||||||
LogUtil.v(TAG, "getViewAt BugleWidgetProvider.WIDGET_SIZE_KEY: " +
|
options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY));
|
||||||
options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY));
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean includeAvatar = options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY)
|
boolean includeAvatar = options.getInt(BugleWidgetProvider.WIDGET_SIZE_KEY)
|
||||||
== BugleWidgetProvider.SIZE_LARGE;
|
== BugleWidgetProvider.SIZE_LARGE;
|
||||||
@@ -460,9 +450,7 @@ public class WidgetConversationService extends RemoteViewsService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected RemoteViews getViewMoreItemsView() {
|
protected RemoteViews getViewMoreItemsView() {
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
LogUtil.v(TAG, "getViewMoreConversationsView");
|
||||||
LogUtil.v(TAG, "getViewMoreConversationsView");
|
|
||||||
}
|
|
||||||
final RemoteViews view = new RemoteViews(mContext.getPackageName(),
|
final RemoteViews view = new RemoteViews(mContext.getPackageName(),
|
||||||
R.layout.widget_loading);
|
R.layout.widget_loading);
|
||||||
view.setTextViewText(
|
view.setTextViewText(
|
||||||
|
|||||||
Reference in New Issue
Block a user