New Xposed API Proposal

Search This thread

Dr-TSNG

New member
Mar 28, 2021
4
7
We are now working on the new Xposed API, which allows modules to get / set scope, to get framework info, and to store configs across apps without the embarrassing New-XSharedPreferences interface. The API library will be released to GitHub/libxposed and maven central after it is ready.

Now we are considering removal of resources hook in the incoming new API, so we need to know whether it is still needed or unreplaceable for some modules.

About why we want to remove this API: Resources hook is very hard to maintain and is even not fully supported now under some frameworks (e.g. Taichi). So even if we keep it, it will be maintain-only.
Old modules can still use this feature. We are just considering remove it in the new API.

You can vote at the LSPosed Telegram group or write your opinion here. Also we are glad to hear your suggestions about the new API.
 

siavash79

Senior Member
Dec 6, 2010
664
2,066
Tehran
Google Pixel C
Google Pixel 4 XL
We are now working on the new Xposed API, which allows modules to get / set scope, to get framework info, and to store configs across apps without the embarrassing New-XSharedPreferences interface. The API library will be released to GitHub/libxposed and maven central after it is ready.

Now we are considering removal of resources hook in the incoming new API, so we need to know whether it is still needed or unreplaceable for some modules.

About why we want to remove this API: Resources hook is very hard to maintain and is even not fully supported now under some frameworks (e.g. Taichi). So even if we keep it, it will be maintain-only.
Old modules can still use this feature. We are just considering remove it in the new API.

You can vote at the LSPosed Telegram group or write your opinion here. Also we are glad to hear your suggestions about the new API.
Thanks for getting opinions

1. Xshared preferences interface overhaul is good news since it was always unstable for me. I personally switched to remote preferences API for AOSPMods

2. When going to systemUI and framework, it's sometimes very difficult and complicated to change some variable values through Xposed, specially with R8 code optimizations which dramatically limit the points we can hook into code.

There are two workarounds I know of, being Xposed resource hooking that can be also dynamic in runtime, or overlays, which being static, still limit the way we can change resources dramatically.

So, I'd really suggest keeping it in the API
 
  • Like
Reactions: shadowstep

Dr-TSNG

New member
Mar 28, 2021
4
7
2. When going to systemUI and framework, it's sometimes very difficult and complicated to change some variable values through Xposed, specially with R8 code optimizations which dramatically limit the points we can hook into code.
For R8 code optimizations, we introduced a new API to parse dex file, which allows modules to find methods/fields more accurately.

Anyway if we finally decide to keep resources hook API, do you have any suggestions on keeping/adding/removing specific methods of it or refine it to a more modern interface?
 

siavash79

Senior Member
Dec 6, 2010
664
2,066
Tehran
Google Pixel C
Google Pixel 4 XL
Perfect news.

About resource hooking, few things to note are that: it can't differentiate between different resource files, for example normal values vs landscape or dark/light values. It would be great if there's a way to push different values to different resource files.
Also, there are more limitations when talking about special resources such as themes. As an example, in AOSPMods, one of the reasons it's a magisk module instead of being a normal APK is that overlay files have to be used in cases that need modification of theme resources and that can't be done via resource hooking.

I personally love to get a more complete/flexible resource hooking API, but I completely understand if that's too much to ask. So even keeping it as currently is would be good enough
 
  • Like
Reactions: shadowstep

David B.

Senior Member
Mar 25, 2016
491
160
Nexus 6
Google Pixel 3 XL
Thank you @shadowstep for bringing this to my attention!

We are now working on the new Xposed API, which allows modules to get / set scope, to get framework info, and to store configs across apps without the embarrassing New-XSharedPreferences interface. The API library will be released to GitHub/libxposed and maven central after it is ready.
That's wonderful news, although I do not quite understand what you have against the new XSharedPreferences interface. I use it in my modules, and I've never had any issues with it.

Now we are considering removal of resources hook in the incoming new API, so we need to know whether it is still needed or unreplaceable for some modules.

About why we want to remove this API: Resources hook is very hard to maintain and is even not fully supported now under some frameworks (e.g. Taichi). So even if we keep it, it will be maintain-only.
Old modules can still use this feature. We are just considering remove it in the new API.
I am not currently using the resources hook in any of my modules, so removing it would not impact me, but even so, I'm not a fan of the suggestion to get rid of it completely. I think that at the very least, it should be kept as maintain-only. It is unfortunate that it does not work with Taichi, but given that Taichi isn't a true Xposed implementation, I'm not sure that it's worth worrying about.
 
  • Like
Reactions: shadowstep

Quinny899

Recognized Developer / Recognized Contributor
Jan 26, 2011
9,106
8,560
25
Salford, Greater Manchester, UK
quinny898.co.uk
This looks great, I've been waiting for it since the initial issue talking about it. Prefs are always a pain to handle, and while the "new" method worked, I always preferred to use a Content Provider, which was nerfed in Android 12.

Really like the idea of setting the scope, it would be beneficial to the Xposed part of DarQ, the only suggestion I have is to make sure it includes some sort of "am I enabled?" check - currently I use self hooks (literally the module hooking itself and changing a method returning false to true) to verify it's enabled, but it doesn't seem to be foolproof as people sometimes still complain it doesn't work.
 
  • Like
Reactions: shadowstep

wanam

Recognized Developer / Inactive RC
Jan 26, 2011
6,209
30,009
Toulouse
wanam.net
OnePlus 7T
Sony Xperia 5 III
@shadowstep Thanks for the head up.
Glad to see a new api to manage configs across apps, shared prefs has been always painful to handle even with the new-xshared prefs.

I would suggest having an api to get the version name of scope's package, I'm aware of some workarounds that help get the version name, but it's not a reliable solution on the latest Android versions, this information is needed for logging/debugging purposes.

@Dr-TSNG thanks and keep up the good work.
 
  • Like
Reactions: shadowstep

AndroidX

Senior Member
Sep 28, 2016
250
156
Switch
Xiaomi Redmi Note 7 Pro
@Dr-TSNG Thanks for new api I was wating for this api from more then 1 year coz when I build my first module (Android Faker) its was really pain in ass coz of Xsharedpreference after some research I found better solution which was remote preference but Quinny899 mention in Github issue that its not work in android 11 so after that I move to new Xsharedpreference which was introduce by lsposed team and its working great but its still create issue in some devices so I think it will be a better solution if we get it soon and I am not sure about resources hook coz I don't use it before .
 
Last edited:
  • Like
Reactions: shadowstep

David B.

Senior Member
Mar 25, 2016
491
160
Nexus 6
Google Pixel 3 XL
Is your module installed as APK or as magisk module?

Try mounting it to system through magisk and preferences will stop working
It's installed as an APK. I misunderstood what you had said earlier. I thought you meant that the hook doesn't work when you try to use it on system APKs. I didn't realize that you meant that it doesn't work when the module is itself a system APK.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    the only suggestion I have is to make sure it includes some sort of "am I enabled?" check
    Of course does, and the module app can get more info about the the Xposed state like it's under which framework and which version, and whether it is rootless or not without self-hooking.
    You can view the detail here.
    2
    We are now working on the new Xposed API, which allows modules to get / set scope, to get framework info, and to store configs across apps without the embarrassing New-XSharedPreferences interface. The API library will be released to GitHub/libxposed and maven central after it is ready.

    Now we are considering removal of resources hook in the incoming new API, so we need to know whether it is still needed or unreplaceable for some modules.

    About why we want to remove this API: Resources hook is very hard to maintain and is even not fully supported now under some frameworks (e.g. Taichi). So even if we keep it, it will be maintain-only.
    Old modules can still use this feature. We are just considering remove it in the new API.

    You can vote at the LSPosed Telegram group or write your opinion here. Also we are glad to hear your suggestions about the new API.
    2
    @AndroidX @siavash79 @Dark_Eyes_ @firefds @David B. @Quinny899 @wanam

    Just mentioning you guys since you're all active here on XDA. Please see the first post. :)

    Regards,
    shadowstep
    Senior Moderator
    2
    Interesting. I use XSharedPreferences in a System Framework hook and haven't had any issues with it.
    Is your module installed as APK or as magisk module?

    Try mounting it to system through magisk and preferences will stop working
    2
    2. When going to systemUI and framework, it's sometimes very difficult and complicated to change some variable values through Xposed, specially with R8 code optimizations which dramatically limit the points we can hook into code.
    For R8 code optimizations, we introduced a new API to parse dex file, which allows modules to find methods/fields more accurately.

    Anyway if we finally decide to keep resources hook API, do you have any suggestions on keeping/adding/removing specific methods of it or refine it to a more modern interface?