Skip to content
Permalink
Browse files

Always create the HandlerThread immediately after the Messenger

Fatal Exception: kotlin.KotlinNullPointerException
       at com.google.android.apps.muzei.legacy.LegacySourceServiceConnection.allowsNextArtwork(LegacySourceServiceConnection.java:148)
       at com.google.android.apps.muzei.legacy.LegacySourceManager.allowsNextArtwork(LegacySourceManager.java:143)
       at com.google.android.apps.muzei.legacy.LegacySourceManagerKt.allowsNextArtwork(LegacySourceManagerKt.java:42)
       at com.google.android.apps.muzei.widget.AppWidgetUpdateTaskKt.createRemoteViews(AppWidgetUpdateTaskKt.java:133)
       at com.google.android.apps.muzei.widget.AppWidgetUpdateTaskKt$updateAppWidget$2$1.invokeSuspend(AppWidgetUpdateTaskKt.java:107)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:241)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:594)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.java:60)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:740)
  • Loading branch information...
ianhanniballake committed Oct 29, 2019
1 parent 6c16a45 commit 172c9e38d3ca00b9adc12bddbf6b6dcc5e3f402d
@@ -100,13 +100,12 @@ internal class LegacySourceServiceConnection(
}

override fun onServiceConnected(name: ComponentName, service: IBinder) {
messenger = Messenger(service).also {
if (currentProvider?.authority == LEGACY_AUTHORITY) {
// Register immediately if the legacy art provider is selected
register()
}
}
messenger = Messenger(service)
handlerThread = HandlerThread(TAG).apply { start() }
if (currentProvider?.authority == LEGACY_AUTHORITY) {
// Register immediately if the legacy art provider is selected
register()
}
if (BuildConfig.DEBUG) {
Log.d(TAG, "Bound to LegacySourceService")
}

0 comments on commit 172c9e3

Please sign in to comment.
You can’t perform that action at this time.