Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Two module hook same method #273

Open
lehungmt94 opened this issue Mar 23, 2019 · 0 comments
Open

Two module hook same method #273

lehungmt94 opened this issue Mar 23, 2019 · 0 comments

Comments

@lehungmt94
Copy link

lehungmt94 commented Mar 23, 2019

I hook to method getIntExtra but some another module of another developer hook to this method too. After hook I can't control setResult().
can Xposed set priority of module?

`XposedHelpers.findAndHookMethod(
"android.content.Intent", lpparam.classLoader,"getIntExtra", String.class, int.class, new XC_MethodHook() {
@OverRide
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}

                @Override
                protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                    Intent intent = (Intent) param.thisObject;
                    final String action = intent.getAction();
                    if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
                        if (BatteryManager.EXTRA_LEVEL.equals(param.args[0] + "")) {

                            Random r = new Random();
                            int I =r.nextInt(100);
                            param.setResult(I);
                            Log.e(TAG, "getIntExtra: "+param.args[0]+" Value: "+ I);
                        }
                        else if ("status".equals(param.args[0] + "")) {
                            XposedBridge.log("status");
                            Log.e(TAG, "getIntExtra: "+param.args[0]);
                            param.setResult(BatteryManager.BATTERY_STATUS_CHARGING);
                        }
                    }
                }
            }

);`

@lehungmt94 lehungmt94 changed the title Tow module hook same method Two module hook same method Mar 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant