I am using dexlib2 to overwrite an existing apk through a single jar utility. I want to change one instruction with my own instruction. It basically returns some object, and I want to replace it with another method that returns another object. It can replace the method, but when I looked at the updated dex, I see the following line with .local v1, manager: Lblah / KeyguardManager;
The code I want to replace
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
Code to be replaced above:
Manager mgr=Manager.getInstance(this)
I used the getInstructionRewriter method to replace it. It replaces the method, but I cannot figure out how to replace .local v1, manager: Lblah / KeyguardManager; with .local v1, manager: Lblah / Manager;
java android dex smali
chikka.anddev
source share