From 31e3e37c9bfb0c24b32988243ff9961fb29c6cb5 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Tue, 16 Mar 2021 15:06:55 -0400 Subject: [PATCH] Improve logging for remapped recipients. --- .../thoughtcrime/securesms/database/RecipientDatabase.java | 2 +- .../org/thoughtcrime/securesms/database/RemappedRecords.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/RecipientDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/RecipientDatabase.java index 58f2f06f33..dd191626fa 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/RecipientDatabase.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/RecipientDatabase.java @@ -701,7 +701,7 @@ public class RecipientDatabase extends Database { } else { Optional remapped = RemappedRecords.getInstance().getRecipient(context, id); if (remapped.isPresent()) { - Log.w(TAG, "Missing recipient, but found it in the remapped records."); + Log.w(TAG, "Missing recipient for " + id + ", but found it in the remapped records as " + remapped.get()); return getRecipientSettings(remapped.get()); } else { throw new MissingRecipientException(id); diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/RemappedRecords.java b/app/src/main/java/org/thoughtcrime/securesms/database/RemappedRecords.java index 3b147a4cd8..f6aa72d01e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/RemappedRecords.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/RemappedRecords.java @@ -4,6 +4,7 @@ import android.content.Context; import androidx.annotation.NonNull; +import org.signal.core.util.logging.Log; import org.thoughtcrime.securesms.recipients.RecipientId; import org.whispersystems.libsignal.util.guava.Optional; @@ -23,6 +24,8 @@ import java.util.Map; */ class RemappedRecords { + private static final String TAG = Log.tag(RemappedRecords.class); + private static final RemappedRecords INSTANCE = new RemappedRecords(); private Map recipientMap; @@ -48,6 +51,7 @@ class RemappedRecords { * Can only be called inside of a transaction. */ void addRecipient(@NonNull Context context, @NonNull RecipientId oldId, @NonNull RecipientId newId) { + Log.w(TAG, "[Recipient] Remapping " + oldId + " to " + newId); ensureInTransaction(context); ensureRecipientMapIsPopulated(context); recipientMap.put(oldId, newId); @@ -58,6 +62,7 @@ class RemappedRecords { * Can only be called inside of a transaction. */ void addThread(@NonNull Context context, long oldId, long newId) { + Log.w(TAG, "[Thread] Remapping " + oldId + " to " + newId); ensureInTransaction(context); ensureThreadMapIsPopulated(context); threadMap.put(oldId, newId);