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 aa8e597ee..230f5046b 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 @@ -1,5 +1,6 @@ package com.github.kr328.clash.design +import android.app.ActivityManager import android.content.Context import android.view.View import com.github.kr328.clash.design.databinding.DesignSettingsCommonBinding @@ -70,7 +71,15 @@ class AppSettingsDesign( icon = R.drawable.eye_off, title = R.string.exclude_from_recents, summary = R.string.exclude_from_recents_summary, - ) + ) { + listener = OnChangedListener { + (context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).let { manager -> + manager.appTasks.forEach { task -> + task?.setExcludeFromRecents(uiStore.excludeFromRecents) + } + } + } + } category(R.string.service)