Skip to content

Commit

Permalink
调整方法
Browse files Browse the repository at this point in the history
  • Loading branch information
HChenX committed Feb 15, 2024
1 parent 924e1f6 commit 87cea81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ android {
minSdk 30
targetSdk 34
//noinspection HighAppVersionCode
versionCode 2024021502
versionName "4.2.3"
versionCode 2024021503
versionName "4.2.5"
ndk {
// noinspection ChromeOsAbiSupport
abiFilters 'arm64-v8a', 'armeabi-v7a'
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/com/hchen/appretention/mode/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected void beforeHookedMethod(MethodHookParam param) {
try {
before(param);
LogTool.Info info = mLogTool.paramCheck(param);
final LogTool.Info getInfo = mLogTool.getInfo(info.method, info.thisObject);
LogTool.Info getInfo = mLogTool.getInfo(info.method, info.thisObject);
/*日志过滤*/
/*logFilter(hookLog(), new String[]{"AthenaApp", "OplusBattery"},
() -> logI(hookLog(), getInfo.thisObject, getInfo.methodProcessed),
Expand Down Expand Up @@ -402,7 +402,7 @@ public Method getDeclaredMethod(String className, String method, Object... type)
}

public Method getDeclaredMethod(Class<?> clazz, String method, Object... type) throws NoSuchMethodException {
// String tag = "getDeclaredMethod";
// String tag = "getDeclaredMethod";
ArrayList<Method> haveMethod = new ArrayList<>();
Method hqMethod = null;
int methodNum;
Expand Down Expand Up @@ -503,15 +503,15 @@ public void setDeclaredField(XC_MethodHook.MethodHookParam param, String iNeedSt
}
}

public void checkLast(String setObject, Object fieldName, Object value, Object last) {
public void checkLast(String method, Object fieldName, Object value, Object last) {
if (value != null && last != null) {
if (value == last || value.equals(last)) {
logI(tag, setObject + " Success! set " + fieldName + " to " + value);
logI(tag, method + " Success! set " + fieldName + " to " + value);
} else {
logE(tag, setObject + " Failed! set " + fieldName + " to " + value + " hope: " + value + " but: " + last);
logE(tag, method + " Failed! set " + fieldName + " to " + value + " hope: " + value + " but: " + last);
}
} else {
logE(tag, setObject + " Error value: " + value + " or last: " + last + " is null");
logE(tag, method + " Error value: " + value + " or last: " + last + " is null");
}
}

Expand All @@ -526,7 +526,7 @@ public Object getObjectField(Object obj, String fieldName) {

public void setStaticBoolean(Class<?> cl, String fieldName, boolean value) {
if (cl == null) {
logE(tag, "SetStaticBoolean class can't is null field: " + fieldName + " value: " + value);
logE(tag, "SetStaticBoolean class can't is null, field: " + fieldName + " value: " + value);
return;
}
checkAndSetField(null, cl, fieldName,
Expand All @@ -537,24 +537,24 @@ public void setStaticBoolean(Class<?> cl, String fieldName, boolean value) {

public void setStaticInt(Class<?> cl, String fieldName, int value) {
if (cl == null) {
logE(tag, "SetStaticInt class can't is null field: " + fieldName + " value: " + value);
logE(tag, "SetStaticInt class can't is null, field: " + fieldName + " value: " + value);
return;
}
checkAndSetField(null, cl, fieldName,
() -> XposedHelpers.setStaticIntField(cl, fieldName, value),
() -> XposedHelpers.getStaticIntField(cl, fieldName),
"SetStaticBoolean", value);
"setStaticInt", value);
}

public void setStaticObject(Class<?> cl, String fieldName, Object value) {
if (cl == null) {
logE(tag, "SetStaticObject class can't is null field: " + fieldName + " value: " + value);
logE(tag, "SetStaticObject class can't is null, field: " + fieldName + " value: " + value);
return;
}
checkAndSetField(null, cl, fieldName,
() -> XposedHelpers.setStaticObjectField(cl, fieldName, value),
() -> XposedHelpers.getStaticObjectField(cl, fieldName),
"SetStaticBoolean", value);
"setStaticObject", value);
}

public void setInt(Object obj, String fieldName, int value) {
Expand Down

0 comments on commit 87cea81

Please sign in to comment.