[Need Help] Hook and override system method - Xposed Framework Development

Hello! i'm only today start read documentation by Xposed modules. And i have question.
For example in class android.os.UserManager has method getMaxSupportedUsers that return int.
Can i with xposed module hook calling of this method and override return value ? For simple, I want that method always returns 6.
Or is it impossible with Xposed?
P.s. sorry for my bad english

Yes, its possible.

PBombNZ said:
Yes, its possible.
Click to expand...
Click to collapse
Can you show the link where I can read about it or some small sample?

Firstly I recommend going to https://github.com/rovo89/XposedBridge/wiki . its made by rovo89 himself. Enough to help you get started and understand how xposed works. You could also look up some other developer's xposed module source code on github. It will help you understand how the to hook methods and stuff by looking at other people's code.
This guy's code is pretty basic but could be useful to understand how it works. https://github.com/veeti/DisableFla...isableflagsecure/DisableFlagSecureModule.java. This guy hooks the setFlag and setSecure methods of the Window class and SurfaceView class respectively and overrides the outcome. this will probably be system wide though, but you can change it so it only is enabled for certain applications. Also look at his "AndroidManifest.xml" and "assets/xposed_init" files. The Android Manifest contains xposed information and the the xposed_init file contains the full class name of the class which contains all the hooks (which tells xposed where to find your hook methods).
Hope that helps.

Related

How to relocate & replace modules?

Hello,
Today if I'm wish to replace a file (stored as a module) in WM5/WM6, I end up deleting the module and replacing it by a file (stored as a file).
How do you create a module from a file?
How do you relocate a module (for instance if you import a module from another ROM and you don't want to turn it into a file)?
Regards,
--eluth.
So what? Does nobody know how to do that?
Is there no one capable of pointing me in the right direction?
--eluth.
eluth said:
Today if I'm wish to replace a file (stored as a module) in WM5/WM6, I end up deleting the module and replacing it by a file (stored as a file).
How do you create a module from a file?
How do you relocate a module (for instance if you import a module from another ROM and you don't want to turn it into a file)?
Click to expand...
Click to collapse
The "simple" answer is that you can not relocate a module - i.e. into a different memory map location. It was compiled for a specific space in memory, and there it must stay. There are no tools available for this. While something could potentially be written to do this task, the complexity involved would be quite high, and probably not worth the risk/reward/time.
Deleting the module - thereby freeing up the space, and having that space 'reclaimed' by a relocatable file is the only way you can modify/merge the ROMs. Use mamaich's tool to convert the module to a file. There is "no" other way.
Now, having said that, I have (previously) relocated a number of modules in the ROMs I made (TuMa series), however these relocations were MANUALLY done with a HEX EDITOR, and only on very small modules. i.e. I analysed the module, and changed everything necessary (byte-by-byte) to relocate the module. This is a very time-consuming manual process, and not recommended unless ... well ... ok, it's just not recommended period. Let's just say I won't be doing that again unless I really need to.
Tuatara. Many, many thanks for that answer.
This question was here several times, but always without any answer.
Thanks
You're very welcome ...
I forgot to mention that what I meant by "unless I really need to", was during the time BEFORE mamaich made his recmod tool. That tool actually came about because there were so many problems trying to relocate modules and/or find file-based versions of the required DLL's in order to build up a complete ROM. In TuMa v1.1 onwards there were always a number of modules which "previously didn't exist" in any ROM that came before. The things we do!
Anyways ... some day ... when I have some time again (real life has just been very consuming!), I'll be looking into the last few issues with the BA and see what I can resolve. The ROMs which have been made now are fantastic ... kudos to you all!
Tua! Your back How's things going?
Midget_1990 said:
Tua! Your back How's things going?
Click to expand...
Click to collapse
Well ... I actually never left ... I've just been 'lurking'.
Things have been good and things have been busy and things have been very trying. Kind of the 'same old - same old' story of everyone else who has real life take over, and doesn't have any time left to do the things they would like to do. Otherwise though, everything (and everyone) has been great!
I have watched with great interest all of Bepe's ROM Kitchen work, and the ROMs released from Helmi, xplode, baniaczek, yourself and others. With only a few things now causing problems, I think a solid WM5 ROM for the BA is quite possible to achieve ... but some of the last bugs do "bug" me ... so they'll NEED to be fixed. I want to keep using my BA ... nothing else beats it ... yet. (Well, ok VGA screen rocks, but ...)
I'm probably going to look into WM6 for BA at some point myself - just to see if there is anything which can be done. I don't hold much hope, but I'm not sure until I try ... it could just end up being a 'Frankenstein monster' of a ROM instead.
Anywho ... I might be a bit less 'lurker' and a bit more 'around' in the next while. Gotta have some hobbies ... right?
Thanks Tuatara,
This helps and explain why I couldn't find more details.
Best regards,
--eluth.

Modular, GUI, Easily Updatable Kitchen

Hey, I was wondering, is there anyone else who would like to see a GUI Kitchen with support for multiple devices as modules( compatibility packs if you want to call 'em that ), and that would fetch packages from a central repository?
It would allow you to create a new project, choose from several target devices, if it's not on the list it would fetch a list from the server allowing you to download the module, some modules could have a 'supported devices list' on its description files.
The packages would work the same way, fetch the list, download package.
Auto-update for everything including the kitchen itself.
IMHO it's a great idea, there's currently lots of file duplication/scattering, it would also be great because chefs would only need to create packages, base roms, developers would create the device modules, I mean, it's simpler.
Users would have the choice of picking a base rom, selecting the packages from the menu and create their own rom configurations, thousands and thousands of them, no more complaining about softwareXXX being or not included on the final rom and creating a rom with updated software would be as simple as "Update>Packages" "Project>Rebuild".
Even if the final product has a price( :X ) I think it is worth it.
You bet I would.
we're the only ones though
ME 2
Apoc said:
we're the only ones though
Click to expand...
Click to collapse
Dnt Forget me...i am trying using command type..but iwished of GUI
although its aawailable by Xpload for BA only..i want for Himalaya
This is a nice ROM tool but if there were only more detailed instructions...
This is a nice ROM tool but if there were only more detailed instructions...
http://forum.xda-developers.com/showthread.php?t=324682
cash365 said:
This is a nice ROM tool but if there were only more detailed instructions...
http://forum.xda-developers.com/showthread.php?t=324682
Click to expand...
Click to collapse
Yeah, that's a nice set of tools and batch files.
There's also a multi-device version here: http://forum.xda-developers.com/showthread.php?t=324680
It isn't hard to use, and it's quite complete in terms of functionality, plus, the method he used to make it multi-device is nice, you only need to change one line and it's done, all the parameters for a specific device are on a separate conditional batch file.(tho I tested it and it didn't work, previous CORE kitchens worked nice)
But the ideal would be something like this: http://forum.xda-developers.com/showthread.php?t=304461
To be available to public and have all the functionality of the CORE kitchens.
btw, I don't think this is a noob vs pro issue, the kitchen I try to describe in the 1st post would centralize all packages, and IMHO is something the whole xda-devs needs.
up up and away
Apoc said:
Yeah, that's a nice set of tools and batch files.
There's also a multi-device version here: http://forum.xda-developers.com/showthread.php?t=324680
It isn't hard to use, and it's quite complete in terms of functionality, plus, the method he used to make it multi-device is nice, you only need to change one line and it's done, all the parameters for a specific device are on a separate conditional batch file.(tho I tested it and it didn't work, previous CORE kitchens worked nice)
But the ideal would be something like this: http://forum.xda-developers.com/showthread.php?t=304461
To be available to public and have all the functionality of the CORE kitchens.
btw, I don't think this is a noob vs pro issue, the kitchen I try to describe in the 1st post would centralize all packages, and IMHO is something the whole xda-devs needs.
Click to expand...
Click to collapse
It may be multidevice but it doesn't cover the hx4700.
Is there a kitchen for the trusty ipaq?

Why do ROM developers put BusyBox in their ROMs?

Why?
It is needed to have root on your device. Google it, to get more details
Sent from my HTC One X using xda premium
I myself dont know and it would be nice to have an explanation here as most of us are new to this rooting and bricking jargon simple explanations of these things will help "COMMUNITY" members hence why we have a section
HTC one X Q&A
It very easy to tell someone Google it
as Einstein said: "If you cannot explain it simply then you don't understand it well enough"
check this video out I found it, however I cannot view it due to Admins blocking Youtube http://www.google.co.za/url?sa=t&rc..._92TCg&usg=AFQjCNGRf354aisVBQXiO8jVypBAj91PLg
Edit:
Not my intention to be Rude but this is a Q&A and we need to be helpful as a Community not make people not want to ask questions
BusyBox is a package containing a whole range of "program commands" and/or "scripts" (tools). It is with these extra tools, specific tasks can be performed.
Once a custom ROM has BusyBox installed, it means that scripts on the ROM and apps in the ROM can use make use of the tools to perform their tasks.
For example "dd" is a known linux command/tool for block-by-block copying and dumping. However "dd" does not exist until BusyBox is installed. Other popular tools are "uname" to get the kernels name/details, and "ls" is to list the contents of a directory/folder (similar to "dir" in DOS). There are about 50 or more of these commands packaged inside "BusyBox". Whenever there are new versions of BusyBox installed (as you may see in the changelogs for some custom ROM's), this is simply because BusyBox has included either new versions of some of its tools, or perhaps added additional tools to the package.
Hope that helps answer your question. However to be honest, I found all that out by SEARCHing this forum.
- WizzKidd
wizzkidd said:
BusyBox is a package containing a whole range of "program commands" and/or "scripts" (tools). It is with these extra tools, specific tasks can be performed.
Once a custom ROM has BusyBox installed, it means that scripts on the ROM and apps in the ROM can use make use of the tools to perform their tasks.
For example "dd" is a known linux command/tool for block-by-block copying and dumping. However "dd" does not exist until BusyBox is installed. Other popular tools are "uname" to get the kernels name/details, and "ls" is to list the contents of a directory/folder (similar to "dir" in DOS). There are about 50 or more of these commands packaged inside "BusyBox". Whenever there are new versions of BusyBox installed (as you may see in the changelogs for some custom ROM's), this is simply because BusyBox has included either new versions of some of its tools, or perhaps added additional tools to the package.
Hope that helps answer your question. However to be honest, I found all that out by SEARCHing this forum.
- WizzKidd
Click to expand...
Click to collapse
^^ hit the nail on the head. That's not to say that busybox is the ONLY way to get those tools. It's just the slimmest. There are more robust gnu equivalents of the tools that it includes, but they're nowhere near its tiny footprint.
Busybox is a pretty neat application though, since all of the tools that it provides are housed in one binary (busybox). The other commands operate with symlinks named appropriately for their function (su, etc.). The binary detects the name of the symlink that invoked it and behaves appropriately. It's commonly used in environments where not much space is available (recovery environments, embedded systems, etc.)
--Matt
jinkira said:
I myself dont know and it would be nice to have an explanation here as most of us are new to this rooting and bricking jargon simple explanations of these things will help "COMMUNITY" members hence why we have a section
HTC one X Q&A
It very easy to tell someone Google it
as Einstein said: "If you cannot explain it simply then you don't understand it well enough"
check this video out I found it, however I cannot view it due to Admins blocking Youtube http://www.google.co.za/url?sa=t&rc..._92TCg&usg=AFQjCNGRf354aisVBQXiO8jVypBAj91PLg
Edit:
Not my intention to be Rude but this is a Q&A and we need to be helpful as a Community not make people not want to ask questions
Click to expand...
Click to collapse
The main reason people here get told to Google a problem is because more likely than not, the answer you'll get from the search engine will be a page from XDA...
There's also a search box within XDA too, I found these pages using it, they would have answered the OPs question, there wasn't really a need for this thread.
Not trying to be rude but the search is there for a reason and these questions have been asked hundreds of times before
http://busybox.net/FAQ.html#whatis
thank you all for the feedback it is much appreciated
oh and I did do a search but only on the HOX forum not the entire site, and Searching only th HOXX forum there were fragmented pieces of info, but anyways Thanks you guys

[Q] Help! Please!

Sorry in advance if there's a tutorial already out, but i can't seem to find it. I want to begin by modding themes. I have d/l and installed apk manager, sdk tools, java, eclipse and have, as far as i know, associated everything properly. My prog exp is little: some visual basic and turbo pascal in college, along with a flirting fascination with assembly. My thought was i would begin by modding code instead of learning java outright, but if i have to learn c or java that is just fine. where? Anyway, every time i run script.bat in apk manager, i receive an error. Put .apk in mod folder, run script.bat, start project (the .apk is (1)) 1, decompile...error! what am i doing wrong? If anything, just point me in the direction of a good tutorial.
mgofpickens said:
Sorry in advance if there's a tutorial already out, but i can't seem to find it. I want to begin by modding themes. I have d/l and installed apk manager, sdk tools, java, eclipse and have, as far as i know, associated everything properly. My prog exp is little: some visual basic and turbo pascal in college, along with a flirting fascination with assembly. My thought was i would begin by modding code instead of learning java outright, but if i have to learn c or java that is just fine. where? Anyway, every time i run script.bat in apk manager, i receive an error. Put .apk in mod folder, run script.bat, start project (the .apk is (1)) 1, decompile...error! what am i doing wrong? If anything, just point me in the direction of a good tutorial.
Click to expand...
Click to collapse
I'm not sure if what you're looking for would be there, but have you checked the General Android Development forum? http://forum.xda-developers.com/forumdisplay.php?f=613
I'm sure you would be able to get more detailed help there, since you are talking about non device specific development. Good luck!
lordcheeto03 said:
I'm not sure if what you're looking for would be there, but have you checked the General Android Development forum? http://forum.xda-developers.com/forumdisplay.php?f=613
I'm sure you would be able to get more detailed help there, since you are talking about non device specific development. Good luck!
Click to expand...
Click to collapse
Thank you! I've seen some, but not all. I have a nitro, so dev would be geared towards that. further along i was/would ask how you get the emulator to approximate the lg nitro, but for now i thought i'd stick with just requesting a solid tut.
mgofpickens said:
Thank you! I've seen some, but not all. I have a nitro, so dev would be geared towards that. further along i was/would ask how you get the emulator to approximate the lg nitro, but for now i thought i'd stick with just requesting a solid tut.
Click to expand...
Click to collapse
Never messed with it, to be honest... I've got so many things I want to do but can't seem to find a good starting point for any of it. Pretty sure I've downloaded eclipse, JDK, and the android SDK in both windows and linux environments but that's about as far as I've gone... I may have installed them, not 100% sure. I get side-tracked too easily. :cyclops:

Hooking to native functions without JNI (Xposed API)

Good day. I have a such question. Can I hook to native functions without JNI bridge with the help of Xposed framework API? I mean to the code written in C/C++.
Another question is that am I able to hook to Unity functions if I know unity class name and unity method name? For instance I've dumped the meta-data file .
Thank you in advance.
Yes.
You just need to developer your own bridge.
Good luck

Categories

Resources