Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lz233 committed Jan 14, 2023
2 parents 0f87e12 + 4fa193c commit 0834d96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions app/src/main/java/cn/ac/lz233/tarnhelm/xposed/module/Android.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

}

0 comments on commit 0834d96

Please sign in to comment.