-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use C code instead of commands #843
Comments
What good would it do? Plus, there's no super su library for C. |
Instead of parsing commands we'd call functions, it isn't that important, but could be done for more deterministic results (what a command prints is intended to be read by a human, therefore there might exist cases where a command would return something unexpected, causing difficult to trace crashes). |
This is definitely doable. I have created an extremely primitive file manager, that uses JNI + IPC to native daemon, and it was working well under my limited testing. There are two caveats:
A bit of knowledge of SELinux and Android security architecture might be necessary (not much). |
Crossplataform? You mean that different architectures would need different functions or that different API versions will need different functions? How so? |
@EmmanuelMess API functions are the same everywhere. But each CPU architecture (x86/x64/arm/arm64/mips/mips64) needs separate You have a choice: either put a version of each library (x86 .so + arm .so + ...) in the same apk (very bad idea, huge apk size) or distribute multiple apk files: one for arm, another for x86... mips is irrelevant, but serving third apk won't hurt much when you already serve two. The "fat" apk vs split apks setup is covered well in official Android docs.
A bit more, depending on your goal. You will most certainly need a C/C++ file (example: https://github.com/chdir/fdutil/blob/master/fdlib/src/main/cpp/native-lib.cpp#L319). You can write it manually (this is actually simple to do) or use an automated tool to generate it from Java method or C headers (the quality of generated code will be meh). New versions of Gradle/IntelliJ can compile native code automatically with single Gradle block, so there is no longer a need for complicated Gradle setup. |
Related #513 |
This has already started being implemented to fix issues with parsing |
The idea would be to make the methods in RootUtils native and work them from C.
The text was updated successfully, but these errors were encountered: