Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Remove superfluous WorkManager initialization (#3672)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored Jul 17, 2020
1 parent d672a66 commit 632d248
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
3 changes: 0 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,6 @@ dependencies {
implementation deps.android_components.glean
implementation deps.app_services.rustlog

// TODO this should not be necessary at all, see Services.kt
implementation deps.work.runtime

// Kotlin dependency
implementation deps.kotlin.stdlib
implementation deps.kotlin.coroutines
Expand Down
16 changes: 0 additions & 16 deletions app/src/common/shared/org/mozilla/vrbrowser/browser/Services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import android.content.Context
import android.net.Uri
import android.os.Build
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.work.Configuration
import androidx.work.WorkManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -63,20 +61,6 @@ class Services(val context: Context, places: Places): GeckoSession.NavigationDel

GlobalSyncableStoreProvider.configureStore(SyncEngine.Bookmarks to lazy {places.bookmarks})
GlobalSyncableStoreProvider.configureStore(SyncEngine.History to lazy {places.history})

// TODO this really shouldn't be necessary, since WorkManager auto-initializes itself, unless
// auto-initialization is disabled in the manifest file. We don't disable the initialization,
// but i'm seeing crashes locally because WorkManager isn't initialized correctly...
// Maybe this is a race of sorts? We're trying to access it before it had a chance to auto-initialize?
// It's not well-documented _when_ that auto-initialization is supposed to happen.

// For now, let's just manually initialize it here, and swallow failures (it's already initialized).
try {
WorkManager.initialize(
context,
Configuration.Builder().setMinimumLoggingLevel(android.util.Log.INFO).build()
)
} catch (e: IllegalStateException) {}
}

// Process received device events, only handling received tabs for now.
Expand Down
2 changes: 0 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ support.core_utils = "androidx.legacy:legacy-support-core-utils:$versions.suppor
support.vector_drawable = "androidx.vectordrawable:vectordrawable:$versions.support"
deps.support = support

// TODO this should not be necessary at all, see Services.kt
def work = [:]
work.runtime = "androidx.work:work-runtime-ktx:$versions.work"
work.testing = "androidx.work:work-testing:$versions.work"
deps.work = work

Expand Down

0 comments on commit 632d248

Please sign in to comment.