From 4eb2f16ef1f716e68c57d6e8e54727484add4b6e Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Fri, 29 Jul 2022 13:25:44 -0400 Subject: [PATCH] Keep logs concerning decryption errors longer. --- .../securesms/jobs/AutomaticSessionResetJob.java | 12 ++++++------ .../securesms/messages/MessageDecryptionUtil.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/AutomaticSessionResetJob.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/AutomaticSessionResetJob.java index 81382da3d4..f19102cbcc 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/AutomaticSessionResetJob.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/AutomaticSessionResetJob.java @@ -93,21 +93,21 @@ public class AutomaticSessionResetJob extends BaseJob { DeviceLastResetTime resetTimes = SignalDatabase.recipients().getLastSessionResetTimes(recipientId); long timeSinceLastReset = System.currentTimeMillis() - getLastResetTime(resetTimes, deviceId); - Log.i(TAG, "DeviceId: " + deviceId + ", Reset interval: " + resetInterval + ", Time since last reset: " + timeSinceLastReset); + Log.i(TAG, "DeviceId: " + deviceId + ", Reset interval: " + resetInterval + ", Time since last reset: " + timeSinceLastReset, true); if (timeSinceLastReset > resetInterval) { - Log.i(TAG, "We're good! Sending a null message."); + Log.i(TAG, "We're good! Sending a null message.", true); SignalDatabase.recipients().setLastSessionResetTime(recipientId, setLastResetTime(resetTimes, deviceId, System.currentTimeMillis())); - Log.i(TAG, "Marked last reset time: " + System.currentTimeMillis()); + Log.i(TAG, "Marked last reset time: " + System.currentTimeMillis(), true); sendNullMessage(); - Log.i(TAG, "Successfully sent!"); + Log.i(TAG, "Successfully sent!", true); } else { - Log.w(TAG, "Too soon! Time since last reset: " + timeSinceLastReset); + Log.w(TAG, "Too soon! Time since last reset: " + timeSinceLastReset, true); } } else { - Log.w(TAG, "Automatic session reset send disabled!"); + Log.w(TAG, "Automatic session reset send disabled!", true); } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/messages/MessageDecryptionUtil.java b/app/src/main/java/org/thoughtcrime/securesms/messages/MessageDecryptionUtil.java index 412dfe4635..74946836c4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/messages/MessageDecryptionUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/messages/MessageDecryptionUtil.java @@ -112,7 +112,7 @@ public final class MessageDecryptionUtil { return DecryptionResult.forError(MessageState.INVALID_VERSION, toExceptionMetadata(e), jobs); } catch (ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException | ProtocolNoSessionException | ProtocolInvalidMessageException e) { - Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); + Log.w(TAG, String.valueOf(envelope.getTimestamp()), e, true); Recipient sender = Recipient.external(context, e.getSender()); if (sender.supportsMessageRetries() && Recipient.self().supportsMessageRetries() && FeatureFlags.retryReceipts()) { @@ -155,11 +155,11 @@ public final class MessageDecryptionUtil { try { groupId = Optional.of(GroupId.push(protocolException.getGroupId().get())); } catch (BadGroupIdException e) { - Log.w(TAG, "[" + envelope.getTimestamp() + "] Bad groupId!"); + Log.w(TAG, "[" + envelope.getTimestamp() + "] Bad groupId!", true); } } - Log.w(TAG, "[" + envelope.getTimestamp() + "] Could not decrypt a message with a type of " + contentHint); + Log.w(TAG, "[" + envelope.getTimestamp() + "] Could not decrypt a message with a type of " + contentHint, true); long threadId; @@ -172,16 +172,16 @@ public final class MessageDecryptionUtil { switch (contentHint) { case DEFAULT: - Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting an error right away because it's " + contentHint); + Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting an error right away because it's " + contentHint, true); SignalDatabase.sms().insertBadDecryptMessage(sender.getId(), senderDevice, envelope.getTimestamp(), receivedTimestamp, threadId); break; case RESENDABLE: - Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting into pending retries store because it's " + contentHint); + Log.w(TAG, "[" + envelope.getTimestamp() + "] Inserting into pending retries store because it's " + contentHint, true); ApplicationDependencies.getPendingRetryReceiptCache().insert(sender.getId(), senderDevice, envelope.getTimestamp(), receivedTimestamp, threadId); ApplicationDependencies.getPendingRetryReceiptManager().scheduleIfNecessary(); break; case IMPLICIT: - Log.w(TAG, "[" + envelope.getTimestamp() + "] Not inserting any error because it's " + contentHint); + Log.w(TAG, "[" + envelope.getTimestamp() + "] Not inserting any error because it's " + contentHint, true); break; }