diff --git a/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt b/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt index 2b640f8..fdb1044 100644 --- a/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt +++ b/app/src/main/java/li/songe/gkd/ui/SettingsPage.kt @@ -1,5 +1,7 @@ package li.songe.gkd.ui +import android.app.ActivityManager +import android.content.Context import android.content.Intent import android.net.Uri import android.provider.Settings @@ -53,6 +55,7 @@ import com.blankj.utilcode.util.ZipUtils import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import li.songe.gkd.MainActivity +import li.songe.gkd.app import li.songe.gkd.appScope import li.songe.gkd.ui.component.SettingItem import li.songe.gkd.ui.component.TextSwitch @@ -115,6 +118,12 @@ fun SettingsPage() { desc = "在[最近任务]界面中隐藏本应用", checked = store.excludeFromRecents, onCheckedChange = { + + (app.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).let { manager -> + manager.appTasks.forEach { task -> + task?.setExcludeFromRecents(it) + } + } updateStorage( storeFlow, store.copy( excludeFromRecents = it