Skip to content

Commit

Permalink
fix: wake lock acquire not release will cause problem in BasicHookFac…
Browse files Browse the repository at this point in the history
…tory
  • Loading branch information
fankes committed Sep 6, 2024
1 parent 215d680 commit 43e0dff
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.highcapable.yukihookapi.hook.factory.field
import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.type.android.PowerManager_WakeLockClass
import com.highcapable.yukihookapi.hook.type.java.IntType
import kotlin.system.exitProcess

/** QQ、TIM 存在的类 */
Expand Down Expand Up @@ -81,8 +82,14 @@ fun Activity.jumpToModuleSettings(isFinish: Boolean = true) {

/** Hook 系统电源锁 */
fun PackageParam.hookSystemWakeLock() {
PowerManager_WakeLockClass.method {
name = "acquireLocked"
emptyParam()
}.hook().intercept()
PowerManager_WakeLockClass.apply {
method {
name = "acquireLocked"
emptyParam()
}.hook().intercept()
method {
name = "release"
param(IntType)
}.hook().intercept()
}
}

0 comments on commit 43e0dff

Please sign in to comment.