androidsubclassabstractxposed

How to hook the abstract method hasSystemFeature?


I want to hook PackageManager's hasSystemFeature system method. But this method is abstract. In fact, PackageManager itself is an abstract class. Hooking the method gives the following exception.

java.lang.IllegalArgumentException: Cannot hook abstract methods: public abstract boolean android.content.pm.PackageManager.hasSystemFeature(java.lang.String)

Usually we call context.getPackageManager().hasSystemFeature(string), but I never know what the implementing subclass is! So what can I do in this case?


Solution

  • I used Smali debugging to find that the right class to hook is

    android.content.pm.IPackageManager.Stub.Proxy