diff --git a/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/module/Android.kt b/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/module/Android.kt index 464c7a3..1a7a1a7 100644 --- a/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/module/Android.kt +++ b/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/module/Android.kt @@ -132,6 +132,21 @@ object Android { }.onFailure { LogUtil.xpe(it) } } }.onFailure { LogUtil.xpe(it) } + runCatching { + "com.android.server.am.UidRecord".hookBeforeMethod("isSetIdle") { param -> + runCatching { + val ams = param.thisObject.getObjectField("mService") ?: throw Exception("AMS is null") + val context = ams.getObjectField("mContext") as Context + val uid = param.thisObject.getIntField("mUid") + context.packageManager.getPackagesForUid(uid)?.let { + if (it.contains(Config.packageName)) { + LogUtil.xpe("isSetIdle hooked, set result to false") + param.result = false + } + } + }.onFailure { LogUtil.xpe(it) } + } + } } @SuppressLint("PrivateApi") diff --git a/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/util/ModuleBridgeHelper.kt b/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/util/ModuleBridgeHelper.kt index f6f0998..e966543 100644 --- a/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/util/ModuleBridgeHelper.kt +++ b/app/src/main/java/cn/ac/lz233/tarnhelm/xposed/util/ModuleBridgeHelper.kt @@ -87,7 +87,8 @@ object ModuleBridgeHelper { bridge?.let { return it.doTarnhelms(string) } - throw Exception("Bridge is not available") + LogUtil.xpe("Bridge is not available") + return string } } \ No newline at end of file