I am an aspiring developer whenever I have the time, and often when I don't. When I learned about the Xposed Framework, which allows you to inject your code or replace it at the level of methods in Java, I had to try it. I successfully implemented an idea I had to control whether Android consumes alt-tab events or lets apps handle them, and this is now published. However, as I tried to tackle more difficult problems that dealt more with closed source OEM code, I realized that the hardest part was actually just knowing exactly where to modify to get the desired effect. I tried some educated guessing and some trial and error, and while I had some success, there was just simply too much probing to do for a person.

At that point, I realized that I already had all the tools to write a program that could do exactly that. Using Java Reflection and the Xposed Framework, I could find not only the class hierarchy information easily obtained by partial decompliation tools, but also determine which control flow paths are actually executed at runtime, something impossible to predict based on only a class heirarchy and method names.

This is achieved by traversing the various classes, methods, and other elements, and whenever a method was encountered, adding a hook to it that called my code before the method's original code. Then, each time the method was called, I could obtain a stack trace and see exactly where the methods had been called from. Since Xposed modules often must work by changing behavior at the first possible opportunity, or at the last, this information is invaluable, and impossible to predict without runtime information.

This tool does not do everything at once, because that is impossible, but it gives an excellent start and could be easily modified by the developers who would be using it to suit their purposes. I know that I already plan to further customize this tool and use it for my future development. I hope that others find it as useful.

Built With

Share this project: