[Xposed General] haskell_noob:
Hey,

I am trying to create a module for my Nexus 7 mobile tablet (2013). This module is supposed to allow the device to receive all APDUs and send them to my target application.

To do this I want to modify the HostEmulationManager class, specifically the notifyHostEmulationData() method. I have had a look at the 4.4.3 source code and notifyHostEmulationData() exists, but I am getting a NoSuchMethodError and having trouble figuring out what is wrong, any thoughts?

Logcat:

07-10 23:06:56.556: D/Xposed(185): Starting Xposed binary version 58, compiled for SDK 16
07-10 23:06:56.556: D/Xposed(185): Phone: Nexus 7 (asus), Android version 4.4.3 (SDK 19)
07-10 23:06:56.556: D/Xposed(185): ROM: KTU84L
07-10 23:06:56.556: D/Xposed(185): Build fingerprint: google/razorg/deb:4.4.3/KTU84L/1148727:user/release-keys
07-10 23:06:56.556: I/Xposed(185): -----------------
07-10 23:06:56.556: I/Xposed(185): Added Xposed (/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar) to CLASSPATH.
07-10 23:06:56.786: D/Xposed(185): Using structure member offsets for mode WITH_JIT
07-10 23:06:56.846: I/Xposed(185): Found Xposed class 'de/robv/android/xposed/XposedBridge', now initializing
07-10 23:06:57.327: I/Xposed(185): -----------------
07-10 23:06:57.327: I/Xposed(185): Jul 10, 2014 11:06:57 AM UTC
07-10 23:06:57.327: I/Xposed(185): Loading Xposed v54 (for Zygote)...
07-10 23:06:57.337: I/Xposed(185): Running ROM 'KTU84L' with fingerprint 'google/razorg/deb:4.4.3/KTU84L/1148727:user/release-keys'
07-10 23:06:57.457: I/Xposed(185): Loading modules from /data/app/com.example.nfc_xposed_module_nfcmanager-1.apk
07-10 23:06:57.757: I/Xposed(185): Loading class com.example.nfc_xposed_module_nfcmanager.ModEmulationManager
07-10 23:07:09.979: I/Xposed(932): In the com.android.nfc application
07-10 23:07:09.989: I/Xposed(932): java.lang.NoSuchMethodError: com.android.nfc.cardemulation.HostEmulationManager#notifyHostEmulationData()#exact
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.XposedHelpers.findMethodExact(XposedHelpers.java:179)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:129)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:136)
07-10 23:07:09.989: I/Xposed(932):	at com.example.nfc_xposed_module_nfcmanager.ModEmulationManager.handleLoadPackage(ModEmulationManager.java:25)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:20)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:34)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:70)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.XposedBridge$1.beforeHookedMethod(XposedBridge.java:208)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:611)
07-10 23:07:09.989: I/Xposed(932):	at android.app.ActivityThread.handleBindApplication(Native Method)
07-10 23:07:09.989: I/Xposed(932):	at android.app.ActivityThread.access$1500(ActivityThread.java:135)
07-10 23:07:09.989: I/Xposed(932):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
07-10 23:07:09.989: I/Xposed(932):	at android.os.Handler.dispatchMessage(Handler.java:102)
07-10 23:07:09.989: I/Xposed(932):	at android.os.Looper.loop(Looper.java:136)
07-10 23:07:09.989: I/Xposed(932):	at android.app.ActivityThread.main(ActivityThread.java:5001)
07-10 23:07:09.989: I/Xposed(932):	at java.lang.reflect.Method.invokeNative(Native Method)
07-10 23:07:09.989: I/Xposed(932):	at java.lang.reflect.Method.invoke(Method.java:515)
07-10 23:07:09.989: I/Xposed(932):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-10 23:07:09.989: I/Xposed(932):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-10 23:07:09.989: I/Xposed(932):	at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
07-10 23:07:09.989: I/Xposed(932):	at dalvik.system.NativeStart.main(Native Method)

This is my code:

package com.example.nfc_xposed_module_nfcmanager;

import android.webkit.WebView.FindListener;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;

public class ModEmulationManager implements IXposedHookLoadPackage {

@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {

if(!lpparam.packageName.equals("com.android.nfc")){
return;
}

//Log that we are in the com.android.nfc application
XposedBridge.log("In the com.android.nfc application");

try{

findAndHookMethod("com.android.nfc.cardemulation.HostEmulationManager",
lpparam.classLoader,
"notifyHostEmulationData",
new XC_MethodHook(){
@Override
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("Before");
}

@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
XposedBridge.log("After");
}
});

}catch(Exception e){

}

}
}