ActivityTracker ignore SuRequestActivity

This commit is contained in:
vvb2060 2022-02-14 23:07:24 +08:00 committed by John Wu
parent 945de8d9a0
commit 3956cbe2d2

View File

@ -9,6 +9,7 @@ import android.os.Bundle
import com.topjohnwu.magisk.StubApk import com.topjohnwu.magisk.StubApk
import com.topjohnwu.magisk.core.utils.* import com.topjohnwu.magisk.core.utils.*
import com.topjohnwu.magisk.di.ServiceLocator import com.topjohnwu.magisk.di.ServiceLocator
import com.topjohnwu.magisk.ui.surequest.SuRequestActivity
import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.internal.UiThreadHandler import com.topjohnwu.superuser.internal.UiThreadHandler
import com.topjohnwu.superuser.ipc.RootService import com.topjohnwu.superuser.ipc.RootService
@ -94,10 +95,12 @@ object ActivityTracker : Application.ActivityLifecycleCallbacks {
val hasForeground get() = foreground != null val hasForeground get() = foreground != null
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
if (activity is SuRequestActivity) return
foreground = activity foreground = activity
} }
override fun onActivityPaused(activity: Activity) { override fun onActivityPaused(activity: Activity) {
if (activity is SuRequestActivity) return
foreground = null foreground = null
} }