LightBlog

dimanche 24 avril 2022

What is Riru, and what can you do with it on your Android device?

Before Magisk became a thing, it was Xposed Framework that vastly shaped the device-agnostic Android modding approach. Rather than having to decompile applications, modify bits and pieces, recompile, and push the modded files back to our devices, we can replace any method in any class at runtime using Xposed and a purpose-built module. The framework is essentially a modification of /system/bin/app_process to load additional JAR files on startup, which allows developers to hook into the Zygote process and can act in its context.

Since Magisk offers an overlay-based modding mechanism (often referred to as “systemless”), one can theoretically create a Magisk module to tinker with the Zygote process without physically modifying the app_process executable. This is where Riru comes in.

What is Riru?

Created by two developers named Rikka and yujincheng08, Riru is a specially crafted Magisk module that offers Xposed-esque functionalities without the need of installing the old school Xposed Framework. It injects into Zygote in order to allow other modules to run their codes in apps or the system server.

How does Riru work?

The initial implementation of Riru relied on the replacement of a particular system library called libmemtrack. However, the method was later abandoned in favor of a system property known as the “native bridge” (ro.dalvik.vm.native.bridge). By exploiting the property, the developers can dynamically load and unload shared libraries of their choice, which ultimately leads to injecting into the Zygote process.

How to download and install Riru?

As mentioned earlier, Riru is available as a Magisk module. Due to the fact that the Magisk app no longer comes with a built-in module browser, you need to download Riru straight from its GitHub repository.

Download Riru

After downloading the release ZIP file, you can install it using the Magisk app.

  1. If you’re downloading on a PC or a Mac, then connect your Android device to it and copy the downloaded ZIP file to the internal memory of the target device.
  2. Open the Magisk app on your phone and switch to the Modules tab using the bottom navigation menu.
  3. Tap on the button named Install from storage.
  4. Browse and select the module ZIP you downloaded earlier.
  5. Magisk will now install the module and prompt you to restart.
Riru ZIP in internal storage Riru installation

If everything goes right, you can see Riru listed under the Modules tab of the Magisk app after rebooting.

What can I do with Riru?

Riru itself is just a doorway for other modules to hook into the Zygote process. As such, you need to install Riru-compatible modules via the Magisk app, just like any other Magisk modules. After a successful installation, Riru modules will be listed alongside Magisk modules in the Magisk app. You can then open the module-specific configuration front-end to modify its parameters. For the modules that have no interface, you can simply continue using your modded Android instance and Riru will take care of everything in the background.

Riru with another module

What is the difference between Riru and Zygisk?

On newer versions of Magisk, you may face a situation where Riru is disabled after installation due to the presence of Zygisk.

Riru suspended for Zygisk

The reason behind this conflict is rather simple, though. Zygisk (e.g. Magisk in Zygote) is the spiritual successor to Riru. It’s the evolution of the systemless interface that XDA Senior Recognized Developer topjohnwu (i.e. the creator of Magisk) and several other developers have been working on for a while. As both Riru and Zygisk target the Android Zygote process, these two can’t exist simultaneously. However, you can disable Zygisk from Magisk’s setting, reboot the device, and then enable Riru.

As a matter of fact, the maintainers of Riru practically stopped developing the project a while ago. They suggested module developers switch to Zygisk in the future. However, Zygisk is still in a nascent stage and there is a lot of scope for improvement, hence the migration will take time. Meanwhile, you can continue to use Riru and its modules.

The post What is Riru, and what can you do with it on your Android device? appeared first on xda-developers.



from xda-developers https://ift.tt/ky7SuiV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire