====== Android ======

Android is one of the main operating systems (OS) you will find on a smartphone today. Creator Andy Rubin and now developed by Google to compete directly with iOS, the operating system found on iPhones. One of the main reasons why Android was so successful was because it could run on many devices thanks to the Open Handset Alliance (OHA), an initiative that would allow manufacturers such as Samsung and LG to develop smartphones that may look and feel different, but still at the same time run the same operating system (with modifications made by the manufacturer).

Google may have prevented a monopoly that may have otherwise existed should Android have never existed, however it isn't all without some catch. Google is notorious for collecting large amounts of private user data, whether you're on a desktop, laptop, or smartphone. On all (Google certified) smartphones, there must be a Play Store and some Google apps (varies between devices). These apps, while useful for a large majority of users, can extract extensive amounts of information based on the user's search history and etc. However, there are solutions to prevent this and hence re-iterates the need of a guide such as this one.

++++ Read more - for more information about Android | 

===== Bootloader =====

On some devices, it is necessary to open or unlock the bootloader before you can install a custom recovery, root or custom ROM. Unlocking the bootloader usually requires the phone to be wiped of all data, meaning that you'll have to backup everything. Not all smartphone manufacturers allow the unlocking of the bootloader, so if this concerns you, you must do your research before purchasing your next smartphone. Although uncommon, some manufacturers package an “eFuse - [[https://en.wikipedia.org/wiki/EFUSE|Wikipedia]]” command in their products, which could brick (permanently damage) your device.


===== Recovery =====

A recovery is an independent, lightweight runtime environment that is included on a separate partition from the main Android operating system on all Android devices. As the name suggests, the main purpose of a recovery is to help recover your device to a working state, however it is possible to make your device soft-bricked (unable to boot) if the wrong actions are performed. You can boot directly into recovery mode and use it to factory reset your device, delete the cache partition, or apply software updates.

==== TWRP - Team Win Recovery Project ====

Over the years, TWRP is the most used custom recovery. A custom recovery is necessary to flash a custom ROM and hence TWRP is a suitable solution if your device supports it.
TWRP supports touch interactions, encrypted storage, MTP (mass storage), and many more features to satistfy the needs of a power user.

More info about TWRP - https://twrp.me/about/


===== Custom ROMs =====

==== Why bother installing a custom ROM? ====

We are all familiar with the time where your phone decides to play up and refuses to do what you want it to do. Anecdotal evidence has found that all smartphones degrade over time due to heat, stress, wear and etc. However this doesn't mean you can't still make improvements on your phone.

One common cause of slowdowns on your smartphone is the presence of bloatware or "bloat". These apps are unneeded and unwanted, meaning that they take up your important storage space and memory. A custom ROM however never contains any bloatware. This will mean that you will be able to reclaim any of the lost storage space and memory and use it for more important applications. This will translate to better performance (and sometimes battery life).

==== Custom ROM options ====

[[https://lineageos.org/|LineageOS]] isn't the only custom ROM available. There are heaps of other ROMs you can choose from (Resurrection Remix, CR Droid, Paranoid Android, etc.), each coming with their own unique combination of features and apps. To get started, it is best to consult on a thread over at the XDA-developers forums ([[https://en.wikipedia.org/wiki/XDA_Developers|Wikipedia]]). XDA is the first address of all your Android needs.

Like other desktop-operating systems (Arch, Debian, Mint, Ubuntu etc.) you have to find out for yourself which ROM suits you best.


===== Root =====

Root is required if you want to have full control of your device. It's necessary for certain apps like AFWall+, XPrivacyLUA etc.  
AFWall+, for example, is using the iptables firewall ([[https://en.wikipedia.org/wiki/Iptables|Wikipedia]]) which you can only be modified if your device is rooted. It's like the administrator of a software.

You have to be very careful to use the right root applications. Check the maintainer, date (how long is it available) and if it is open source! A root app also has full control over your device! You must remember this whenever you install a root app.

Rooting your phone typically voids your warranty, however this can be reversible depending on a case-by-case basis. We have never had a problem, but that does not change the fact that some manufacturers may not outright accept your phone for repair should it ever be necessary!

Over-the-air (OTA) updates are not possible with root. This means that your device will no longer receive updates from your smartphone manufacturer. This brings us to the use of custom ROMs. LineageOS can support your device (security updates, etc.) even if your device is not longer supported by your smartphone manufacturer! All new security patches straight from Google ([[https://source.android.com/security/bulletin|Android Security Bulletin]]) are included in all official builds of LineageOS.

Applications such as bank apps may stop working when they detect a rooted phone. You can still use your web browser or a laptop/desktop PC, however there are solutions such as Magisk hide that can hide root for specific apps.

But root is not necessary!
You could go with a custom ROM but there is no need to use root. For privacy reasons, it is easier to use root, but there are some options without root.

++++

===== Supported phones for custom ROMs =====

If you want to buy a phone or already own an Android phone, you can check if your phone is supported at the following links by searching for phone brand like Samsung Galaxy Note 4 and your model name like N910F. 

  * https://wiki.lineageos.org/devices/
  * https://lineageoslog.com/statistics
  * https://stats.lineageos.org/

If LineageOS supports your phone, you can proceed with the next step - [[#adb_fastboot_drivers|ADB & fastboot drivers]].

===== Check your bootloader =====

Check if your phone has the ability to unlock your bootloader at all.

[[https://forum.xda-developers.com/|xda-developers.com]] offers a wide range of phones that will help you find a guide to open the bootloader, if possible. Check also [[https://www.xda-developers.com/tag/bootloader/|XDA bootloader news]].

Straight to your manufacturer:

  * [[https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-b|motorola.com]]
  * [[https://www.htcdev.com/bootloader|htcdev.com]]
  * [[https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/how-to-unlock-bootloader/#bootloader_guide|sony.com]]
  * [[https://developer.lge.com/resource/mobile/RetrieveBootloader.dev|lge.com]]
  * [[https://account.xiaomi.com/pass/serviceLogin?callback=http%3A%2F%2Fwww.miui.com%2Fextra.php%3Fmod%3Dxiaomi%2Fauthcallback%26followup%3Dhttp%253A%252F%252Fwww.miui.com%252Funlock%252Fapply.php%26sign%3DYzdhOGVjM2ExNDg0YWJlMGUyYTk4NTUwZDY4OGIyZmI5ZmFmZjEzMw%2C%2C&amp;sid=miuibbs&amp;_locale=en|xiaomi.com]]
  * *

<alert type="info" icon="fa fa-info-circle">Huawei and Honor have discontinued the support to unlock the bootloader. There are paid options which we will not post here. It is better to get another phone.</alert>

===== ADB & fastboot drivers =====

Depends on your operating system (Linux, Windows, Mac) you have to download the driver for ADB & Fastboot.

Just follow the instructions at https://wiki.lineageos.org/adb_fastboot_guide or go to [[https://searx.techsaviours.org/|searx.techsaviours.org]] (or whatever you prefer) and search for ''adb drivers windows linux and mac'' and follow the instructions there.

Arch Linux:
<code>
pacman -S android-tools android-udev
</code>


===== USB debugging =====

Go to your **Settings** and click **About phone**. Press the **Build number** seven times. Go **back to** the main **Settings** view and click **System** and **Developer Options** (maybe Advanced first). Turn on **Android/USB debugging**.

==== Xiaomi ====

Go to your **Settings** and click **About phone**, **All specs** and press the **MIUI version** seven times. Go **back to** the main **Settings** view and click **Additional settings** and **Developer options**. Turn on **USB debugging**.


===== Install ROM and recovery =====

Check the ROMs for your device at https://wiki.lineageos.org/devices/ and follow the instructions. Also install Lineageos Recovery (recommended). 

Check your device at [[https://twrp.me/Devices/]] if you prefer TWRP.

<alert type="info" icon="fa fa-info-circle">Check the ''Basic requirements'' for your particular device.</alert>

<alert type="info">Congratulation 🍻 The custom ROM part is done! Continue with [[en:phone:apps:f-droid|F-Droid]], your open source app store or start with [[en:backup:phone#android|your backups]] first.</alert>