提交 3b4d404c 编写于 作者: J jackjintai

android:修复高德检测到location hook 返回errorCode =12的bug

上级 1eb159cc
......@@ -2,6 +2,7 @@ package com.didichuxing.doraemonkit.aop;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationListener;
import com.blankj.utilcode.util.ReflectUtils;
import com.didichuxing.doraemonkit.kit.gpsmock.GpsMockManager;
/**
......@@ -26,10 +27,12 @@ public class AMapLocationListenerProxy implements AMapLocationListener {
try {
mapLocation.setLatitude(GpsMockManager.getInstance().getLatitude());
mapLocation.setLongitude(GpsMockManager.getInstance().getLongitude());
//通过反射强制改变p的值 原因:看mapLocation.setErrorCode
ReflectUtils.reflect(mapLocation).field("p", 0);
mapLocation.setErrorInfo("success");
} catch (Exception e) {
e.printStackTrace();
}
}
if (aMapLocationListener != null) {
aMapLocationListener.onLocationChanged(mapLocation);
......
......@@ -110,6 +110,7 @@ class DokitWebViewClientProxy(webViewClient: WebViewClient?) : WebViewClient() {
val host = url?.host()
//如果是dokit mock host 则不进行拦截
if (host.equals(NetworkManager.MOCK_HOST, true)) {
JsRequestManager.jsRequestMap.remove(requestBean.requestId)
return null
}
//web 抓包
......@@ -160,6 +161,7 @@ class DokitWebViewClientProxy(webViewClient: WebViewClient?) : WebViewClient() {
val newResponse = mOkhttpClient.newCall(newRequest).execute()
//是否命中拦截规则
if (!interceptMatchedId.isNullOrBlank()) {
JsRequestManager.jsRequestMap.remove(requestBean.requestId)
return JsHttpUtil.matchedInterceptRule(
httpUrl,
path,
......@@ -185,8 +187,10 @@ class DokitWebViewClientProxy(webViewClient: WebViewClient?) : WebViewClient() {
}
JsRequestManager.jsRequestMap.remove(requestBean.requestId)
return null
}
} else {
return super.shouldInterceptRequest(view, request)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册