I am trying to capture all the method calls made in any android application. For this, I use JDI to register MethodEntryRequest for each running application thread. I will be able to do this, but I ran into a problem that the application is getting very slow. So I want to know that I am doing something wrong in my implementation. I add my code where I first register a ClassPreparedRequest to catch the loading of each class by the application, and in this I register a MethodEntryRequest with threadfilter for the thread, which causes the class to load.
if(!traceMap.keySet().contains(event.thread()))
{
EventRequestManager mgr = vm.eventRequestManager();
MethodEntryRequest menr = mgr.createMethodEntryRequest();
menr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
menr.addThreadFilter(event.thread());
menr.enable();
}
ClassPreparedRequest Registration Code
ClassPrepareRequest cpr = mgr.createClassPrepareRequest();
cpr.addClassFilter("com.example.*");
cpr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
cpr.enable();
source
share