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的方法
PHPz2017-04-17 17:35:02
Personal test: Use dollar sign to connect inner classes, see:
http://stackoverflow.com/questions/22528...
阿神2017-04-17 17:35:02
I don’t know about xposed (sweat), but anonymous classes in Java classes are processed as subclasses when compiled, and class files are generated independently, such as SensorManager$1.class. It is recommended that you study it from this perspective#🎜🎜 #