What is android and why is it needed. What is the Android platform and what is it for? The android operating system is based on

  • 26.12.2021

Articles and Lifehacks

Today it is already difficult to find such a person who would not like to surround himself with "smart" technology. The phrase “without a phone is like without hands” sounds more and more often, and it’s impossible to imagine life without a player, laptop or other popular gadget.

Therefore, everyone should know about the new products that appear on the market of modern electronics. For example, not everyone knows what an android platform is, but we will try to figure it out.

What is Android

  • Android is an operating system that can control a mobile device (phone, tablet, smartphone). The android platform was developed based on the Linux kernel.
  • It appeared due to the fact that in 2005 Google bought Android Inc, making it its subsidiary, and began releasing platforms of the same name for mobile devices. Since then, the platform has only evolved.
  • Android very often releases new versions of its program. It is noteworthy that the first letters of the name of each new version correspond to the letters of the Latin alphabet.
  • Today, the android platform ranks second in popularity in the world, second only to the iOS operating system, which was developed for the iPhone.

What is Android for?

  • As you know, the operating system is the "brain" of any electronic device, which is needed in order for it to carry out all the commands of a person.
  • Accordingly, an android is a virtual robot sitting inside a mobile device, which is responsible for performing all the processes that take place inside this device.
  • The advantage of this platform is that Android has a convenient and very intuitive interface, as well as a flexible and multitasking system that allows you to run multiple applications at once and experiment with settings.
  • Among other things, numerous applications created specifically for the Android platform give the happy users of this system truly endless possibilities.
  • After all, with the help of these applications you can pay for purchases, take photos, watch movies or read books.
  • Having figured out what an android is, we can conclude that this platform was created for creative people, because two identical mobile devices can look completely different.
  • Android allows you to always have everything with you - a personal fitness trainer, a doctor, a toy or a TV, making human life as comfortable as possible.

Mobile devices on the Android platform are quite popular in the telephony market. Android OS is ideal for phones and tablets. Thanks to the large amount of memory and high technical characteristics, working with this operating system becomes much easier.

OS "Android": description

Experts believe that the popularity of the Android system is increasing due to the constant release of various types of devices on this platform, which have a large number of useful functions in their arsenal. As soon as the new burst into the technology market, users have new opportunities.

In addition to the existing technology, in the future it is planned to release Android-based TVs, which will undoubtedly become an integral part of modern life. Now, new applications are being actively developed that will help synchronize work between a mobile phone on the Android platform and car devices, such as GPS-navigators. At the same time, each firmware update of the system expands the functionality of the device, fully adjusting it to the user.

How to synchronize the system with Google?

The Android system opens up a sea of ​​possibilities: the use of Google Maps, e-mail, etc. To use all the services through one Android device, it is enough to synchronize the system with Google. To do this, you just need to enter your data (login and password), after which the OS will automatically connect to all applications.

In addition to standard applications, not so long ago completely new developments were released. So, for example, users of communicators program Google Voice will allow you to exchange information without much effort. After synchronizing the device with Google, users will also be able to work with the Play Market application, with which you can install a lot of various games and programs (both paid and free) on your phone or tablet.

Android Secrets for Beginners

To make working with the device on this platform even easier, advanced users have found several useful features. The secrets of "Android" will help to optimize the system to the maximum and customize it for yourself.

The first rather useful feature is speed dialing. Everyone knows that the Android system has several desktops that host shortcuts to various applications. So, to simplify the set of contacts, just click on the free space of the screen, select the "Shortcut" and "Contacts" menus, and then mark the most popular number and place it on the desktop. Now the dialing of this contact will be carried out with one click on the shortcut.

Few people know that there are special characters on the Android keyboard. To open them, you only need to long press on a period or comma. The set of numbers opens in the same way.

There are situations when typing large text manually is quite inconvenient. For this, there is such a function as voice search. Not all novice users know the secrets of "Android", and it's not so easy to spot a small microphone-shaped icon on the Google search bar. Therefore, few people use such a useful feature. But you just need to click on this icon and say a question, which immediately becomes text.

If, after accidentally pressing the wrong button, the open application disappeared somewhere, then, most likely, it simply collapsed. To return the minimized application to the screen, just hold down the button with the image of a small house and select the one you need from the list.

And these are just a few tips. In fact, there are many more hidden possibilities. Small secrets of "Android" will help to improve the operation of the operating system and customize it as much as possible for the user.

How can I find out more about the installed system?

Often, users need to find out detailed information about a mobile device. For example, Android OS version, processor type, and more. Such data is sometimes required in order to install an application or program. In fact, there is nothing difficult in this.

Option 1. You can find out some system data using the standard settings. It is enough to open the settings menu, then you need to select the "About phone" item. On some devices, this will open a list of system information. If not all information appears on the screen, you need to click on the “Software version” item. Here you can find basic information about the operating system of the device.

Option 2. This method is suitable for those who need extended data about the OS. To get this information, you need to download a special program from the Play Market, and then open it. All system information will appear on the screen.

Flashing "Android" system

Many users are interested in how to install an operating system with a newer version on their mobile device. However, before setting up the OS, you should think about whether it is possible to reflash Android yourself. But this question is very controversial.

First of all, you should pay attention to the device. Not all mobile gadgets can be flashed. Moreover, on Chinese devices, this action is not provided at all. Independent intervention in the operating system will only disable the device. So, thinking about how to install the operating system, you should, first of all, decide what is more important in this situation - a newer version or a normally working gadget.

The best programs to synchronize your device with a PC

Sometimes it is necessary that the management of a mobile device be possible from a computer. To do this, there are special programs that will help users synchronize Android with a PC.

Android PC Suite makes it possible to make calls and send messages through your computer. In addition, with this application, you can backup all the data on the device.

Tasks, notes and calendar, and also installs drivers for a mobile gadget.

My Phone Explorer manages files, phone book and other information through your computer, and also allows you to find out detailed information about your Android device.


Android- This is one of the most popular and most promising operating systems for various mobile devices. The system offers a very convenient toolkit and maximum flexibility of settings, which allows each user of a smartphone or tablet on Android to customize it completely to their needs. The development of this operating system started back in 2003, but it became truly famous only 2 years later - after it was acquired by Google. The turning point in the history of Android occurred in the fall of 2008. Then Google showed T-Mobile G1, which became the first smartphone running Android. It was at that moment that many global manufacturers paid attention to a promising operating system.

(very first version)

The main features of the Android operating system

The OS in question has always been positioned by its developers as an open source system. This allows anyone to create their own applications, games and other add-ons to expand the capabilities of Android gadgets. The developers initially thought of everything so that the operating system worked as quickly as possible even on the most “budget” hardware. This is a definite plus, because. now even people with the most modest financial means can enjoy all the main advantages of modern smartphones.


(Android 5.0)

Mobile electronics manufacturers are also willing to take advantage of the system's openness by releasing their own user interfaces, for example, Sense from HTC. This makes Android gadgets from different manufacturers different from each other. Fans of classic and "pure" Android should turn their attention to Nexus devices. They are traditionally the first to receive updates.

The timing of updating other devices is usually delayed due to the need to refine proprietary shells in accordance with the features of new versions of the OS.

The main source of games and applications is the Play Store. In the catalogs of this store, a huge selection of free and paid content is available, the range of which is actively expanding. The quality of "android" games and applications is constantly growing. From time to time, Google itself releases various applications.

In general, Android devices have all the features that modern smartphones and tablets should have according to unspoken requirements. In addition, the functionality can be easily expanded using applications, widgets or third-party firmware.

Those wishing to purchase an Android smartphone should remember that many functions and programs are focused on working with the Internet. If you do not have access to Wi-Fi, it is recommended to connect a favorable tariff for Internet users or disable some functions that require access to the network.

Also, one cannot fail to note the limited autonomy of Android devices, especially representatives of previous generations. With active use, a smartphone or tablet will have to be charged daily, and in some cases 2 times a day. Manufacturers are actively working to correct this shortcoming, and recently interesting devices with significantly increased autonomy have begun to appear on the market. Developers are not left out. With each new version, the operating system “eats” less and less charge.

Based on the information provided, it is possible to highlight the key advantages and disadvantages of the considered operating system. So, the undoubted advantages of Android are:
1. Openness of the program code, which makes it possible to develop almost any applications and games.
2. Undemanding to the hardware of the device.
3. A huge range of applications and exciting games for every taste.
4. Full compliance with modern ideas about the functionality of a smartphone.
5. Freedom of action for the user. If desired, the system and its interface can be easily customized to the needs of the owner.
6. The popularity of the operating system among the vast majority of modern manufacturers. This allows a user with almost any budget to buy a functional and modern smartphone.

There are also disadvantages. The key ones are:

1. Openness of the program code. Yes, it can be attributed to both advantages and disadvantages at the same time. This is a disadvantage for the reason that mobile device manufacturers for the most part prefer to create their own shells. Because of this, there are significant time delays between the official release of the OS update and its receipt on various devices.
2. Relatively low autonomy. Recently, a huge step forward has been made in this direction, so very soon the jokes that “Smartphones on Android are the most sporty, because. they have 2 exercises a day” will be nothing more than a funny story.

The platform is constantly being improved and developed. Already today, she confidently feels in the top three in the market of operating systems. Numerous experts have repeatedly noted that the future belongs to Android and were not mistaken.

To date, the latest version of Android has serial number 5 and the code name Lollipop. The system received significant updates in design, functionality, in general, it is practically a newly created product. Google Nexus 5 smartphones have already begun to update to this OS version, and soon all modern smartphones will receive the latest update. However, we will tell about the new 5.0 separately, but I still want to start from the time when the Android project did not even belong to Google ...

Android: Beginning

Many believe that the history of Android began in 2008 when the first version of Android 1.0 was released. But in fact, everything started spinning 5 years earlier, in 2003, when Andy Rubin and his comrades (Nick Sears, Chris White and Rich Miner) decided to create a mobile operating system and registered Android Inc. The developers first focused on devices that could be constantly with users, determine the location by GPS and automatically adjust to the needs of the person.

Andy Rubin, creator of Android Source: technobuffalo.com

For investors of that time, it was hardly clear at all. Well, who wants to invest in an incomprehensible startup, which so far does not bring any money ... And so it happened that by 2005 Andy and friends spent all the funds, but by a lucky chance they looked at them from Google and on August 17, 2005 the corporation became full-fledged owner of a small Android Inc. It is worth noting that Google at that time did not have any special plans for gadgets, but was more focused on improving its own software and search algorithms. It's scary to say, but at that time Google did not have any Adsense and even YouTube (it was acquired only in 2007).

Google logo in 2005

In the same year, against the backdrop of legal proceedings between Oracle and Google, it was decided that Android would be a free operating system and, of course, primarily focus on the implementation of Google services. Since Andy Rubin was originally in charge of the GPS project and the corporation already had Maps, it was planned to introduce maps into phones. And then there were no smartphones yet, so cards could appear on a regular clamshell with buttons. The first images also indicate that Google was targeting RIM's experience with their Blackberry, so if it wasn't for a coincidence, touchscreen phones might never have arrived. But, unfortunately or fortunately, in 2007 the iPhone comes out and Google sharply revises the strategy. However, the first build of Android 1.0 is being prepared for release in 2008. However, at the beginning of 2007, Google did not have a partner who would release a phone on the new OS. Nokia is too big a company to have a conflict of interest with, Motorola is not yet out of the Razr sales boom. Google chooses between LG and HTC. Korean LG is interested in the US market, but it is afraid of cooperation with an unknown partner and uses agreements with Google only to conclude contracts with Microsoft to create smartphones with Windows Mobile. But HTC was ready to work together, and besides, the Taiwanese company could quickly create working samples. The first known prototype was the Google Sooner. Here, however, I had to abandon the touch screen, this model is created according to the original specifications, when Google relied on the Blackberry experience.

Possibly the first Android phone prototype - Google Sooner

Sources report that the first working version dates back to 05/15/2007 and was then called M3. The operating system is very similar to the Blackberry interface, the main position is occupied by the Google search bar. In general, if it were not for the advent of the iPhone and the course towards touch screens, perhaps we would now see Android like this.

Screenshot of Android M3, possibly the first working version of the OS Source: 9to5google.com

Android: official start

Google clearly understood that with the release of the Apple iPhone, the presence of a touch screen was simply a necessity, and therefore early development had to be postponed. This was facilitated by communication with operators, in the summer of 2007 their opinion about the future of Android was pessimistic. In August 2007, an article appeared in the WSJ talking about Google's efforts regarding its phone and platform. This material mentions that the company has two prototypes - one looks like a Palm Treo with a QWERTY keyboard under the screen, and the second is somewhat reminiscent of the Nokia version. Inside the Android team, there is a competition with time, since all previous plans are no good and they decided to abandon them. The team changes the timing, and in the second half of 2007 the M3 is produced. In the M5 version, it appears at the beginning of 2008, a status line appears in it, although experiments with the UI are visible to the naked eye. Watch the video to understand the difference between these versions.

It wasn't until August 2008 that Google developed version 0.9 to introduce OS version 1.0 in September 2008. On October 22, 2008, T-Mobile in the US began selling the HTC Dream (T-Mobile G1), the first Android smartphone with a touch screen and OS fully integrated for its use. But Google was able to rework the OS only by version 1.6, getting rid of the old ideas that were originally laid down when it was created. Perhaps, it is from this moment that the take-off of Android begins. Interest in HTC Dream in the US was huge, the operator sold 1 million devices by April 23, 2009. Such a demand for such an ordinary and simple device once again proved that ideas win, in this aspect it was the idea of ​​touch phones that captured the minds of consumers.

Naturally, the very first tests on real users revealed a lot of flaws in the platform, and already in the first year of Android's existence, Google released the following updates: 1.1. Banana Bread, 1.5 Cupcake (introduced video and photo upload to YouTube and Picasa, automatic display orientation, predictive input, etc.), and 1.6 Donut (speech to text with multilingual pronunciation, WVGA support, optimized gestures, etc.) .d.)

Android: second try

Android 2.0

After the improvement of the 1st version, Android received already enhanced functionality and good appearance to version 2.0, and then to 2.1 with the same code name Eclair. It became possible to use multiple Google accounts, and the standard web browser received support for HTML5. At the same time, new models of Android smartphones went on sale: HTC Magic and Hero, Motorola Droid and Samsung Galaxy.

Then, in 2010, the release of mobile processors with a clock frequency of 1 GHz begins. And the first branded smartphone Google Nexus One appears with a 1 GHz processor. Of course, HTC becomes a partner of Google. HTC Desire, Motorola Droid 2 and Samsung Galaxy S received processors with a similar frequency. By the way, HTC will no longer make Google devices until 2014, when the Nexus 9 comes out. In the same 2010, Google released another version of Android, the new 2.2 Froyo , in which the performance of applications using JIT compilation has increased, and support for Adobe Flash has appeared. Well, all the aforementioned smartphones with a 1 GHz processor received an upgrade to Froyo. In addition, the build received updates such as the Chrome V8 JS engine for the web browser, transfer of contacts and support for BlueTooth docking stations, cloud synchronization, etc.

Google Nexus One and Android 2.2 Froyo

By the way, in Russia, many saw Android for the first time in this particular edition, since this year the demand for touchscreen smartphones begins in our country, Android is gradually becoming fashionable. Until 2010, only geeks saw the "green robot", and even then, rather on the Internet or magazines than in their own hands.

Android Gingerbread and Honeycomb

Android was in its third year on the market. It was already a popular OS, but there were still many problems. And now, the 2.3 Gingerbread update appears, which until 2013 was installed on a huge number of devices. Indeed, in this version of the OS, many features were implemented that marked the prospects for the development of the platform as such - support for SIP telephony, Near Field Communication and Google Talk, work with higher resolution screens, a new download manager, and much more.

Together with Gingerbread, Google releases its second branded smartphone, the Nexus S. This time, Samsung becomes the manufacturer, and the Nexus S was, in fact, a slightly modified Galaxy S. However, the Google Nexus S came out clearly too late: the company LG has announced the first dual-core smartphone Optimus 2X. Now manufacturers are measured not by gigahertz, but by multi-core. As a result, not only LG Optimus 2X received dual-core chips, but also Samsung Galaxy S II, HTC Sensation and Motorola Droid X2.

And Samsung, meanwhile, releases another device after the Galaxy S smartphone - the Galaxy Tab tablet. Compact and lightweight seven-inch "tablet" has become a good alternative for those who do not like the bulky Apple iPad. But the trouble is, Android is still only for smartphones. Not a problem, Google thought, and in early 2011, the first version of Android designed specifically for tablet PCs, 3.0 Honeycomb, appears. It looked better on Honeycomb tablets than the stretched Gingerbread smartphone interface. So, on the basis of the Android OS, both smartphones and tablets have already started working. The business began to expand, and rapidly. Almost all Android tablets become Honeycomb carriers - Motorola Xoom, Acer Iconia Tab, Samsung Galaxy Tab 10.1, Lenovo ThinkPad Tablet, etc.

In the same 2011 at the technology exhibition IFA 2011 in Berlin, Samsung introduces its first 5-inch phablet Glaxy Note, which has become a very popular device, despite the opinion of skeptics. Then it was, in fact, the first device of this class, and even on Android. It took Apple another 3 years before that, in 2014 the company released the iPhone 6 Plus phablet.

Android 4: From Ice Cream Sandwich to KitKat

Google understands that having two separate systems for smartphones and tablets is not very profitable. Spend more time on development and support. And in the fall of 2011, Google releases Android 4.0 Ice Cream Sandwich, which becomes the first cross-platform version for smartphones and tablets. The assembly also provides access to applications directly from the lockscreen, and AndroidMarket is renamed Google Play. According to many experts, it was from version 4.0 that Android began to acquire its usual shape and normal functionality. Now the devices on the "green robot" could also be simply used, they ceased to be gadgets for geeks.

Following the new operating system, Google presented a new smartphone - Galaxy Nexus, which, obviously, was also developed in collaboration with Samsung. And again, after the release of the smartphone, component manufacturers begin to fight for hardware. Qualcomm introduces powerful Krait processors, and Nvidia announces 4-core Tegra 3 chips. Well, the undisputed leader of Android smartphones in 2012 is the Samsung Galaxy S III, which joined the budget bestseller ASUS Nexus 7 based on the new Android 4.1 Jelly Bean OS.

In 2012-2013, nothing special happened to Android after global changes with the unification of the tablet and smartphone versions. However, in 2012, Google makes 2 more branded devices - the LG Nexus 4 smartphone and the Samsung Nexus 10 tablet. In parallel with the new products, an updated build of Android 4.2 Jelly Bean was introduced, which supplemented the previous version. Users can now fully experience the benefits of using GoogleNow, Cloud Messaging, Android Beam, triple buffering, multi-channel USB audio, and more. Then the Google Moto X smartphone and the 2nd generation Google Nexus 7 tablet are presented, which were not very popular in our country due to the fact that Motorola left the Russian market back in 2010.

In 2013, the Nexus 5 appears on the market, again, as a result of cooperation with LG. And for it and other devices comes a new version of Android 4.4 KitKat. Yes, this is the first time that the version indicator is the name of a commercial product, but we will not talk about that. The changes affected not only the interface of individual system applications and elements. The promised transparency of the top notification bar has arrived in KitKat, along with a new thinner font and support for a full-screen interface from individual applications. With the release of KitKat, access to the Google Now service has become easier. Now his call is unified - you just need to swipe your finger across the screen from left to right. Previously, the ways to access Google Now varied depending on the smartphone model (pressing the Home button, shaking, etc.). Additionally, the service is activated by the phrase "OK Google" when the start screen is open. The developers and the Hangouts program did not ignore. Now it allows you to send not only chat messages, but also SMS/MMS. Finally, we note the pedometer built into KitKat, which works even in the background, as well as extended compatibility with printers through the Google Print cloud technology. The latter allows you to send documents for printing without any wires, changing the paper size and specifying the required number of pages.

Have you ever wondered how fastboot or ADB work? Or why is it almost impossible to turn an Android smartphone into a brick? Or maybe you have long wanted to know where the magic of the Xposed framework lies and why the /system/etc/init.d boot scripts are needed? What about the recovery console? Is this part of Android or a thing in itself, and why is the usual recovery not suitable for installing third-party firmware? You will find answers to all these and many other questions in this article.

How Android Works

You can learn about the hidden features of software systems by understanding the principle of their work. In some cases, this is difficult to do, since the code of the system can be closed, but in the case of Android, we can study the entire system inside and out. In this article, I will not talk about all the nuances of Android and will focus only on how the OS starts up and what events take place between pressing the power button and the appearance of the desktop.

Along the way, I will explain what we can change in this chain of events and how custom firmware developers use these features to implement things such as tuning OS parameters, expanding application storage space, enabling swap, various customizations, and much more. All this information can be used to create your own firmware and implement various hacks and modifications.

Step one. ABOOT and partition table

It all starts with the primary bootloader. After the power is turned on, the system executes the bootloader code stored in the device's permanent memory. It then transfers control to the aboot bootloader with built-in support for the fastboot protocol, but the manufacturer of the mobile chip or smartphone / tablet has the right to choose any other bootloader of his choice. For example, Rockchip uses its own, non-fastboot-compatible bootloader, which requires the use of proprietary tools to reprogram and manage.

The fastboot protocol, in turn, is a bootloader management system from a PC that allows you to perform actions such as unlocking the bootloader, flashing a new kernel and recovery, installing firmware, and many others. The point of fastboot is to be able to restore the smartphone to its original state in a situation where all other means fail. Fastboot will remain in place even if, as a result of experiments, you erase all sections of NAND memory containing Android and recovery from your smartphone.

Having received control, aboot checks the partition table and transfers control to the kernel flashed into the partition named boot, after which the kernel extracts the RAM image from the same partition into memory and starts loading either Android or the recovery console. NAND memory in Android devices is divided into six conditionally mandatory sections:

  • boot - contains the kernel and RAM disk, usually around 16 MB in size;
  • recovery - recovery console, consists of a kernel, a set of console applications and a settings file, size 16 MB;
  • system - contains Android, in modern devices it has a size of at least 1 GB;
  • cache - designed to store cached data, also used to save the firmware during an OTA update and therefore has a size similar to the size of the system partition;
  • userdata - contains settings, applications and user data, all remaining NAND memory space is allocated to it;
  • misc - contains a flag that determines in which mode the system should boot: Android or recovery.
In addition to them, there may also be other sections, however, the general markup is determined at the design stage of the smartphone and, in the case of aboot, is sewn into the bootloader code. This means that: 1) the partition table cannot be killed, since it can always be restored using the fastboot oem format command; 2) to change the partition table, you will have to unlock and reflash the bootloader with new parameters. There are exceptions to this rule, however. For example, the bootloader of the same Rockchip stores partition information in the first block of NAND memory, so flashing the bootloader is not needed to change it.

Part of the bootloader code that defines the partition table


Particularly interesting is the misc section. There is an assumption that it was originally created to store various settings regardless of the main system, but at the moment it is used for only one purpose: to tell the bootloader which partition to boot the system from - boot or recovery. This feature, in particular, uses the ROM Manager application to automatically reboot the system into recovery with automatic firmware installation. Based on it, the Ubuntu Touch dual boot mechanism is built, which flashes the Ubuntu bootloader into recovery and allows you to control which system to boot next time. Erase the misc partition - Android is loaded, filled with data - recovery is loaded ... that is, Ubuntu Touch.

Step two. boot partition

If the misc section does not have a recovery boot flag, aboot transfers control to the code located in the boot section. It is nothing but the Linux kernel; it is located at the beginning of the section, and immediately after it is a RAM disk image packed using cpio and gzip archivers, containing the directories necessary for Android to work, the init initialization system, and other tools. There is no file system on the boot partition, the kernel and RAM disk just follow each other. The content of the RAM disk is:

  • data - directory for mounting the partition of the same name;
  • dev - device files;
  • proc - procfs is mounted here;
  • res - a set of images for the charger (see below);
  • sbin - a set of auxiliary utilities and daemons (adbd, for example);
  • sys - sysfs is mounted here;
  • system - directory for mounting the system partition;
  • charger - an application for displaying the charging process;
  • build.prop - system settings;
  • init - initialization system;
  • init.rc - settings of the initialization system;
  • ueventd.rc - settings for the uventd daemon included in init.
This is, so to speak, the skeleton of the system: a set of directories for connecting file systems from NAND-memory partitions and an initialization system that will take care of the rest of the work on booting the system. The central element here is the init application and its init.rc config, which I'll cover in more detail later. In the meantime, I want to pay attention to the charger and ueventd.rc files, as well as the sbin, proc and sys directories.

The charger file is a small application whose only job is to display the battery icon. It has nothing to do with Android and is used when the device is connected to the charger in the off state. In this case, Android does not boot, and the system simply boots the kernel, connects the RAM disk, and starts the charger. The latter displays the battery icon, the image of which in all possible states is stored in regular PNG files inside the res directory.

The ueventd.rc file is a config that defines which device files in the sys directory should be created at the system boot stage. On Linux kernel-based systems, hardware is accessed through special files inside the dev directory, and the ueventd daemon, which is part of init, is responsible for creating them in Android. Normally, it works in automatic mode, accepting commands to create files from the kernel, but some files need to be created by yourself. They are listed in ueventd.rc.

The sbin directory in stock Android usually contains nothing but adbd, which is the ADB daemon that is responsible for debugging the system from the PC. It starts at an early stage of OS boot and allows you to identify possible problems at the stage of OS initialization. In custom firmware, you can find a bunch of other files in this directory, such as mke2fs, which may be required if partitions need to be reformatted to ext3/4. Also, modders often put a BusyBox there, with which you can call hundreds of Linux commands.

The proc directory for Linux is standard, in the next boot steps init will connect procfs to it, a virtual file system that provides access to information about all the processes on the system. The system will connect sysfs to the sys directory, which opens access to information about the hardware and its settings. With sysfs, you can, for example, put the device to sleep or change the power-saving algorithm used.

The build.prop file is designed to store low-level Android settings. Later, the system will reset these settings and overwrite them with values ​​from the system/build.prop file, which is not yet available.


OUYA TV Box Root Partition


Step two, alternative. recovery section

In the event that the recovery boot flag in the misc section is set or the user turned on the smartphone while holding down the volume down key, aboot will transfer control to the code located at the beginning of the recovery section. Like the boot partition, it contains the kernel and a RAM disk, which is decompressed into memory and becomes the root of the file system. However, the contents of the RAM disk are somewhat different here.

Unlike the boot partition, which acts as a transitional link between different stages of booting the OS, the recovery partition is completely self-sufficient and contains a miniature operating system that has nothing to do with Android. Recovery has its own core, its own set of applications (commands) and its own interface that allows the user to activate utility functions.

In a standard (stock) recovery, there are usually only three such functions: installing firmware signed with the key of the smartphone manufacturer, wipe and reboot. In modified third-party recovery, such as ClockworkMod and TWRP, there are much more functions. They can format file systems, install firmware signed with any keys (read: custom), mount file systems on other partitions (for OS debugging) and include script support that allows you to automate the firmware process and many other functions.

With the help of scripts, for example, you can make it so that after loading recovery automatically finds the necessary firmware on the memory card, installs them and reboots into Android. This feature is used by the ROM Manager, auto-flasher tools, as well as the automatic update mechanism for CyanogenMod and other firmware.

Custom recovery also supports backup scripts located in the /system/addon.d/ directory. Before flashing, recovery checks for scripts and executes them before flashing. Thanks to such scripts, gapps do not disappear after installing a new firmware version.

Step three. Initialization

So, having received control, the kernel connects the RAM disk and, after the initialization of all its subsystems and drivers, starts the init process, from which Android initialization begins. As I said, init has a configuration file init.rc, from which the process learns what exactly it must do to bring the system up. In modern smartphones, this config has an impressive length of several hundred lines and is also equipped with a trailer of several child configs that are connected to the main one using the import directive. Nevertheless, its format is quite simple and is essentially a set of commands divided into blocks.

Each block defines a loading stage or, in the language of Android developers, an action. Blocks are separated from each other by an on directive followed by an action name, such as on early-init or on post-fs. The block of commands will be executed only if the trigger of the same name fires. As it boots, init will fire the early-init, init, early-fs, fs, post-fs, early-boot, and boot triggers in turn, thus running the appropriate command blocks.


Part of the init.rc config from CyanogenMod


If the configuration file pulls several more configs listed at the beginning (and this is almost always the case), then the command blocks of the same name inside them will be merged with the main config, so that when the trigger fires, init will execute commands from the corresponding blocks of all files. This is done for the convenience of generating configuration files for several devices, when the main config contains commands common to all devices, and specific commands for each device are written to separate files.

The most notable of the additional configs is initrc.devicename.rc, where the device name is determined automatically based on the contents of the ro.hardware system variable. This is a platform-specific configuration file that contains device-specific command blocks. In addition to the commands responsible for tuning the kernel, it also contains something like this:

The code:

Mount_all ./fstab.device_name

It means that init should now mount all the file systems listed in the ./fstab.devicename file, which has the following structure:

The code:

device_name (partition) mount_point file_system fs_options other options

It usually contains instructions for connecting file systems from internal NAND partitions to the /system (OS), /data (application settings) and /cache (cached data) directories. However, by modifying this file slightly, we can force init to boot the system from the memory stick. To do this, it is enough to split the memory card into three 4 sections: 1 GB / ext4, 2 GB / ext4, 1 GB / ext4 and the remaining fat32 space. Next, you need to determine the names of the memory card partitions in the /dev directory (they differ for different devices) and replace the original device names in the fstab file with them.


Typical contents of an fstab file


At the end of the boot block, init will most likely encounter the class_start default command, which will tell you to start all the services listed in the config that are related to the default class. Descriptions of services begin with a service directive followed by the name of the service and the command that must be executed to start it. Unlike the commands listed in blocks, services must run all the time, so throughout the life of the smartphone, init will hang in the background and monitor this.

Modern Android includes dozens of services, but two of them have a special status and determine the entire life cycle of the system.

Step four. Zygote and app_process

At a certain stage of loading, init will encounter a block like this at the end of the config:

The code:

Service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server class default socket zygote stream 660 root system onrestart write /sys/android_power/request_state wake onrestart write /sys/power/state on onrestart restart media onrestart restart netd

This is a description of the Zygote service, a key component of any Android system that is responsible for initialization, starting system services, starting and stopping user applications, and many other tasks. Zygote is launched using a small application /system/bin/app_process, which is very clearly visible in the above config piece. The task of app_proccess is to start the Dalvik virtual machine, the code of which is located in the /system/lib/libandroid_runtime.so shared library, and then run Zygote on top of it.

When all this is done and Zygote is in control, it starts building the Java runtime environment by loading all of the framework's Java classes (currently over 2000). It then starts the system_server, which includes most of the high-level (written in Java) system services, including the Window Manager, Status Bar, Package Manager, and, most importantly, the Activity Manager, which in the future will be responsible for receiving start and end signals applications.

After that, Zygote opens socket /dev/socket/zygote and goes to sleep, waiting for data. At this time, the previously launched Activity Manager broadcasts the Intent.CATEGORY_HOME intent to find the application responsible for creating the desktop, and gives its name to Zygote over the socket. The latter, in turn, forks and runs the application on top of the virtual machine. Voila, we have a desktop found on the screen by Activity Manager and launched by Zygote, and a status bar launched by system_server as part of the Status Bar service. After tapping on the icon, the desktop will send an intent with the name of this application, it will be accepted by the Activity Manager and will pass the command to start the application to the Zygote daemon

All this may seem a bit confusing, but the most important thing is to remember three simple things:

  • The Android launch process is divided into two key stages: before and after Zygote. Before starting Zygote, the system initializes low-level OS components. These are operations such as mounting (mounting) file systems, launching low-level services (for example, rild, which is responsible for working with a GSM modem, SurfaceFlinger, which controls what is shown on the screen, vold, which controls connected file systems). After starting Zygote, initialization begins exclusively with Java components, which make up 80% of the operating system. This, in particular, is used by the well-known Xposed framework, which, when installed, replaces app_process with its own modified version, which is able to intercept calls to any Java classes, replacing them with any others. That is why Xposed modules have such a wide range of options for modifying the appearance and behavior of Android. In fact, they do not change anything in the system, but simply force it to use third-party components instead of their own.
  • Java applications are never started from scratch. When Zygote receives a request to start an application from the Activity Manager, it does not launch a new virtual machine, but simply forks, that is, copies itself and then launches the desired application on top of the received copy of the virtual machine. This principle of operation allows, firstly, to minimize memory consumption, since Linux, when forking, copies memory in copy-on-write mode (the new process refers to the memory of the old one), and secondly, to significantly speed up the application launch: process fork is much faster than starting a new virtual machine and loading the Java classes that the application needs.
  • Intents are ubiquitous in Android. Android components never use direct calls to procedures and classes to communicate with each other. Instead, a message system (intents) is used, which, in addition to a high level of security, also provides many other goodies, such as, for example, the ability to call an application without knowing anything about it. I already wrote above that to launch the desktop, it is enough for the system to send Intent.CATEGORY_HOME, to which any application capable of performing the launcher function will respond. The “Share” button works in the same way, as well as many other components of the system.