Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add override of getString method #19

Merged
merged 2 commits into from
Dec 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions app/src/main/java/net/accelf/devoptshide/HideDevOpts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ class HideDevOpts : IXposedHookLoadPackage {
Int::class.java,
callback,
)

findAndHookMethod(
parent,
"getString",
ContentResolver::class.java,
String::class.java,
callback,
)
}
}

Expand All @@ -44,16 +52,19 @@ class HideDevOpts : IXposedHookLoadPackage {
)

private val callback = object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam?) {
override fun beforeHookedMethod(param: MethodHookParam) {
if (
param == null
|| param.args[1] !is String
param.args[1] !is String
|| !names.contains(param.args[1] as String)
) {
return
}

param.result = 0
param.result = when (param.method.getName()) {
"getInt" -> 0
"getString" -> "0"
else -> error("Illegal method name passed.")
}
}
}
}
Expand Down