@Override
public void reportLocation(Location location, boolean passive) {
checkCallerIsProvider(); //检测权限和uid
if (!location.isComplete()) {
Log.w(TAG, "Dropping incomplete location: " + location);
return;
}
//发送位置信息
mLocationHandler.removeMessages(MSG_LOCATION_CHANGED, location);
Message m = Message.obtain(mLocationHandler, MSG_LOCATION_CHANGED, location);
m.arg1 = (passive ? 1 : 0);
mLocationHandler.sendMessageAtFrontOfQueue(m);
}
XposedHelpers.findAndHookMethod("com.android.server.LocationManagerService", lpparam.classLoader, "reportLocation", Location.class, boolean.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Location location = (Location) param.args[0];
XposedBridge.log("实际 系统 经度"+location.getLatitude() +" 系统 纬度"+location.getLongitude() +"系统 加速度 "+location.getAccuracy());
XSharedPreferences xsp =new XSharedPreferences("com.markypq.gpshook","markypq");
if (xsp.getBoolean("enableHook",true)){
double latitude = Double.valueOf(xsp.getString("lan","117.536246"))+ (double) new Random().nextInt(1000) / 1000000 ;
double longtitude = Double.valueOf(xsp.getString("lon","36.681752"))+ (double) new Random().nextInt(1000) / 1000000 ;
location.setLongitude(longtitude);
location.setLatitude(latitude);
XposedBridge.log("hook 系统 经度"+location.getLatitude() +" 系统 纬度"+location.getLongitude() +"系统 加速度 "+location.getAccuracy());
}
}
});
XposedBridge.hookAllConstructors(LocationManager.class,new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
if (param.args.length==2) {
Context context = (Context) param.args[0]; //这里的 context
XposedBridge.log(" 对 "+getProgramNameByPackageName(context)+" 模拟位置");
//把权限的检查 hook掉
XposedHelpers.findAndHookMethod(context.getClass(), "checkCallingOrSelfPermission", String.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
if (param.args[0].toString().contains("INSTALL_LOCATION_PROVIDER")){
param.setResult(PackageManager.PERMISSION_GRANTED);
}
}
});
XposedBridge.log("LocationManager : " + context.getPackageName() + " class:= " + param.args[1].getClass().toString());
//获取到 locationManagerService 主动调用 对象的 reportLocation 方法 可以去模拟提供位置信息
//这里代码中并没有涉及到主动调用
Object locationManagerService = param.args[1];
}
}
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有