Support hiding app from Recents screen (#663)

This commit is contained in:
Zongle Wang
2026-02-09 15:59:03 +08:00
committed by GitHub
parent bd042125c5
commit 232f318bde
6 changed files with 37 additions and 0 deletions

View File

@@ -1,11 +1,13 @@
package com.github.kr328.clash
import android.app.ActivityManager
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.activity.result.contract.ActivityResultContract
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.getSystemService
import com.github.kr328.clash.common.compat.isAllowForceDarkCompat
import com.github.kr328.clash.common.compat.isLightNavigationBarCompat
import com.github.kr328.clash.common.compat.isLightStatusBarsCompat
@@ -88,6 +90,11 @@ abstract class BaseActivity<D : Design<*>> : AppCompatActivity(),
super.onCreate(savedInstanceState)
applyDayNight()
// Apply excludeFromRecents setting to all app tasks.
checkNotNull(getSystemService<ActivityManager>()).appTasks.forEach { task ->
task.setExcludeFromRecents(uiStore.hideFromRecents)
}
launch {
main()
}