I am trying to hook a method inside the Always-On Display code for OnePlus phones, but when I use XposedHelpers.findClass() it ends up returning java.lang.Class, and as such returns a noSuchMethodError.
Call code:
findAndHookMethod("com.oneplus.aod.OpAodThreeKeyStatusView", lpparam.classLoader, "onThreeKeyChanged", "int", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.callMethod((XposedHelpers.findClass("com.oneplus.aod.OpAodDisplayViewManager", lpparam.classLoader)), "startDozing");
}
});
I'm trying to call "com.oneplus.aod.OpAodDisplayViewManager" which I know exists because I extracted the APK from my own phone. However, it returns java.lang.Class and then returns that the method "startDozing" doesn't exist.
Since XposedHelpers.findClass() returns java.lang.Class, the solution was to instantiate a new Object like so:
Object displayManager = "com.oneplus.aod.OpAodDisplayViewManager"
and then call the method using that object rather than the findClass() function