Closed wavetg closed 1 year ago
https://github.com/Simplicity-Team/WooBoxForMIUI
import com.github.kyuubiran.ezxhelper.utils.findMethod import com.github.kyuubiran.ezxhelper.utils.hookBefore import com.lt2333.simplicitytools.utils.hasEnable import com.lt2333.simplicitytools.utils.xposed.base.HookRegister object DoNotClearAppForS : HookRegister() { override fun init() { findMethod("com.miui.powerkeeper.statemachine.SleepModeControllerNew") { name == "clearApp" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("com.miui.powerkeeper.statemachine.PowerStateMachine") { name == "clearAppWhenScreenOffTimeOut" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("com.miui.powerkeeper.statemachine.PowerStateMachine") { name == "clearAppWhenScreenOffTimeOutInNight" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("com.miui.powerkeeper.powerchecker.PowerCheckerController") { name == "clearApp" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("com.miui.powerkeeper.powerchecker.PowerCheckerController") { name == "autoKillApp" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("com.miui.powerkeeper.statemachine.SleepModeController\$SleepProcessHelper") { name == "killAppsInSleep" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("com.miui.powerkeeper.statemachine.DynamicTurboPowerHandler") { name == "clearApp" }.hookBefore { hasEnable("do_not_clear_app") { it.result = null } } findMethod("miui.process.ProcessManager") { name == "kill" }.hookBefore { hasEnable("do_not_clear_app") { it.result = false } } } }
package star.sky.voyager.hook.hooks.powerkeeper import com.github.kyuubiran.ezxhelper.ClassUtils import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import star.sky.voyager.utils.init.HookRegister import star.sky.voyager.utils.key.hasEnable object DoNotClearAppPlusP : HookRegister() { override fun init() = hasEnable("do_not_clear_app_plus") { ClassUtils.loadClassOrNull("android.os.spc.PressureStateSettings")?.let { ClassUtils.setStaticObject(it, "PROCESS_CLEANER_ENABLED", false) } ClassUtils.loadClass("com.android.server.am.ActivityManagerService").methodFinder().first { name == "checkExcessivePowerUsage" }.createHook { before { it.result = null } } ClassUtils.loadClass("com.android.server.am.OomAdjuster").methodFinder().first { name == "shouldKillExcessiveProcesses" }.createHook { before { it.result = false } } ClassUtils.loadClass("com.android.server.am.PhantomProcessList").methodFinder().first { name == "trimPhantomProcessesIfNecessary" }.createHook { before { it.result = null } } } }
经讨论,并不打算做这个
仓库地址
https://github.com/Simplicity-Team/WooBoxForMIUI
移植内容
相关描述&截图