瀏覽代碼

Enforce updateForegroundNotification to run in the main thread

Peter Cai 1 年之前
父節點
當前提交
9a77824f79
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      app-common/src/main/java/im/angry/openeuicc/service/EuiccChannelManagerService.kt

+ 3 - 1
app-common/src/main/java/im/angry/openeuicc/service/EuiccChannelManagerService.kt

@@ -178,7 +178,9 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
         // until we encounter ForegroundTaskState.Done.
         return foregroundTaskState.transformWhile {
             // Also update our notification when we see an update
-            updateForegroundNotification(title, iconRes)
+            withContext(Dispatchers.Main) {
+                updateForegroundNotification(title, iconRes)
+            }
             emit(it)
             it !is ForegroundTaskState.Done
         }.onCompletion { foregroundTaskState.value = ForegroundTaskState.Idle }