diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 146151eee4..15cab4f9f9 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -572,6 +572,12 @@ android:authorities="org.thoughtcrime.securesms.database.attachment" android:exported="false" /> + + diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 6c7a0c76cc..7561771a55 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -61,6 +61,7 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.TimeUnit; +import androidx.work.Configuration; import androidx.work.WorkManager; import dagger.ObjectGraph; @@ -80,7 +81,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc private JobManager jobManager; private ObjectGraph objectGraph; private PersistentLogger persistentLogger; - private boolean initialized; private volatile boolean isAppVisible; @@ -90,33 +90,20 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc @Override public void onCreate() { - synchronized (this) { - super.onCreate(); - initializeRandomNumberFix(); - initializeLogging(); - initializeCrashHandling(); - initializeDependencyInjection(); - initializeJobManager(); - initializeExpiringMessageManager(); - initializeGcmCheck(); - initializeSignedPreKeyCheck(); - initializePeriodicTasks(); - initializeCircumvention(); - initializeWebRtc(); - NotificationChannels.create(this); - ProcessLifecycleOwner.get().getLifecycle().addObserver(this); - - initialized = true; - notifyAll(); - } - } - - public void ensureInitialized() { - synchronized (this) { - while (!initialized) { - Util.wait(this, 0); - } - } + super.onCreate(); + initializeRandomNumberFix(); + initializeLogging(); + initializeCrashHandling(); + initializeDependencyInjection(); + initializeJobManager(); + initializeExpiringMessageManager(); + initializeGcmCheck(); + initializeSignedPreKeyCheck(); + initializePeriodicTasks(); + initializeCircumvention(); + initializeWebRtc(); + NotificationChannels.create(this); + ProcessLifecycleOwner.get().getLifecycle().addObserver(this); } @Override @@ -172,6 +159,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc } private void initializeJobManager() { + WorkManager.initialize(this, new Configuration.Builder() + .setMinimumLoggingLevel(android.util.Log.DEBUG) + .build()); + this.jobManager = new JobManager(WorkManager.getInstance()); } diff --git a/src/org/thoughtcrime/securesms/jobmanager/Job.java b/src/org/thoughtcrime/securesms/jobmanager/Job.java index 179d3f28a1..d56c02b6f7 100644 --- a/src/org/thoughtcrime/securesms/jobmanager/Job.java +++ b/src/org/thoughtcrime/securesms/jobmanager/Job.java @@ -53,7 +53,6 @@ public abstract class Job extends Worker implements Serializable { log("doWork()" + logSuffix()); - ApplicationContext.getInstance(getApplicationContext()).ensureInitialized(); ApplicationContext.getInstance(getApplicationContext()).injectDependencies(this); if (this instanceof ContextDependent) {