diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/BubbleUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/BubbleUtil.java index 4b89cde5bc..93e185b000 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/BubbleUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/BubbleUtil.java @@ -33,6 +33,7 @@ import static org.thoughtcrime.securesms.util.ConversationUtil.CONVERSATION_SUPP public final class BubbleUtil { private static final String TAG = Log.tag(BubbleUtil.class); + private static String currentState = ""; private BubbleUtil() { } @@ -75,25 +76,29 @@ public final class BubbleUtil { final StringBuilder bubbleLoggingMessage = new StringBuilder("Bubble State:"); if (Build.VERSION.SDK_INT < 31) { - bubbleLoggingMessage.append("\nisBelowApi31 = true"); + bubbleLoggingMessage.append("\tisBelowApi31 = true"); } else { - bubbleLoggingMessage.append("\nnotificationManager.areBubblesEnabled() = ").append(notificationManager.areBubblesEnabled()); - bubbleLoggingMessage.append("\nnotificationManager.getBubblePreference() = ").append(notificationManager.getBubblePreference()); + bubbleLoggingMessage.append("\tnm.areBubblesEnabled() = ").append(notificationManager.areBubblesEnabled()); + bubbleLoggingMessage.append("\tnm.getBubblePreference() = ").append(notificationManager.getBubblePreference()); } - bubbleLoggingMessage.append("\nnotificationManager.areBubblesAllowed() = ").append(notificationManager.areBubblesAllowed()); + bubbleLoggingMessage.append("\tnm.areBubblesAllowed() = ").append(notificationManager.areBubblesAllowed()); if (conversationChannel != null) { - bubbleLoggingMessage.append("\nconversationChannel.canBubble() = ").append(conversationChannel.canBubble()); + bubbleLoggingMessage.append("\tcc.canBubble(").append(conversationChannel.getId()).append(") = ").append(conversationChannel.canBubble()); } else { - bubbleLoggingMessage.append("\nconversationChannel = null"); + bubbleLoggingMessage.append("\tcc = null"); } boolean canBubble = (Build.VERSION.SDK_INT < 31 || (notificationManager.areBubblesEnabled() && notificationManager.getBubblePreference() != NotificationManager.BUBBLE_PREFERENCE_NONE)) && (notificationManager.areBubblesAllowed() || (conversationChannel != null && conversationChannel.canBubble())); - bubbleLoggingMessage.append("\nComputed canBubble: ").append(canBubble); - Log.d(TAG, bubbleLoggingMessage.toString()); + bubbleLoggingMessage.append("\tFinal answer… canBubble: ").append(canBubble); + final String state = bubbleLoggingMessage.toString(); + if (!state.equals(currentState)) { + Log.d(TAG, state); + currentState = state; + } return canBubble; }