Commit b27b4934 authored by Administrator's avatar Administrator

1.3 强制定位成功

parent 681838b1
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
applicationId "com.virjar.ratel.virtuallocation" applicationId "com.virjar.ratel.virtuallocation"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 28 targetSdkVersion 28
versionCode 20210419 versionCode 20210420
versionName "v1.2" versionName "v1.3"
archivesBaseName = "JDY_${versionName}".replace(' ', '_') archivesBaseName = "JDY_${versionName}".replace(' ', '_')
ndk { ndk {
abiFilters "armeabi-v7a", "arm64-v8a"//, "x86","arm64-v8a","x86_64" abiFilters "armeabi-v7a", "arm64-v8a"//, "x86","arm64-v8a","x86_64"
......
...@@ -20,6 +20,7 @@ import org.json.JSONObject; ...@@ -20,6 +20,7 @@ import org.json.JSONObject;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
...@@ -367,12 +368,35 @@ public class XPosedPlugin implements IRposedHookLoadPackage { ...@@ -367,12 +368,35 @@ public class XPosedPlugin implements IRposedHookLoadPackage {
// public void setAddress(String var1) { // public void setAddress(String var1) {
try { try {
RposedHelpers.callMethod(obj, "setAddress", AppApplication.mockGPS.address); RposedHelpers.callMethod(obj, "setAddress", AppApplication.mockGPS.address);
Integer errorCode = (Integer) RposedHelpers.callMethod(obj, "getErrorCode");
if (errorCode != 0) {
// 高德返回了错误,我们这里把他覆盖为成功
RposedHelpers.callMethod(obj, "setErrorInfo", "");
// 比较麻烦,这里看如果写如果,第二次写入无法生效,但是由于混淆,属性名称不定,无法直接反射
for (Field field : obj.getClass().getDeclaredFields()) {
if (!field.getType().equals(int.class)) {
continue;
}
field.setAccessible(true);
int anInt = field.getInt(obj);
if (anInt == errorCode) {
Log.i(TAG, "find int field: " + field);
field.set(obj, 0);
}
}
RposedHelpers.callMethod(obj, "setErrorCode", 0);
}
} catch (Throwable throwable) { } catch (Throwable throwable) {
Log.w(TAG, "error", throwable);
throwable.printStackTrace(); throwable.printStackTrace();
} }
} }
} }
Log.i(TAG, "call method: " + method + " param: " + args[0]);
return RposedHelpers.callMethod(originListener, method.getName(), args); return RposedHelpers.callMethod(originListener, method.getName(), args);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment