mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Add a log section for remapped recipients.
This commit is contained in:
@@ -182,7 +182,7 @@ public class DatabaseFactory {
|
||||
return getInstance(context).storageIdDatabase;
|
||||
}
|
||||
|
||||
static RemappedRecordsDatabase getRemappedRecordsDatabase(Context context) {
|
||||
public static RemappedRecordsDatabase getRemappedRecordsDatabase(Context context) {
|
||||
return getInstance(context).remappedRecordsDatabase;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,14 @@ public class RemappedRecordsDatabase extends Database {
|
||||
addMapping(Threads.TABLE_NAME, new Mapping(oldId, newId));
|
||||
}
|
||||
|
||||
public Cursor getAllRecipients() {
|
||||
return databaseHelper.getSignalReadableDatabase().query(Recipients.TABLE_NAME, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
public Cursor getAllThreads() {
|
||||
return databaseHelper.getSignalReadableDatabase().query(Threads.TABLE_NAME, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
private @NonNull List<Mapping> getAllMappings(@NonNull String table) {
|
||||
List<Mapping> mappings = new LinkedList<>();
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.thoughtcrime.securesms.logsubmit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.signal.core.util.AsciiArt;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* Renders data pertaining to sender key. While all private info is obfuscated, this is still only intended to be printed for internal users.
|
||||
*/
|
||||
public class LogSectionRemappedRecords implements LogSection {
|
||||
|
||||
@Override
|
||||
public @NonNull String getTitle() {
|
||||
return "REMAPPED RECORDS";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull CharSequence getContent(@NonNull Context context) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append("--- Recipients").append("\n\n");
|
||||
try (Cursor cursor = DatabaseFactory.getRemappedRecordsDatabase(context).getAllRecipients()) {
|
||||
builder.append(AsciiArt.tableFor(cursor)).append("\n\n");
|
||||
}
|
||||
|
||||
builder.append("--- Threads").append("\n\n");
|
||||
try (Cursor cursor = DatabaseFactory.getRemappedRecordsDatabase(context).getAllThreads()) {
|
||||
builder.append(AsciiArt.tableFor(cursor)).append("\n");
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ public class SubmitDebugLogRepository {
|
||||
if (FeatureFlags.internalUser()) {
|
||||
add(new LogSectionSenderKey());
|
||||
}
|
||||
add(new LogSectionRemappedRecords());
|
||||
add(new LogSectionLogcat());
|
||||
add(new LogSectionLoggerHeader());
|
||||
}};
|
||||
|
||||
Reference in New Issue
Block a user