Update SQLCipher to 4.13.0

This commit is contained in:
Greyson Parrelli
2026-03-09 10:27:51 -04:00
committed by jeffrey-signal
parent 94e28eddd0
commit bdc90f3c02
6 changed files with 96 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.database;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import androidx.annotation.NonNull;
@@ -27,7 +28,9 @@ public final class SqlCipherDeletingErrorHandler implements DatabaseErrorHandler
}
@Override
public void onCorruption(SQLiteDatabase db, String message) {
public void onCorruption(SQLiteDatabase db, SQLiteException exception) {
String message = exception != null ? exception.getMessage() : "Unknown";
try {
Log.e(TAG, "Database '" + databaseName + "' corrupted! Message: " + message + ". Going to try to run some diagnostics.");

View File

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.database
import android.app.Application
import android.content.Context
import android.database.sqlite.SQLiteException
import net.zetetic.database.DatabaseErrorHandler
import net.zetetic.database.sqlcipher.SQLiteConnection
import net.zetetic.database.sqlcipher.SQLiteDatabase
@@ -25,7 +26,7 @@ class SqlCipherErrorHandler(private val application: Application, private val da
private val errorHandlingInProgress = AtomicBoolean(false)
}
override fun onCorruption(db: SQLiteDatabase, message: String) {
override fun onCorruption(db: SQLiteDatabase, exception: SQLiteException?) {
if (errorHandlingInProgress.getAndSet(true)) {
Log.w(TAG, "Error handling already in progress, skipping.")
return
@@ -34,10 +35,10 @@ class SqlCipherErrorHandler(private val application: Application, private val da
try {
val result: DiagnosticResults = runDiagnostics(application, db)
var lines: List<String> = result.logs.split("\n")
lines = listOf("Database '$databaseName' corrupted!", "[sqlite] $message", "Diagnostics results:") + lines
lines = listOf("Database '$databaseName' corrupted!", "[sqlite] ${exception?.message}", "Diagnostics results:") + lines
Log.e(TAG, "Database '$databaseName' corrupted!")
Log.e(TAG, "[sqlite] $message")
Log.e(TAG, "[sqlite] ${exception?.message}")
Log.e(TAG, "Diagnostic results:\n ${result.logs}")
if (result is DiagnosticResults.Success) {