rovo89 / XposedBridge

The Java part of the Xposed framework.
3.91k stars 1.1k forks source link

Nested hooks. Can we get it? #45

Closed sorgelig closed 9 years ago

sorgelig commented 9 years ago

It was mentioned here and there time after time, but i want to ask about current status of this feature. Different Xposed modules may overlap their hooks and it's not always the same features, but using same functions. Thus, nesting hooks is very important feature. Xposed framework should know about all hooks and i believe it's technically should be possible to call previous hook (or original function if there are no previous hooks). I see only only issue: priorities of nested hooks. But it can be solved in Xposed framework installer where user can manually sort installed modules.

rovo89 commented 9 years ago

What do you mean with "nested"? You know that functions can be hooked multiple times, and that you can specify the priority for your hook?

sorgelig commented 9 years ago

May be i've missed this update. I remember some time ago several modules couldn't hook the same function. May be i need to study the new API. So, only module developer can specify the priority, not end user? Because different users may decide differently which module should have priority.

manvir-singh commented 9 years ago

The hook priorities are module based. For example if you are hooking the same method twice, but you want the first hook to hook it self first then you would give it the priority over the second hook. So yes only the module developers can specify the priority. As for system wide module priorities example giving one module priority over the other has not been implanted.

rovo89 commented 9 years ago

It has been possible since the very first version three years ago. In Xposed 2.0 (also very old), the API has changed a lot and this has become quite easy. Previously, you indeed had to call a method to proceed with the next module (or finally the original method).

Yes, only the module developer can choose the priority. I don't have the time to explain again why allowing the user to choose the priority will hardly ever work correctly. In short: There are many ways to achieve the same goal, with different functions to hook (so priorities wouldn't apply) and different implementations within the hooks. Priorities don't make modules magically compatible.