Device permissions

As we have seen in previous chapters, Android is based on Linux, so it also inherits the part that concerns user permissions. As with a standard Linux system, Android also manages everything through groups and users. In the default configuration, it's not possible to obtain administrator (root) access, in order to prevent tampering with the system. Also, with access to the whole operating system, it's easy to corrupt the system itself, accidentally or deliberately (for example, to steal user data using a virus).

Every Android app, when installed on the system, generates a new user and group, and inter-app communications are performed according to Android SDK constraints and protocols. Sometimes, though, it's useful to have complete control over the device, like, for example, when installing apps that manage CPU frequency and the CPU governor.

Now let's see how to obtain root access and what the implications of rooting the device are.

Root access

Root access enables the users of smartphones, tablets, and other devices with Android OS installed to obtain privileged access, also called root access, to the whole Android operating system. As we have already mentioned, Android uses a Linux kernel, so obtaining root access is very similar to obtaining administrator (superuser) access to a regular Linux or Unix-like OS, such as FreeBSD or Mac OS X.

Often, the reason for obtaining root access is to overcome the limits imposed on the device by the hardware producers. As a root user, you have the ability to modify or replace system apps and change the settings. Also, you can use the apps that require root permissions themselves, enabling you to execute operations that would otherwise be inaccessible to normal Android users. Rooting the device, that is, obtaining root access, can also help if you want to totally remove the device OS and replace it with another, maybe more recent, one.

In the following paragraphs, we will see how to obtain root access, which is the key precondition for installing the custom ROM.

SuperSu

To use root permissions in Android apps, an independent developer known as Chainfir Jorrit Jongma has developed a library that enables you to use them from your app and therefore execute root-level operations. Everything is open source and you can explore the documentation regarding the API at the official website of the developer: https://su.chainfire.eu.

If you would like to check out the library source code, you can find it (and contribute) here: https://github.com/Chainfire/libsuperuser.

Obtaining root access

Now it's time to see how to obtain root permissions on our device in practice. Unfortunately, it's not that simple, and there are various ways to obtain root permissions on a device. Every device has its quirks, and hence a different procedure to execute in order to obtain root permissions. Generally, we can say that if there's a possibility of installing a recovery mod, then there's also a possibility of installing everything necessary to become root. We just need to copy the right files to the system partition that is mounted as read-only by default, so we can access it either by making an ad hoc system partition using the source files, or—in cases when we don't have the Android source code—by mounting the partition in read/write mode through one of the custom recovery mods we described previously.

Up till now, we haven't talked about the legal issues regarding modifying the software present on the device. In general, it is not illegal to install custom ROMs onto our devices, except that there's the possibility of invalidating the device warranty. As far as the Nexus devices are concerned, there's no problem whatsoever; they are being sold for the purposes of software development, so the product warranty isn't tied to the software but to the hardware instead.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.52.7