Xposed hook函数内有匿名内部类该怎么写?

sensorManager.registerListener(new SensorEventListener() {

    @Override

    public void onSensorChanged(SensorEvent event) {

    

    }

    

    @Override

    public void onAccuracyChanged(Sensor sensor, int accuracy) {

    

    }

    }, sensorGravity, SensorManager.SENSOR_DELAY_NORMAL);

怎么hook这里的SensorEventListener?




目标是hook住android.hardware.SensorManager.registerListener(SensorEventListener listener, Sensor sensor, int samplingPeriodUs) 的listener里的onSensorChanged(SensorEvent event)这个函数.


XposedHelpers.findAndHookMethod("android.hardware.SensorManager", loadPackageParam.classLoader, "registerListener", SensorEvent.class, new XC_MethodHook() {

    @Override

    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

        SensorEventListener event = (SensorEventListener) param.args[0];

    }

});

在官方教程里找不到描述这种hook的方法


拉丁的传说
浏览 1214回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java