What is the Android operating system. How Android works

In this series of articles I will talk about internal structure Android —  about the boot process, about the contents of the file system, about Binder and Android Runtime, about what they consist of, how applications are installed, launched, work and interact with each other, about the Android Framework, and how security is ensured in Android.


Articles in the series:

  • How Android works, part 1

Some facts

Android — the most popular operating system and an application platform with more than two billions active users. It runs completely different devices, from the Internet of Things and smart watches to TVs, laptops and cars, but most often Android is used on smartphones and tablets.


Android is a free and open source project. Most of the source code (which can be found at) is distributed under free license Apache 2.0.


Android Inc. was founded in 2003 and acquired by Google in 2005. The public beta of Android was released in 2007, and the first stable version was released in 2008, since then major releases have been released approximately once a year. The latter is stable at the time of writing Android version - 7.1.2 Nougat.


Android is Linux

There has been a lot of controversy over this wording, so let me first clarify what exactly I mean by this phrase: Android is based on Linux kernel, but is significantly different from most other Linux systems.


Among the original team Android developers was Robert Love, one of the most famous developers of the Linux kernel, and even now Google remains one of the most active contributors to the kernel, so it is not surprising that Android is built on Linux.


Like other Linux systems, the Linux kernel provides low-level things like memory management, data protection, multiprocessing and multithreading support. But — with a few exceptions — you won’t find other familiar GNU/Linux system components in Android: there’s nothing from the GNU project, it doesn’t use X.Org, or even systemd. All of these components have been replaced by analogues that are more suitable for use in conditions of limited memory, low processor speed and minimal power consumption - thus, Android is more like an embedded Linux system than GNU/Linux.


Another reason that Android does not use GNU software is the well-known “no GPL in userspace” policy:


We are sometimes asked why Apache Software License 2.0 is the preferred license for Android. For userspace (that is, non-kernel) software, we do in fact prefer ASL 2.0 (and similar licenses like BSD, MIT, etc.) over other licenses such as LGPL.

Android is about freedom and choice. The purpose of Android is to promote openness in the mobile world, and we don’t believe it’s possible to predict or dictate all the uses to which people will want to put our software. So, while we encourage everyone to make devices that are open and modifiable, we don’t believe it is our place to force them to do so. Using LGPL libraries would often force them to do just that.

The Linux kernel itself in Android too A little modified: several small components have been added, including ashmem (anonymous shared memory), Binder driver (part of the large and important Binder framework, which I will talk about below), wakelocks (sleep mode control) and low memory killer. Initially, they were patches to the kernel, but their code was quickly added back to the upstream kernel. However, you won't find them in "regular Linux": most other distributions disable these components when building.


As libc ( standard library C language) Android does not use the GNU C library (glibc), but its own minimalistic implementation called , optimized for embedded systems - it is much faster, smaller and less memory-intensive than glibc, which has acquired many layers of compatibility.


Android has a shell command line(shell) and many commands/programs standard for Unix-like systems. In embedded systems, this is usually done using the Busybox package, which implements the functionality of many commands in a single executable file; Android uses a similar one called Toybox. Same as in "regular" Linux distributions(and unlike embedded systems), the primary way to interact with the system is through a graphical interface rather than the command line. However, “getting” to the command line is very simple - just launch a terminal emulator application. It is usually not installed by default, but it is easy, for example, to download from the Play Store (Terminal Emulator for Android, Material Terminal, Termux). Many “advanced” Android distributions — such as LineageOS (formerly CyanogenMod) — a terminal emulator is pre-installed.



Second option -  connect to your Android device from your computer via Android Debug Bridge (adb). This is very similar to connecting via SSH:


user@desktop-linux$ adb shell android$ uname Linux

Other familiar components in Android include the FreeType library (for displaying text), the graphics APIs OpenGL ES, EGL and Vulkan, as well as the lightweight SQLite DBMS.


Additionally, the WebKit browser engine used to be used to implement WebView, but as of version 7.0 the installed one is used instead Chrome app(or another; the list of applications that are allowed to act as a WebView provider is configured at the compilation stage of the system). Chrome also uses the WebKit-based Blink engine internally, but unlike system library,Chrome is updated via Play Store - this way, all applications that use WebView automatically receive the latest improvements and vulnerability fixes.


It's all about apps

As you can easily see, using Android is fundamentally different from using “regular Linux” - you don’t have to open and close applications, you just switch between them, as if all the applications were always running. Indeed, one of the unique Android features- is that applications do not directly control the process in which they are running. Let's talk about this in more detail.


The basic unit in Unix-like systems is the process. And low-level system services, and individual commands in the shell, and graphic applications  - these are processes. In most cases, the process is a black box to the rest. systems —  other system components do not know or care about its state. The process starts by calling main functions() (actually _start), and then implements some of its own logic, interacting with the rest of the system through system calls and simple interprocess communication (IPC).


Since Android is also Unix-like, all this is true for it, but while the low-level parts - at the Unix level - operate with the concept of a process, at a more high level  -  Android Framework level  -  the basic unit is application. An application is not a black box: it consists of individual components that are well known to the rest of the system.


U Android applications there is no main() function, there is no single entry point. In general, Android abstracts the concept as much as possible application is running from both the user and the developer. Of course, the application process needs to be started and stopped, but Android does this automatically (I'll talk more about this in future articles). The developer is asked to implement several separate components, each of which has its own life cycle.


In Android, however, we explicitly decided we were not going to have a main() function, because we needed to give the platform more control over how an app runs. In particular, we wanted to build a system where the user never needed to think about starting and stopping apps, but rather the system took care of this for them... so the system had to have some more information about what is going on inside of each app, and be able to launch apps in various well-defined ways whenever it is needed even if it currently isn’t running.

To implement such a system, it is necessary that applications be able to communicate with each other and with system systems. services —  in other words, you need a very advanced and fast IPC mechanism.


This mechanism —  Binder.

Binder

Binder is a platform for fast, convenient, and object-oriented interprocess communication.


Development of Binder began at Be Inc. (for BeOS), it was then ported to Linux and open sourced. The main developer of Binder, Dianne Hackborn, was and remains one of the main developers of Android. During development, Android Binder was completely rewritten.


Binder does not run on top of System V IPC (which is not even supported in bionic), but uses its own small kernel module, interacting with which from userspace occurs through system calls (mostly ioctls) on the “virtual device” /dev/binder. On the userspace side, low-level work with Binder, including interaction with /dev/binder and data marshalling/unmarshalling, is implemented in the .


The low-level parts of Binder operate in terms of objects that can be passed between processes. This uses reference-counting to automatically release unused shared resources and notify when completed remote process(link-to-death) to release resources within the process.


The high-level parts of Binder work in terms of interfaces, services, and proxy objects. The description of the interface provided by a program to other programs is written on special language AIDL (Android Interface Definition Language), which is very similar in appearance to declaring interfaces in Java. Based on this description, a real Java interface is automatically generated, which can then be used by both clients and the service itself. In addition, two special classes are automatically generated from the .aidl file: Proxy (for use on the client side) and Stub (on the service side), which implement this interface.


To the Java code in the client process, the proxy object looks like a regular Java object that implements our interface, and that code can simply call its methods. In this case, the generated implementation of the proxy object automatically serializes the passed arguments, communicates with the service process through libbinder, deserializes the result of the call passed back and returns it from the Java method.

Hello friends, I’m starting to develop a section related to smartphones, now it’s fully operational. Now on the site you will find a bunch of interesting articles about smartphones on Android based. I will try to convey to users in as much detail as possible about new smartphones, that is, there will be a lot of news. Of course, I will focus on creating materials on working with the OS. So to speak, instructions from A to Z. For now, I’ll start with the simplest thing and write an article about what it is and what its advantages and disadvantages are. Now let's get to the point.

What is Android OS

Android is an operating system based on the Linux kernel, which was purchased by Google in 2005. In 2008, the first version of the operating system was released. This OS is designed for smartphones, tablets and many other devices. On this moment it is built into watches, various navigators, set-top boxes and players.

Currently being created great amount smartphones and other devices with this system. It has gained tremendous popularity, so it has almost no competitors, except perhaps iOS.

I don't think it's worth listing famous brands today's phones, which are growing by leaps and bounds. So, they all use Android. If we talk about a pure system, we can say that it is very fast and productive. Many manufacturers, using this OS as a basis, create their own shell with additional functions, capabilities and design. Some people do this better, and the system flies, but in some devices it’s not so good. Using the operating system, you have the opportunity to control functions such as Wi-Fi, Bluetooth, NFC, GPS, create Wi-Fi access points, that is, turn your phone into a modem and much more. Modern smartphones are equipped with fingerprint and iris scanning sensors, which can greatly improve protection - all of this can be controlled using Android. Naturally, Apple with its iOS is trying to keep up.

Advantages and disadvantages

Let's look at the advantages and disadvantages:

  • Since it is developed on the open source Linux kernel, the mobile system is also open source, which allows you to create whatever your heart desires for this system.
  • The clean OS is highly optimized and is not demanding on devices. Can actually work weak phone, which now exists, although it is already rare.
  • The ability to customize the system for yourself.
  • A huge number of add-ons and applications that greatly expand the capabilities of the OS.
  • Speed ​​of operation (not in all cases).
  • The system is available for the following hardware platforms: ARM, x86, MIPS.

These are the main ones positive characteristics, which I noted for myself. Maybe there is something else. In addition to the advantages, there is also minuses:

  • An open-source operating system gives manufacturers of smartphones and tablets an advantage to create shells that are not always as optimized and efficient as possible. In addition, the shell update may come much later than the latest version of the official system is released.
  • If the system is poorly optimized, then there is a possibility of high energy consumption. And atomicity is now highly valued. But it depends rather on the device manufacturers.
  • Because of its popularity, hackers and other bad people write viruses for the OS and look for vulnerabilities. Certainly, certain protection This is an OS, not like Windows. Therefore, the disadvantage is insignificant.
  • There have been cases where users around the world have general case Several million dollars were stolen. This was done by sending SMS without the user’s knowledge.


In addition to the pure system from Google, there are a number of enthusiasts developing their own firmware, which have their own functionality and capabilities. You will see a completely different design; it happens that the firmware of another manufacturer will work better than pure Android.

At the moment, there are companies that create firmware for smartphones and other devices: CyanogenMod, which is now LineageOS, AOKP, MIUI, Paranoid Android, AOSP, Replicant and others.

Enthusiastic developers try to release firmware versions on time, together with the release of a clean OS. But sometimes there is no need to flash the phone, since the manufacturers could take care of it.

Applications and Play Market

Everyone knows that every day we go to the store Google applicationsPlay Market Hundreds of programs and games are posted. You can find whatever your heart desires, this various audio and video players, desktop wallpapers, file managers, of which there are probably thousands, a lot of software for communicating with people - social media, messengers and others. You can also download movies, books and music from there. Of course, there is content there, both paid and free.

A little theory. The Android application code is written for the so-called Dalvic virtual machine. Applications have the format .apk, this is the only format. Until recently, applications themselves could be written in Java language, and since 2009 Google of the Year added special package capabilities that allow you to create software in C and C++. Also, there are many development environments, such as Embarcadero RAD Studio.


As for the application store itself, it was opened in 2008. The agreement was that the software developers would give 30% of the profits Google. By the standards of 2017, there are about more than 2.8 million applications in the Play Market database.

Of course, sometimes unscrupulous users posted applications with malicious code, because of which a scandal arose around 2011, but the problems were quickly hushed up and the vulnerabilities were closed.

No matter what anyone says, the direct specific Play Market is the App Store - an application store for iPhone, iPad, iPod and other devices. They have less software than the Play Market. Developers' income is the same as Google's. you create paid application, for which you will give 30% of the profit.

What's inside Android

And now, almost the penultimate point, in which I want to talk about the internal components of the system. Those who use this system should understand it at least a little. And compare it with Windows.

So, Linux differs from Windows in that the latter has information divided into disks and folders, of course, in Linux as well, but it is all displayed differently. Linux systems have a tree structure.

There are also differences in registers. If you create several folders with the same names, then Windows differences it won’t, but in Linux it will be absolutely different folders. This also applies to files. These names will be different in Linux - Papka, papka, PAPKA.

The cache for the system and some application will always be saved in a special section - cache.

Surely in file manager everyone saw the folder data. This directory has other folders related to installation files and application directories.

Configuration files and software libraries can be found in the folder app-lib.

For applications to work, they are written in Java for a special Dalvik virtual machine. So you may come across a catalog dalvic-cache. Sometimes it needs to be cleaned, for example, before flashing the phone. This is done using root rights or from, but I will definitely talk about all this in future articles.

You will definitely see the directory in the file manager system. From the name it is clear that they are stored there system settings, changing which can ruin your system.

In the catalog etc you will find files that allow the system to start normally.

These are not all the folders that are in the Android system. It will take several additional articles to sort it all out.

Additional features

Many people know that each modification of the system has key title, usually some kind of dessert. For example, Cupcake, which means cupcake. One of the popular versions 4.1-4.3 is called Jelly Bean(Jelly beans). But version 4.4 is named after the famous chocolate bar KitKat. The next modification 5.0 and 5.1 is called Lollipop- lollipop. Sixth option - Marshmallow and finally, the latest version 7.0-7.1.2 received the code Nougat.

There is just a little time left before the release of version 8, or as it is called Android O. The beta version of the operating system is already installed on some flagships and works stably. The entire OS will be released at the end of 2017. And yes, keyword most likely it will be - Oreo. Below you will see a video of the presentation of the eighth version.

Well guys, I finished the article, now you know what Android is, where it is used, its features. In future articles I will tell you almost everything related to this operating system. Well, I wish you good luck!

Every smartphone consists of many complex components, and you won't always think about them before choosing a device model. But, nevertheless, it is important to know what hardware helps your smartphone function.

In this article we will analyze the main parts of what has become one of the most important electronic devices On the market. Let's look at what a smartphone consists of and why this or that component is needed. Nowadays there are many different models of smartphones, different designs, with different characteristics, battery life, and so on. But if you understand the hardware of a smartphone, then choosing the right model will be much easier.

1. Display

One of the most obvious components of a smartphone is its screen. Everything you see on the screen is processed and controlled internal components. There are currently two display manufacturing technologies:

The liquid crystal display uses a backlight to produce images. White light passes through the filters and thanks to the ability to control the properties of the crystals you can see different colors. Light is not created by the screen itself, it is created by the light source behind it.

The LED screen works differently. Each pixel you see on the screen is a separate LED. Here the screen itself creates bright and colorful colors. The advantage of Super AMOLED over IPS is that when the pixel is turned off you will see black, it does not use the battery. Therefore, smartphones with AMOLED are more efficient for battery life. But AMOLED screens more expensive than IPS, so a smartphone with such a display will cost significantly more.

2. Battery

Commonly used in smartphones lithium ion batteries, they can be removable or not removable. Thanks to this technology, you do not need to calibrate or test the battery as with nickel-based batteries. However, these batteries have many problems of their own.

3. System-on-a-Chip (SoC)

SoC or motherboard with processor is the most important component of your smartphone. Some users may think that it is the processor of the device, but it is more than that. The SoC includes not only the processor, but also the graphics processor, LTE modem, screen controller, wireless adapters and other silicon blocks that make the phone work.

There are smartphones using SoCs from Qualcomm, MediaTek, Samsung, Krirn's own chips, Apple, but they all use the same architecture - ARM. ARM not only makes processors, but also licenses their architecture to other companies, so everyone can use the same technology to create modern and powerful SoCs.

Some companies release their own architectural lines that are compatible with ARM and can be used in smartphones. An example would be Apple chipsets running Cyclone or Qualcomm processors Kryo. SoC is the main components that make up a smartphone.

4. Internal and RAM memory

No smartphone can work without RAM and system storage. Most devices use RAM LPDDR3 or LPDDR4, and some high-end models come with LPDDR4X. The combination LP means Low Power, the supply voltage of these microcircuits is reduced, and this makes them more efficient in terms of energy consumption.

LPDDR4 is more efficient than LPDDR3, and LPDDR4X is more efficient and economical than both. There is also even more efficient memory - LPDDR5.

As for the internal storage, flash memory from 32 to 256 GB is used here. User requirements are constantly growing and volumes will grow in accordance with them. When you turn on the phone, you will see that the storage size is smaller than stated. For example, it is said that the drive is 64 GB, but 53-55 GB is available for recording. This memory is occupied by the operating system and applications.

5. Modems

Since smartphones are still phones, they need communication components to receive and make calls, send text messages and connections to the Internet. This is what modems are used for. Each SoC manufacturer has its own brand of modems, these are Qualcomm, Samsung, Huawei and others.

Each manufacturer is trying to release the fastest LTE chip. At the moment, the fastest 9-LTE chip is, but there is no point in taking it if your cellular network does not support such speeds.

6. Camera

All smartphones have front and front cameras. The cameras consist of three main parts:

  • Sensor- detects light;
  • Lens- concentrates the image;
  • Image Processor.

The number of megapixels of a smartphone camera still remains very important criterion, but it matters much less now. Now the main limiting factor is the camera sensor, as well as its sensitivity when light passes through it.

The sensor may behave differently in each smartphone, so the photo or video will have different contrast, shades, and saturation compared to other smartphones. Because smartphones have small sensor sizes, they tend to perform poorly in low-light conditions.

7. Sensors

In the majority modern smartphones There are five main sensors built in that will allow you to use your smartphone more conveniently. Here they are:

  • Accelerometer- used by applications to determine the orientation of the device and its movements. For example, it allows you to use shaking your smartphone to switch music;
  • Gyroscope- Works with the accelerometer to detect your phone's rotation. Useful for racing games;
  • Digital compass- helps to find North for normal orientation on maps;
  • Light sensor- This sensor allows you to automatically set the screen brightness depending on the ambient light and helps increase battery life.
  • Proximity sensor- During a call, if the device comes close to your ear, this sensor automatically locks the screen to prevent unwanted touches.

These were all the main elements of a smartphone; different models may have other sensors, for example, a pulse sensor, pressure and temperature, but they are much less common.

conclusions

We looked at what a smartphone consists of. Now that you have more information about the complex components that make up each smartphone, you can choose your next purchase by comparing features various components. This way you will choose the best device that will fully meet your needs.

You're probably here because you already have Android device or just started thinking about buying. The new ones have a lot of useful features with expanded rights and capabilities and a lot of “fun”.

Unlike the iPhone or iPad (which only have a few devices), there are hundreds of Android devices to choose from. This is just one reason that makes them so attractive and in demand. You're sure to find exactly what you need - within your budget or depending on your other preferences.

Options and types of Android a lot, because technically it is an operating system for any smartphones and tablets. Many companies make and release devices that are designed to run on Android, including including Samsung, HTC, LG and other lesser known brands. And they are all different, since each manufacturer adds its own settings and functions to the device, which in turn serve as advantages or disadvantages of a particular company when purchasing its product.

What makes each device unique?

Android devices vary depending on the manufacturer. Look at two Android phone below. What do you see?

Some differences are obvious, but others are less obvious, for example:

  • The phone on the left is a little bigger
  • The monitors are different, the buttons at the bottom are different
  • Each screen has its own unique layout
  • Some icons look different; for example, compare two call icons

There will always be differences in the device itself, such as appearance, storage memory and camera quality. There will also be differences in software (in other words, features on the screen) that may affect the overall experience of the Android device.

Buying an Android Device

Now you know that every Android device is unique. If you don't have an Android device yet, it's time to buy one that meets your requirements.

Device selection

If you're not sure where to start, you can check some review sites. Based on the reviews, you'll have a better idea of ​​what devices are available and how well they perform. In general, there are 2 main factors that you should pay attention to when buying: price and characteristics.

Price: Android devices can vary widely in price. For example, some sellers (for example, Megafon) offer certain phones at a very low price or even free (usually these are old models or not very functional models) if you buy a SIM card immediately for a certain period. If your choice falls on more expensive phones, then the price of such phones fluctuates from to. Tablets usually cost more.

Characteristics: Android devices come in different shapes, sizes and colors. Key specs include screen size, battery life, camera quality, and overall performance. In addition, there are a number of useful functions that you also need to think about, for example, the mode speakerphone or even fingerprint recognition.

Purchase

Have you already decided which device you want? There are 2 ways to make a purchase - online or at your local electronics and computer store.

Avoid dubious promotions or competitive offers that do not sound believable. Since there is a very high demand for Android devices, and as a rule, there are unscrupulous sellers and scammers, especially on the Internet, who want to take advantage of your attention and trust. We recommend purchasing goods only from a well-known and trusted seller.

    Certain Android tablet models may not include some of the components listed above.

    All Android tablets are controlled by one of the versions of the mobile operating system from Google. However, older versions may not support some of the modern applications.

    All versions of the most popular mobile operating system have a common basis. We can think of the Android operating system as a multi-layered structure. Computer engineers call this a software stack. The elements at the top of the stack are what the user sees as they interact with the operating system. At the bottom of the stack are those parts of the operating system that interact directly with the device hardware.

    So, actually lower level The hardware components themselves are located: processors, sensors, wires and printed circuit boards. The next layer is the operating system kernel. The kernel is sometimes also called firmware (or firmware). The English definition of “firmware” is better known. This software controls, manages, and allocates the device's hardware resources.

    This part of the operating system “translates” into the language of hardware components the commands that the user gives through a convenient graphical interface. The kernel sample for Android was the open source operating system Linux 2.6.

    Above the operating system kernel are the Android libraries. They are sets of instructions that the device follows during processing. various types data. An example would be the 3D orientation library. It contains all the instructions that an Android device needs to recognize and respond to changes in its position in space.

    At the same level of the software stack are the root libraries needed to support applications written in Java. Java is a programming language from Sun Microsystems. Until relatively recently, phones with support for Java applications were very common. Currently, they are increasingly being replaced by smartphones.

    Virtual machine Android resides at the same level of the operating system software stack. This item software is engaged in the creation of a virtual operating environment, which is also called a virtual operating environment. The virtual machine simulates physical device with a separate operating system. Google designed this layer so that each application running on the Android operating system functions as a separate process. This way, if one of the running processes fails, the others will remain unaffected. The virtual machine also plays the role of a memory manager.

    At the next level is the application framework. It is the basis for all applications of the Android device. Application infrastructure is the connection between applications and the rest of the operating system.

    Google encourages developers to create applications that interact with this layer within the application programming interface (API) of the search giant's operating system. Developers just need to become familiar with these API-related rules. They don't have to think about technical specifications every Android tablet.

    Most top level The software stack contains the user interface and all the applications of the Android tablet. It is this part of the operating system that the user constantly sees in front of him. But behind this attractive and colorful layer hides a lot of boring code that is interesting only to specialists.

    Like any other operating system, and other hardware resources of the tablet.

    Based on materials from computer.howstuffworks.com