Ensure SQLCipher is loaded before logging begins.
This commit is contained in:
parent
b2c3a34d68
commit
60b4862b1b
6 changed files with 6 additions and 1 deletions
|
@ -121,12 +121,12 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
AppStartup.getInstance().addBlocking("security-provider", this::initializeSecurityProvider)
|
AppStartup.getInstance().addBlocking("security-provider", this::initializeSecurityProvider)
|
||||||
|
.addBlocking("sqlcipher-init", () -> SqlCipherLibraryLoader.load(this))
|
||||||
.addBlocking("logging", () -> {
|
.addBlocking("logging", () -> {
|
||||||
initializeLogging();
|
initializeLogging();
|
||||||
Log.i(TAG, "onCreate()");
|
Log.i(TAG, "onCreate()");
|
||||||
})
|
})
|
||||||
.addBlocking("crash-handling", this::initializeCrashHandling)
|
.addBlocking("crash-handling", this::initializeCrashHandling)
|
||||||
.addBlocking("sqlcipher-init", () -> SqlCipherLibraryLoader.load(this))
|
|
||||||
.addBlocking("rx-init", () -> {
|
.addBlocking("rx-init", () -> {
|
||||||
RxJavaPlugins.setInitIoSchedulerHandler(schedulerSupplier -> Schedulers.from(SignalExecutors.BOUNDED_IO, true, false));
|
RxJavaPlugins.setInitIoSchedulerHandler(schedulerSupplier -> Schedulers.from(SignalExecutors.BOUNDED_IO, true, false));
|
||||||
RxJavaPlugins.setInitComputationSchedulerHandler(schedulerSupplier -> Schedulers.from(SignalExecutors.BOUNDED, true, false));
|
RxJavaPlugins.setInitComputationSchedulerHandler(schedulerSupplier -> Schedulers.from(SignalExecutors.BOUNDED, true, false));
|
||||||
|
|
|
@ -94,6 +94,7 @@ public class JobDatabase extends SQLiteOpenHelper implements SignalDatabase {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized (JobDatabase.class) {
|
synchronized (JobDatabase.class) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
SqlCipherLibraryLoader.load(context);
|
||||||
instance = new JobDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
instance = new JobDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class KeyValueDatabase extends SQLiteOpenHelper implements SignalDatabase
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized (KeyValueDatabase.class) {
|
synchronized (KeyValueDatabase.class) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
SqlCipherLibraryLoader.load(context);
|
||||||
instance = new KeyValueDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
instance = new KeyValueDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ class LogDatabase private constructor(
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized(LogDatabase::class.java) {
|
synchronized(LogDatabase::class.java) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
SqlCipherLibraryLoader.load(context)
|
||||||
instance = LogDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context))
|
instance = LogDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class MegaphoneDatabase extends SQLiteOpenHelper implements SignalDatabas
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized (MegaphoneDatabase.class) {
|
synchronized (MegaphoneDatabase.class) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
SqlCipherLibraryLoader.load(context);
|
||||||
instance = new MegaphoneDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
instance = new MegaphoneDatabase(context, DatabaseSecretProvider.getOrCreateDatabaseSecret(context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.sqlcipher.database.SQLiteDatabase
|
||||||
class SqlCipherLibraryLoader {
|
class SqlCipherLibraryLoader {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@Volatile
|
||||||
private var loaded = false
|
private var loaded = false
|
||||||
private val LOCK = Object()
|
private val LOCK = Object()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue