Ensure SQLCipher is loaded before logging begins.

This commit is contained in:
Greyson Parrelli 2021-07-22 02:21:45 -04:00
parent b2c3a34d68
commit 60b4862b1b
6 changed files with 6 additions and 1 deletions

View file

@ -121,12 +121,12 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
super.onCreate();
AppStartup.getInstance().addBlocking("security-provider", this::initializeSecurityProvider)
.addBlocking("sqlcipher-init", () -> SqlCipherLibraryLoader.load(this))
.addBlocking("logging", () -> {
initializeLogging();
Log.i(TAG, "onCreate()");
})
.addBlocking("crash-handling", this::initializeCrashHandling)
.addBlocking("sqlcipher-init", () -> SqlCipherLibraryLoader.load(this))
.addBlocking("rx-init", () -> {
RxJavaPlugins.setInitIoSchedulerHandler(schedulerSupplier -> Schedulers.from(SignalExecutors.BOUNDED_IO, true, false));
RxJavaPlugins.setInitComputationSchedulerHandler(schedulerSupplier -> Schedulers.from(SignalExecutors.BOUNDED, true, false));

View file

@ -94,6 +94,7 @@ public class JobDatabase extends SQLiteOpenHelper implements SignalDatabase {
if (instance == null) {
synchronized (JobDatabase.class) {
if (instance == null) {
SqlCipherLibraryLoader.load(context);
instance = new JobDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
}
}

View file

@ -54,6 +54,7 @@ public class KeyValueDatabase extends SQLiteOpenHelper implements SignalDatabase
if (instance == null) {
synchronized (KeyValueDatabase.class) {
if (instance == null) {
SqlCipherLibraryLoader.load(context);
instance = new KeyValueDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
}
}

View file

@ -71,6 +71,7 @@ class LogDatabase private constructor(
if (instance == null) {
synchronized(LogDatabase::class.java) {
if (instance == null) {
SqlCipherLibraryLoader.load(context)
instance = LogDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context))
}
}

View file

@ -57,6 +57,7 @@ public class MegaphoneDatabase extends SQLiteOpenHelper implements SignalDatabas
if (instance == null) {
synchronized (MegaphoneDatabase.class) {
if (instance == null) {
SqlCipherLibraryLoader.load(context);
instance = new MegaphoneDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
}
}

View file

@ -10,6 +10,7 @@ import net.sqlcipher.database.SQLiteDatabase
class SqlCipherLibraryLoader {
companion object {
@Volatile
private var loaded = false
private val LOCK = Object()