diff --git a/app/src/main/java/com/github/kr328/clash/BaseActivity.kt b/app/src/main/java/com/github/kr328/clash/BaseActivity.kt
index 83073345ad77fb4afdab05ca7d7e9dbc92864865..4347756a9d6d865a3eaaa4d8e2513b205353ba54 100644
--- a/app/src/main/java/com/github/kr328/clash/BaseActivity.kt
+++ b/app/src/main/java/com/github/kr328/clash/BaseActivity.kt
@@ -114,7 +114,7 @@ abstract class BaseActivity<D : Design<*>> :
 
         Remote.broadcasts.addObserver(this)
 
-        events.offer(Event.ActivityStart)
+        events.trySend(Event.ActivityStart)
     }
 
     override fun onStop() {
@@ -124,7 +124,7 @@ abstract class BaseActivity<D : Design<*>> :
 
         Remote.broadcasts.removeObserver(this)
 
-        events.offer(Event.ActivityStop)
+        events.trySend(Event.ActivityStop)
     }
 
     override fun onDestroy() {
@@ -174,23 +174,23 @@ abstract class BaseActivity<D : Design<*>> :
     }
 
     override fun onProfileChanged() {
-        events.offer(Event.ProfileChanged)
+        events.trySend(Event.ProfileChanged)
     }
 
     override fun onProfileLoaded() {
-        events.offer(Event.ProfileLoaded)
+        events.trySend(Event.ProfileLoaded)
     }
 
     override fun onServiceRecreated() {
-        events.offer(Event.ServiceRecreated)
+        events.trySend(Event.ServiceRecreated)
     }
 
     override fun onStarted() {
-        events.offer(Event.ClashStart)
+        events.trySend(Event.ClashStart)
     }
 
     override fun onStopped(cause: String?) {
-        events.offer(Event.ClashStop)
+        events.trySend(Event.ClashStop)
 
         if (cause != null && activityStarted) {
             launch {
diff --git a/app/src/main/java/com/github/kr328/clash/FilesActivity.kt b/app/src/main/java/com/github/kr328/clash/FilesActivity.kt
index e8ebb3d1dc7b52d66db56f1306ae9e2ca017184e..c71e683079905251260cccfabd3e588afe141cc4 100644
--- a/app/src/main/java/com/github/kr328/clash/FilesActivity.kt
+++ b/app/src/main/java/com/github/kr328/clash/FilesActivity.kt
@@ -141,7 +141,7 @@ class FilesActivity : BaseActivity<FilesDesign>() {
     }
 
     override fun onBackPressed() {
-        design?.requests?.offer(FilesDesign.Request.PopStack)
+        design?.requests?.trySend(FilesDesign.Request.PopStack)
     }
 
     private suspend fun FilesDesign.fetch(client: FilesClient, stack: Stack<String>, root: String) {
diff --git a/app/src/main/java/com/github/kr328/clash/LogcatService.kt b/app/src/main/java/com/github/kr328/clash/LogcatService.kt
index bb17c24e8f999e16187565f582c91aa136a78bde..11a757576a0f56eda0592aabdf305625c65f2c22 100644
--- a/app/src/main/java/com/github/kr328/clash/LogcatService.kt
+++ b/app/src/main/java/com/github/kr328/clash/LogcatService.kt
@@ -97,7 +97,7 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
                 LogcatWriter(this@LogcatService).use {
                     val observer = object : ILogObserver {
                         override fun newItem(log: LogMessage) {
-                            channel.offer(log)
+                            channel.trySend(log)
                         }
                     }
 
diff --git a/app/src/main/java/com/github/kr328/clash/LogsActivity.kt b/app/src/main/java/com/github/kr328/clash/LogsActivity.kt
index d3a362427e77b93ec5106d58cbfcfba3ccd60847..0a482b65f6af21f2ebbb36a7339769c1378b897b 100644
--- a/app/src/main/java/com/github/kr328/clash/LogsActivity.kt
+++ b/app/src/main/java/com/github/kr328/clash/LogsActivity.kt
@@ -47,7 +47,7 @@ class LogsActivity : BaseActivity<LogsDesign>() {
                                     deleteAllLogs()
                                 }
 
-                                events.offer(Event.ActivityStart)
+                                events.trySend(Event.ActivityStart)
                             }
                         }
                         is LogsDesign.Request.OpenFile -> {
diff --git a/app/src/main/java/com/github/kr328/clash/MainApplication.kt b/app/src/main/java/com/github/kr328/clash/MainApplication.kt
index 4393905dea3911bfb2def93192e957d0330e9137..13fe5eb2da23f20c11f7e751608cb65e60878f38 100644
--- a/app/src/main/java/com/github/kr328/clash/MainApplication.kt
+++ b/app/src/main/java/com/github/kr328/clash/MainApplication.kt
@@ -32,4 +32,8 @@ class MainApplication : Application() {
             sendServiceRecreated()
         }
     }
+
+    fun finalize() {
+        Global.destroy()
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/github/kr328/clash/ProxyActivity.kt b/app/src/main/java/com/github/kr328/clash/ProxyActivity.kt
index a57cd07370bc4397948af7da8013195861eaabde..fddebcf0c5fbbb87e91d5057003e6de7cce95021 100644
--- a/app/src/main/java/com/github/kr328/clash/ProxyActivity.kt
+++ b/app/src/main/java/com/github/kr328/clash/ProxyActivity.kt
@@ -73,7 +73,7 @@ class ProxyActivity : BaseActivity<ProxyDesign>() {
                         }
                         ProxyDesign.Request.ReloadAll -> {
                             names.indices.forEach { idx ->
-                                design.requests.offer(ProxyDesign.Request.Reload(idx))
+                                design.requests.trySend(ProxyDesign.Request.Reload(idx))
                             }
                         }
                         is ProxyDesign.Request.Reload -> {
diff --git a/app/src/main/java/com/github/kr328/clash/remote/Remote.kt b/app/src/main/java/com/github/kr328/clash/remote/Remote.kt
index 53f78f361ae38a664ffc9a5b0d3a15e3ac80d5d4..664ecc3a604b945dd85f7bc35dd273e577cbf06c 100644
--- a/app/src/main/java/com/github/kr328/clash/remote/Remote.kt
+++ b/app/src/main/java/com/github/kr328/clash/remote/Remote.kt
@@ -10,7 +10,6 @@ import com.github.kr328.clash.store.AppStore
 import com.github.kr328.clash.util.ApplicationObserver
 import com.github.kr328.clash.util.verifyApk
 import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.channels.Channel
 import kotlinx.coroutines.launch
 
@@ -30,9 +29,9 @@ object Remote {
     fun launch() {
         ApplicationObserver.attach(Global.application)
 
-        ApplicationObserver.onVisibleChanged(visible::offer)
+        ApplicationObserver.onVisibleChanged { visible.trySend(it) }
 
-        GlobalScope.launch(Dispatchers.IO) {
+        Global.launch(Dispatchers.IO) {
             run()
         }
     }
diff --git a/common/src/main/java/com/github/kr328/clash/common/Global.kt b/common/src/main/java/com/github/kr328/clash/common/Global.kt
index 086d48a302321e990dab0b4621fbd8d0431a1f2f..bea22010b66546bd5615503f216ca7ae7f6f980a 100644
--- a/common/src/main/java/com/github/kr328/clash/common/Global.kt
+++ b/common/src/main/java/com/github/kr328/clash/common/Global.kt
@@ -1,8 +1,11 @@
 package com.github.kr328.clash.common
 
 import android.app.Application
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.cancel
 
-object Global {
+object Global : CoroutineScope by CoroutineScope(Dispatchers.IO) {
     val application: Application
         get() = application_
 
@@ -11,4 +14,8 @@ object Global {
     fun init(application: Application) {
         this.application_ = application
     }
+
+    fun destroy() {
+        cancel()
+    }
 }
\ No newline at end of file
diff --git a/core/src/main/java/com/github/kr328/clash/core/Clash.kt b/core/src/main/java/com/github/kr328/clash/core/Clash.kt
index aace5e2a68d0eb69b6def5798c8e3e5567ed52ad..bf58ae52f50e015172bd211fe6d8046e51d0f344 100644
--- a/core/src/main/java/com/github/kr328/clash/core/Clash.kt
+++ b/core/src/main/java/com/github/kr328/clash/core/Clash.kt
@@ -218,7 +218,7 @@ object Clash {
         return Channel<LogMessage>(32).apply {
             Bridge.nativeSubscribeLogcat(object : LogcatInterface {
                 override fun received(jsonPayload: String) {
-                    offer(Json.decodeFromString(LogMessage.serializer(), jsonPayload))
+                    trySend(Json.decodeFromString(LogMessage.serializer(), jsonPayload))
                 }
             })
         }
diff --git a/design/src/foss/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt b/design/src/foss/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt
index 80c2a92ef50f5e8f543871cc5d6f352851428518..ae0a592f4c0760eb2ab33eb30aa28e16e2b58215 100644
--- a/design/src/foss/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt
+++ b/design/src/foss/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt
@@ -236,7 +236,7 @@ class OverrideSettingsDesign(
                 summary = R.string.sideload_geoip_summary
             ) {
                 clicked {
-                    requests.offer(Request.EditSideloadGeoip)
+                    requests.trySend(Request.EditSideloadGeoip)
                 }
             }
 
@@ -394,6 +394,6 @@ class OverrideSettingsDesign(
     }
 
     fun requestClear() {
-        requests.offer(Request.ResetOverride)
+        requests.trySend(Request.ResetOverride)
     }
 }
\ No newline at end of file
diff --git a/design/src/foss/java/com/github/kr328/clash/design/component/ProxyMenu.kt b/design/src/foss/java/com/github/kr328/clash/design/component/ProxyMenu.kt
index 52f6be0a287b6434f85bd73924c5753eb4516049..017601f9d28448ce59e897f93a0f740fdc006d9c 100644
--- a/design/src/foss/java/com/github/kr328/clash/design/component/ProxyMenu.kt
+++ b/design/src/foss/java/com/github/kr328/clash/design/component/ProxyMenu.kt
@@ -32,48 +32,48 @@ class ProxyMenu(
             R.id.not_selectable -> {
                 uiStore.proxyExcludeNotSelectable = item.isChecked
 
-                requests.offer(ProxyDesign.Request.ReLaunch)
+                requests.trySend(ProxyDesign.Request.ReLaunch)
             }
             R.id.single -> {
                 uiStore.proxySingleLine = true
 
                 updateConfig()
 
-                requests.offer(ProxyDesign.Request.ReloadAll)
+                requests.trySend(ProxyDesign.Request.ReloadAll)
             }
             R.id.multiple -> {
                 uiStore.proxySingleLine = false
 
                 updateConfig()
 
-                requests.offer(ProxyDesign.Request.ReloadAll)
+                requests.trySend(ProxyDesign.Request.ReloadAll)
             }
             R.id.default_ -> {
                 uiStore.proxySort = ProxySort.Default
 
-                requests.offer(ProxyDesign.Request.ReloadAll)
+                requests.trySend(ProxyDesign.Request.ReloadAll)
             }
             R.id.name -> {
                 uiStore.proxySort = ProxySort.Title
 
-                requests.offer(ProxyDesign.Request.ReloadAll)
+                requests.trySend(ProxyDesign.Request.ReloadAll)
             }
             R.id.delay -> {
                 uiStore.proxySort = ProxySort.Delay
 
-                requests.offer(ProxyDesign.Request.ReloadAll)
+                requests.trySend(ProxyDesign.Request.ReloadAll)
             }
             R.id.dont_modify -> {
-                requests.offer(ProxyDesign.Request.PatchMode(null))
+                requests.trySend(ProxyDesign.Request.PatchMode(null))
             }
             R.id.direct_mode -> {
-                requests.offer(ProxyDesign.Request.PatchMode(TunnelState.Mode.Direct))
+                requests.trySend(ProxyDesign.Request.PatchMode(TunnelState.Mode.Direct))
             }
             R.id.global_mode -> {
-                requests.offer(ProxyDesign.Request.PatchMode(TunnelState.Mode.Global))
+                requests.trySend(ProxyDesign.Request.PatchMode(TunnelState.Mode.Global))
             }
             R.id.rule_mode -> {
-                requests.offer(ProxyDesign.Request.PatchMode(TunnelState.Mode.Rule))
+                requests.trySend(ProxyDesign.Request.PatchMode(TunnelState.Mode.Rule))
             }
             else -> return false
         }
diff --git a/design/src/main/java/com/github/kr328/clash/design/AccessControlDesign.kt b/design/src/main/java/com/github/kr328/clash/design/AccessControlDesign.kt
index a50c803503e7507b534265c10af5ad89cd389370..cc1d2c80001a63a4441141b12515528de2017831 100644
--- a/design/src/main/java/com/github/kr328/clash/design/AccessControlDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/AccessControlDesign.kt
@@ -93,7 +93,7 @@ class AccessControlDesign(
             binding.surface = dialog.surface
             binding.mainList.applyLinearAdapter(context, adapter)
             binding.keywordView.addTextChangedListener {
-                filter.offer(Unit)
+                filter.trySend(Unit)
             }
             binding.closeView.setOnClickListener {
                 dialog.dismiss()
diff --git a/design/src/main/java/com/github/kr328/clash/design/ApkBrokenDesign.kt b/design/src/main/java/com/github/kr328/clash/design/ApkBrokenDesign.kt
index a99483d54e59db96bbb78b3461f9a99fa4debc31..56dd613200912d833bbbbcca470ad64385758a3d 100644
--- a/design/src/main/java/com/github/kr328/clash/design/ApkBrokenDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/ApkBrokenDesign.kt
@@ -38,7 +38,7 @@ class ApkBrokenDesign(context: Context) : Design<ApkBrokenDesign.Request>(contex
                 summary = R.string.google_play_url
             ) {
                 clicked {
-                    requests.offer(Request(context.getString(R.string.google_play_url)))
+                    requests.trySend(Request(context.getString(R.string.google_play_url)))
                 }
             }
 
@@ -47,7 +47,7 @@ class ApkBrokenDesign(context: Context) : Design<ApkBrokenDesign.Request>(contex
                 summary = R.string.github_releases_url
             ) {
                 clicked {
-                    requests.offer(Request(context.getString(R.string.github_releases_url)))
+                    requests.trySend(Request(context.getString(R.string.github_releases_url)))
                 }
             }
         }
diff --git a/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt
index 94352a27d0c5b2e449f76928dd3ddd14c75962cf..ad296de55f8c7b1f939712ddf2a0331ee0354396 100644
--- a/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/AppSettingsDesign.kt
@@ -61,7 +61,7 @@ class AppSettingsDesign(
                 title = R.string.dark_mode
             ) {
                 listener = OnChangedListener {
-                    requests.offer(Request.ReCreateAllActivities)
+                    requests.trySend(Request.ReCreateAllActivities)
                 }
             }
 
diff --git a/design/src/main/java/com/github/kr328/clash/design/FilesDesign.kt b/design/src/main/java/com/github/kr328/clash/design/FilesDesign.kt
index b6ccb73f58c26c461e11c1bc8352526fdda4da42..cab7c2d92652e077229a83557dd5d5ad9df8e356 100644
--- a/design/src/main/java/com/github/kr328/clash/design/FilesDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/FilesDesign.kt
@@ -72,38 +72,38 @@ class FilesDesign(context: Context) : Design<FilesDesign.Request>(context) {
 
     private fun requestOpen(file: File) {
         if (file.isDirectory) {
-            requests.offer(Request.OpenDirectory(file))
+            requests.trySend(Request.OpenDirectory(file))
         } else {
-            requests.offer(Request.OpenFile(file))
+            requests.trySend(Request.OpenFile(file))
         }
     }
 
     fun requestRename(dialog: Dialog, file: File) {
-        requests.offer(Request.RenameFile(file))
+        requests.trySend(Request.RenameFile(file))
 
         dialog.dismiss()
     }
 
     fun requestImport(dialog: Dialog, file: File) {
-        requests.offer(Request.ImportFile(file))
+        requests.trySend(Request.ImportFile(file))
 
         dialog.dismiss()
     }
 
     fun requestExport(dialog: Dialog, file: File) {
-        requests.offer(Request.ExportFile(file))
+        requests.trySend(Request.ExportFile(file))
 
         dialog.dismiss()
     }
 
     fun requestDelete(dialog: Dialog, file: File) {
-        requests.offer(Request.DeleteFile(file))
+        requests.trySend(Request.DeleteFile(file))
 
         dialog.dismiss()
     }
 
     fun requestNew() {
-        requests.offer(Request.ImportFile(null))
+        requests.trySend(Request.ImportFile(null))
     }
 
     private fun requestMore(file: File) {
diff --git a/design/src/main/java/com/github/kr328/clash/design/LogsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/LogsDesign.kt
index 803bf6d160ada2261ff972ada45ba385f60f787e..64a17e60f5a3c5547a2e9cc70d7452a3a59e5dc2 100644
--- a/design/src/main/java/com/github/kr328/clash/design/LogsDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/LogsDesign.kt
@@ -23,7 +23,7 @@ class LogsDesign(context: Context) : Design<LogsDesign.Request>(context) {
     private val binding = DesignLogsBinding
         .inflate(context.layoutInflater, context.root, false)
     private val adapter = LogFileAdapter(context) {
-        requests.offer(Request.OpenFile(it))
+        requests.trySend(Request.OpenFile(it))
     }
 
     override val root: View
diff --git a/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt b/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt
index 524eef5e8008c0c5398e73ca1a40c3106968cf2e..b1e0180b4bda7bf1b695910bd2af4be740208a0d 100644
--- a/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt
@@ -97,6 +97,6 @@ class MainDesign(context: Context) : Design<MainDesign.Request>(context) {
     }
 
     fun request(request: Request) {
-        requests.offer(request)
+        requests.trySend(request)
     }
 }
\ No newline at end of file
diff --git a/design/src/main/java/com/github/kr328/clash/design/NetworkSettingsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/NetworkSettingsDesign.kt
index 0c430402bfdbb26ab0ded52190406e3785797c7e..5dad3e4d3e99f2a57db36872ece0069464885184 100644
--- a/design/src/main/java/com/github/kr328/clash/design/NetworkSettingsDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/NetworkSettingsDesign.kt
@@ -96,7 +96,7 @@ class NetworkSettingsDesign(
                 summary = R.string.access_control_packages_summary,
             ) {
                 clicked {
-                    requests.offer(Request.StartAccessControlList)
+                    requests.trySend(Request.StartAccessControlList)
                 }
 
                 vpnDependencies.add(this)
diff --git a/design/src/main/java/com/github/kr328/clash/design/NewProfileDesign.kt b/design/src/main/java/com/github/kr328/clash/design/NewProfileDesign.kt
index 642aca9e088ffe443b9ec2cedca504a6a622b6f9..e38d01e790bf6dcaa70bbd07e61450bb8cc20e4b 100644
--- a/design/src/main/java/com/github/kr328/clash/design/NewProfileDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/NewProfileDesign.kt
@@ -38,13 +38,13 @@ class NewProfileDesign(context: Context) : Design<NewProfileDesign.Request>(cont
     }
 
     private fun requestCreate(provider: ProfileProvider) {
-        requests.offer(Request.Create(provider))
+        requests.trySend(Request.Create(provider))
     }
 
     private fun requestDetail(provider: ProfileProvider): Boolean {
         if (provider !is ProfileProvider.External) return false
 
-        requests.offer(Request.OpenDetail(provider))
+        requests.trySend(Request.OpenDetail(provider))
 
         return true
     }
diff --git a/design/src/main/java/com/github/kr328/clash/design/ProfilesDesign.kt b/design/src/main/java/com/github/kr328/clash/design/ProfilesDesign.kt
index e0caed84245b65ce418d478132a20a2672258ac9..33c146771bd88aed0bcf2d8bc80f58de08c913bb 100644
--- a/design/src/main/java/com/github/kr328/clash/design/ProfilesDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/ProfilesDesign.kt
@@ -49,7 +49,7 @@ class ProfilesDesign(context: Context) : Design<ProfilesDesign.Request>(context)
     suspend fun requestSave(profile: Profile) {
         showToast(R.string.active_unsaved_tips, ToastDuration.Long) {
             setAction(R.string.edit) {
-                requests.offer(Request.Edit(profile))
+                requests.trySend(Request.Edit(profile))
             }
         }
     }
@@ -84,37 +84,37 @@ class ProfilesDesign(context: Context) : Design<ProfilesDesign.Request>(context)
     }
 
     fun requestUpdateAll() {
-        requests.offer(Request.UpdateAll)
+        requests.trySend(Request.UpdateAll)
     }
 
     fun requestCreate() {
-        requests.offer(Request.Create)
+        requests.trySend(Request.Create)
     }
 
     private fun requestActive(profile: Profile) {
-        requests.offer(Request.Active(profile))
+        requests.trySend(Request.Active(profile))
     }
 
     fun requestUpdate(dialog: Dialog, profile: Profile) {
-        requests.offer(Request.Update(profile))
+        requests.trySend(Request.Update(profile))
 
         dialog.dismiss()
     }
 
     fun requestEdit(dialog: Dialog, profile: Profile) {
-        requests.offer(Request.Edit(profile))
+        requests.trySend(Request.Edit(profile))
 
         dialog.dismiss()
     }
 
     fun requestDuplicate(dialog: Dialog, profile: Profile) {
-        requests.offer(Request.Duplicate(profile))
+        requests.trySend(Request.Duplicate(profile))
 
         dialog.dismiss()
     }
 
     fun requestDelete(dialog: Dialog, profile: Profile) {
-        requests.offer(Request.Delete(profile))
+        requests.trySend(Request.Delete(profile))
 
         dialog.dismiss()
     }
diff --git a/design/src/main/java/com/github/kr328/clash/design/PropertiesDesign.kt b/design/src/main/java/com/github/kr328/clash/design/PropertiesDesign.kt
index 5a7439bc062c3e518c006b732e35463758dd157a..e18fafdf33dac898d225c3755d6ef287b85bbadf 100644
--- a/design/src/main/java/com/github/kr328/clash/design/PropertiesDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/PropertiesDesign.kt
@@ -142,11 +142,11 @@ class PropertiesDesign(context: Context) : Design<PropertiesDesign.Request>(cont
     }
 
     fun requestCommit() {
-        requests.offer(Request.Commit)
+        requests.trySend(Request.Commit)
     }
 
     fun requestBrowseFiles() {
-        requests.offer(Request.BrowseFiles)
+        requests.trySend(Request.BrowseFiles)
     }
 
     private fun ModelProgressBarConfigure.applyFrom(status: FetchStatus) {
diff --git a/design/src/main/java/com/github/kr328/clash/design/ProvidersDesign.kt b/design/src/main/java/com/github/kr328/clash/design/ProvidersDesign.kt
index fa5e13e3033c14758ca06a5dc43ac88783faf4a0..b193783c14ccee66613c8433350a4421c78e7aec 100644
--- a/design/src/main/java/com/github/kr328/clash/design/ProvidersDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/ProvidersDesign.kt
@@ -24,7 +24,7 @@ class ProvidersDesign(
         get() = binding.root
 
     private val adapter = ProviderAdapter(context, providers) { index, provider ->
-        requests.offer(Request.Update(index, provider))
+        requests.trySend(Request.Update(index, provider))
     }
 
     fun updateElapsed() {
@@ -56,7 +56,7 @@ class ProvidersDesign(
         adapter.states.filter { !it.updating }.forEachIndexed { index, state ->
             state.updating = true
 
-            requests.offer(Request.Update(index, state.provider))
+            requests.trySend(Request.Update(index, state.provider))
         }
     }
 }
\ No newline at end of file
diff --git a/design/src/main/java/com/github/kr328/clash/design/ProxyDesign.kt b/design/src/main/java/com/github/kr328/clash/design/ProxyDesign.kt
index efdf83deb905f4d90615ca7efa4a1199ce70a343..487e8767098119ce34b3b50c1bec209f0fa37b83 100644
--- a/design/src/main/java/com/github/kr328/clash/design/ProxyDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/ProxyDesign.kt
@@ -134,7 +134,7 @@ class ProxyDesign(
                     config,
                     List(groupNames.size) { index ->
                         ProxyAdapter(config) { name ->
-                            requests.offer(Request.Select(index, name))
+                            requests.trySend(Request.Select(index, name))
                         }
                     }
                 ) {
@@ -171,7 +171,7 @@ class ProxyDesign(
     fun requestUrlTesting() {
         urlTesting = true
 
-        requests.offer(Request.UrlTest(binding.pagesView.currentItem))
+        requests.trySend(Request.UrlTest(binding.pagesView.currentItem))
 
         updateUrlTestButtonStatus()
     }
diff --git a/design/src/main/java/com/github/kr328/clash/design/SettingsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/SettingsDesign.kt
index 51696023658195171b178f16af4e47d3bc7e63c0..d6f6c19056d992fa5a552abca39760b28e43ee3c 100644
--- a/design/src/main/java/com/github/kr328/clash/design/SettingsDesign.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/SettingsDesign.kt
@@ -28,6 +28,6 @@ class SettingsDesign(context: Context) : Design<SettingsDesign.Request>(context)
     }
 
     fun request(request: Request) {
-        requests.offer(request)
+        requests.trySend(request)
     }
 }
\ No newline at end of file
diff --git a/design/src/main/java/com/github/kr328/clash/design/component/AccessControlMenu.kt b/design/src/main/java/com/github/kr328/clash/design/component/AccessControlMenu.kt
index 70e2c9132b1e85fd08bbe2416a23119c119fcf1d..ae3bbc59becd154ff789aeb5fcc6dd0038a0123e 100644
--- a/design/src/main/java/com/github/kr328/clash/design/component/AccessControlMenu.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/component/AccessControlMenu.kt
@@ -28,46 +28,46 @@ class AccessControlMenu(
 
         when (item.itemId) {
             R.id.select_all ->
-                requests.offer(Request.SelectAll)
+                requests.trySend(Request.SelectAll)
             R.id.select_none ->
-                requests.offer(Request.SelectNone)
+                requests.trySend(Request.SelectNone)
             R.id.select_invert ->
-                requests.offer(Request.SelectInvert)
+                requests.trySend(Request.SelectInvert)
             R.id.system_apps -> {
                 uiStore.accessControlSystemApp = !item.isChecked
 
-                requests.offer(Request.ReloadApps)
+                requests.trySend(Request.ReloadApps)
             }
             R.id.name -> {
                 uiStore.accessControlSort = AppInfoSort.Label
 
-                requests.offer(Request.ReloadApps)
+                requests.trySend(Request.ReloadApps)
             }
             R.id.package_name -> {
                 uiStore.accessControlSort = AppInfoSort.PackageName
 
-                requests.offer(Request.ReloadApps)
+                requests.trySend(Request.ReloadApps)
             }
             R.id.install_time -> {
                 uiStore.accessControlSort = AppInfoSort.InstallTime
 
-                requests.offer(Request.ReloadApps)
+                requests.trySend(Request.ReloadApps)
             }
             R.id.update_time -> {
                 uiStore.accessControlSort = AppInfoSort.UpdateTime
 
-                requests.offer(Request.ReloadApps)
+                requests.trySend(Request.ReloadApps)
             }
             R.id.reverse -> {
                 uiStore.accessControlReverse = item.isChecked
 
-                requests.offer(Request.ReloadApps)
+                requests.trySend(Request.ReloadApps)
             }
             R.id.import_from_clipboard -> {
-                requests.offer(Request.Import)
+                requests.trySend(Request.Import)
             }
             R.id.export_to_clipboard -> {
-                requests.offer(Request.Export)
+                requests.trySend(Request.Export)
             }
             else -> return false
         }
diff --git a/design/src/main/java/com/github/kr328/clash/design/util/Inserts.kt b/design/src/main/java/com/github/kr328/clash/design/util/Inserts.kt
index 91b6ab955518977a8cb969eee3662581025c6eab..65255781892556bd60d987dda5a96d67705f8e80 100644
--- a/design/src/main/java/com/github/kr328/clash/design/util/Inserts.kt
+++ b/design/src/main/java/com/github/kr328/clash/design/util/Inserts.kt
@@ -8,7 +8,7 @@ import com.github.kr328.clash.design.ui.Insets
 fun View.setOnInsertsChangedListener(adaptLandscape: Boolean = true, listener: (Insets) -> Unit) {
     setOnApplyWindowInsetsListener { v, ins ->
         val compat = WindowInsetsCompat.toWindowInsetsCompat(ins)
-        val insets = compat.systemWindowInsets
+        val insets = compat.getInsets(WindowInsetsCompat.Type.systemBars())
 
         val rInsets = if (ViewCompat.getLayoutDirection(v) == ViewCompat.LAYOUT_DIRECTION_LTR) {
             Insets(
@@ -28,7 +28,7 @@ fun View.setOnInsertsChangedListener(adaptLandscape: Boolean = true, listener: (
 
         listener(if (adaptLandscape) rInsets.landscape(v.context) else rInsets)
 
-        compat.consumeStableInsets().toWindowInsets()
+        compat.toWindowInsets()
     }
 
     requestApplyInsets()
diff --git a/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt b/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt
index f81a817d7694fc65ac0e21d649f78cf44b852134..8488a234351d4c9aa6d855d7e00d0c7818cb712f 100644
--- a/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt
+++ b/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt
@@ -6,6 +6,7 @@ import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import androidx.core.content.getSystemService
+import com.github.kr328.clash.common.Global
 import com.github.kr328.clash.common.compat.pendingIntentFlags
 import com.github.kr328.clash.common.compat.startForegroundServiceCompat
 import com.github.kr328.clash.common.constants.Intents
@@ -16,7 +17,6 @@ import com.github.kr328.clash.service.data.Imported
 import com.github.kr328.clash.service.data.ImportedDao
 import com.github.kr328.clash.service.model.Profile
 import com.github.kr328.clash.service.util.importedDir
-import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.sync.Mutex
 import kotlinx.coroutines.sync.withLock
@@ -27,7 +27,7 @@ class ProfileReceiver : BroadcastReceiver() {
         when (intent.action) {
             Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MY_PACKAGE_REPLACED,
             Intent.ACTION_TIMEZONE_CHANGED, Intent.ACTION_TIME_CHANGED -> {
-                GlobalScope.launch {
+                Global.launch {
                     reset()
 
                     val service = Intent(Intents.ACTION_PROFILE_SCHEDULE_UPDATES)
diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/ConfigurationModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/ConfigurationModule.kt
index 202643c9b129522e6d6e041936f9a57b90f301e0..7be054364424c24a9530ae9b2522a929fb407fe5 100644
--- a/service/src/main/java/com/github/kr328/clash/service/clash/module/ConfigurationModule.kt
+++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/ConfigurationModule.kt
@@ -28,7 +28,7 @@ class ConfigurationModule(service: Service) : Module<ConfigurationModule.LoadExc
 
         var loaded: UUID? = null
 
-        reload.offer(Unit)
+        reload.trySend(Unit)
 
         while (true) {
             val changed: UUID? = select {
@@ -75,6 +75,6 @@ class ConfigurationModule(service: Service) : Module<ConfigurationModule.LoadExc
     }
 
     fun reload() {
-        reload.offer(Unit)
+        reload.trySend(Unit)
     }
 }
\ No newline at end of file
diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt
index 75dd61b149c84c3bea6d44ab531f70c8c931ade1..93d2c38427462debc0901c9fd93c7d99c938ba5c 100644
--- a/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt
+++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt
@@ -39,7 +39,7 @@ abstract class Module<E>(val service: Service) {
                     return
                 }
 
-                channel.offer(intent)
+                channel.trySend(intent)
             }
         }
 
diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/NetworkObserveModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/NetworkObserveModule.kt
index 877662b6dbbf717fd7071bd16259e4e43bf13ade..d1f48fc674d5d1a6966bea3cef17773683120580 100644
--- a/service/src/main/java/com/github/kr328/clash/service/clash/module/NetworkObserveModule.kt
+++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/NetworkObserveModule.kt
@@ -36,7 +36,7 @@ class NetworkObserveModule(service: Service) :
         override fun onAvailable(network: Network) {
             this.network = network
 
-            networks.offer(network)
+            networks.trySend(network)
         }
 
         override fun onCapabilitiesChanged(
@@ -49,19 +49,19 @@ class NetworkObserveModule(service: Service) :
             if (this.network == network && this.internet != internet) {
                 this.internet = internet
 
-                networks.offer(network)
+                networks.trySend(network)
             }
         }
 
         override fun onLost(network: Network) {
             if (this.network == network) {
-                networks.offer(null)
+                networks.trySend(null)
             }
         }
 
         override fun onLinkPropertiesChanged(network: Network, linkProperties: LinkProperties) {
             if (this.network == network) {
-                networks.offer(network)
+                networks.trySend(network)
             }
         }
     }
diff --git a/service/src/main/java/com/github/kr328/clash/service/data/Database.kt b/service/src/main/java/com/github/kr328/clash/service/data/Database.kt
index 550c976f297fc6d53012b49dadb5f9595adf565c..e8f4b6087580dc5150176e576cfc3a4744cfee75 100644
--- a/service/src/main/java/com/github/kr328/clash/service/data/Database.kt
+++ b/service/src/main/java/com/github/kr328/clash/service/data/Database.kt
@@ -7,7 +7,6 @@ import com.github.kr328.clash.common.Global
 import com.github.kr328.clash.service.data.migrations.LEGACY_MIGRATION
 import com.github.kr328.clash.service.data.migrations.MIGRATIONS
 import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import java.lang.ref.SoftReference
 import androidx.room.Database as DB
@@ -41,7 +40,7 @@ abstract class Database : RoomDatabase() {
         }
 
         init {
-            GlobalScope.launch(Dispatchers.IO) {
+            Global.launch(Dispatchers.IO) {
                 LEGACY_MIGRATION(Global.application)
             }
         }