Android technology Architecture Evolution and future

The state of Android development

At the moment, mobile development is saturated and Android development is not as hot as it was a few years ago. Just like a programming language that has had its heyday, there must be a curve like the sinusoidal curve that rises rapidly, then reaches a peak, then falls again, and then reaches a plateau. It can be seen that from the second half of 2016, the mobile Internet is basically in the stage of slow development, which many bigwigs call the second half of the Internet. If the first half of the mobile Internet is extensive strong territory stage, then the second half is to defend the territory stage, this stage, there will be many oligarchs. In terms of technology, unlike the previous interview, which only asked about the four components of Android, database, network and project experience, now I will design various principles (including some principles of the system and principles and processes of third-party libraries), Android optimization and cross-platform technologies related to Android. On top of that, larger companies have requirements for user experience, smoothness, and so on, so Android interviews are not the same anymore.

For Android interviews, please refer to my previous post:

Android Development Beginner Intermediate Advanced how to divide the most comprehensive Android interview questions collection

It’s been more than 10 years since Android 1.0 came out. What are some of the problems Android has encountered along the way? What is the evolution of major releases? What is the future of Android?

Android history

Let’s take a look at the evolution of Android. From The release of Android 1.0 in 2008 to the release of Android 10.0 in 2019, Android continues to release new OS every year. Every year Android brings a lot of features, especially in the last few years, as Android optimizes the underlying system, the gap between Android and iOS has narrowed.

Let’s take a look at the key Android release dates.

  • Android was founded in October 2003 by Andy Rubin and his team.
  • In August 2005, Google acquired Android, and Andy Rubin continued to lead the Android project as Vice President of Engineering.
  • In September 2008, Google released Android 1.0.
  • In January 2011, the total number of Android device users reached 135 million, becoming the number one system in the smartphone field.
  • In August 2011, Android phones accounted for 48% of the global smartphone market and dominated the Market in the Asia-pacific region, ending the dominance of Symbian system and ranking first in the world.
  • In January 2012, Google’s Android Market had 100,000 developers and over 400,000 apps.
  • In November 2013, Android 4.4 was officially released, with a smarter system and more modern UI.
  • From 2013 to 2018, Android entered a period of rapid development, with upgraded cameras, memory, body and chips, etc. The original 3.5-inch small screen has been withdrawn from the historical stage, and full screen, fringe screen and water drop screen have become the current mainstream screen solutions.

System evolution

No matter what system it is, it is bound to face iterations of multiple versions. As one of the most popular mobile operating systems, Android system has also undergone more than 10 years of iteration and update, and has made great improvements in user experience, fluency, battery life, security, privacy, machine learning and other aspects. The figure below illustrates the updates for each version of Android.

Android 1.0 to Android 4.0, the system functions and features of the iteration to a more perfect stage.

For Android 4.1, Google launched Project Butter, in order to make Android system get rid of the serious lag in UI interaction, hoping to be as smooth as “Butter”. The core principle is that VSYNC technology and Triple Buffer technology are adopted for rendering and animation in the framework of the system to make sliding, page turning and other operations more consistent and smooth.

For Android 4.4 system, Google has carried out Project Svelte to reduce the memory usage of Android system and solve the problem of upgrading low-end models, so that Android 4.4 can run normally on all Android phones, so as to reduce the fragmentation of Android system. In terms of UI design, the new “immersive mode” is supported. The user interface is changed from the black and blue color to the light color with transparency, and the visual language becomes more bright and modern.

In Android 5.0 system, Google launched Project Volta to improve battery life. In this aspect, Google lags behind manufacturers in the industry. Manufacturers are particularly urgent for battery life in the face of users, and often have more strict system resource control. In addition, the system adopts new ART, abandons Dalvik VIRTUAL machine, and greatly improves operation efficiency. UI Design, using a new flat Material Design style, more fresh and texture Design, unified Android device appearance and use experience.

Android 6.0 system, Google introduced a new runtime permissions, so that users can better understand and control permissions; Doze mode was introduced to further improve battery life. UI design, new night mode, greatly improved the notification bar, so that the notification more concise.

Android 7.0, the introduction of a new JIT compiler, AOT compiler complement, can save storage space and speed up the update speed; Further optimize Doze wake up mechanism; UI design, support split screen function.

In Android 8.0 system, Google launched Project Treble to re-structure Android and decouple Android system framework from Vendor layer, striving to completely solve the long-standing problem of Android fragmentation, which is the biggest change in Android system architecture. At the system level, the management and control of background services, broadcasts, and locations should be strengthened. UI design, improved notification bar, intelligent text selection and automatic fill function.

Android 9.0 system, the introduction of neural network API, the use of machine learning ideas to predict user habits to do power saving optimization, continue to strengthen Treble plan; File systems (SDCARDF /F2FS) continue to improve; Restrictions on private apis further formalize the Android ecosystem, enhancing privacy and security, hardware security modules, and a unified biometric authentication interface. UI design, new gesture navigation, enhanced support for bangs, UI search interface using machine learning, AI is gradually strengthening the Android system.

In Android 10.0 system, Google has launched Project Mainline, and the relevant Modules are not allowed to be modified directly by manufacturers. They can only be updated and upgraded by Google App Store, which strengthens user privacy, system security and compatibility, and supports facial biometric recognition.

Android System Architecture

No matter how the Android system is upgraded, the overall architecture of Android is basically unchanged, that is, it can be divided into application layer, application framework layer, system runtime layer and Linux kernel layer from top to bottom, as shown in the figure below.

1. Application layer

The top layer is where all the Android apps, including contacts, browsers, and so on, are installed. All applications are written in the Java language.

2. Application framework layer

This layer provides the apis that can be used to build applications. Some of Android’s core applications are built using these apis, and developers can use these apis to build their own applications.

  • Activity Manager: Controls all aspects of the application life cycle and Activity stack
  • Content Providers: Allow applications to publish and share data with each other.
  • Resource Manager: Provides access to non-code embedded resources, such as strings, color Settings, and user interface layouts.
  • Notification Manager: Allows applications to display dialog boxes or notifications to users
  • View System: An extensible collection of views used to create application user interfaces

3. System runtime layer

library

Android contains C/C++ libraries that can be used by different components of the Android system. They serve developers through the Android application framework, and here are some of the core libraries:

  • System C library (LIBC) : a standard C system function library inherited from BSD. It is a Media Framework specially customized for embedded Linux-based devices. The library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. Encoding formats include MPEG4. H264, MP3, AAC, AMR, JPG, PNG.
  • Surface Manager: Manages display subsystems and provides seamless blending of 2D and 3D layers for multiple applications.
  • SGL: The underlying 2D graphics engine.
  • 3D Libraries: Implemented based on OpenFLES1.0 APLs, this library can use hardware 3D acceleration or highly optimized 3D soft acceleration.
  • FreeType: Bitmap and vector font display.
  • SQLite: A lightweight, powerful relational database engine available to all applications.

Android runtime

Android includes a core library that provides most of the functionality of the Java programming language core library.

Each Android application runs in its own process and has a separate Dalvik VIRTUAL machine instance. Dalvik is designed to run multiple virtual systems simultaneously and efficiently with a single device. Dalvik virtual machine execution (.dex) Dalvik executable, which is optimized for small memory usage. At the same time, the virtual machine is registrie-based, all classes are compiled by the Java compiler, and then converted into.dex format by the SDK “dx” tool for the virtual machine to execute

The Dalvik virtual machine relies on some of the features of the Linux kernel, such as threading and underlying memory management mechanisms.

4. Linux kernel layer

Android system based on Linux2.6 kernel, this layer provides the underlying driver for Android devices, such as display driver, audio driver, camera driver, Bluetooth driver, WIFI driver, power management and so on

Android system fragmentation

After more than 10 years of iteration, Android has made great progress in fluency, memory, battery life, security, privacy and other aspects. However, fragmentation of Android system has always been a pain point, bringing inconsistent user experience.

The openness of Android is the main reason for its long-term development, so that most manufacturers choose Android system, but behind the openness is fragmentation. Since the birth of Android, the problem has been existing, And Google has been trying to solve the fragmentation problem from a technical perspective. Proposed the Treble project from Android 8.0, re-architecting the system to decouple the system from vendor to speed up the adaptation of the new Version of Android, but the effect was not obvious. Google has been working hard to improve the Treble project in subsequent Android P and Q releases to speed up upgrades.

These modules are mainlines maintained by Google, and vendors can only communicate with Google and upstream code to the AOSP mainline. Google has spent a lot of manpower to improve and implement Mainline. Google wants a unified control mechanism, and manufacturers want maximum free customization space. This is an interesting competition. Finally, some modules with great influence will be put online again on Android 11. The Mainline update mechanism is shown below.

Android app development evolution

The Android system relies on apps to provide rich functions. Here are some of the technological evolutions involved in App development.

Mobile cross-platform technology

From the initial Hybrid development technology based on Cordova (which relies on WebView), to the bridge technology of React Native (converting JS to Native), to the latest Flutter technology, all illustrate the current attempts of mobile terminal in multi-terminal development. Flutter is a new mobile cross-platform UI framework released by Google. The rendering engine relies on the cross-platform Skia graphics library to implement Flutter. Only graphics rendering interfaces are required to ensure maximum experience consistency across platforms and devices. More efficient than JavaScript. In addition, The UI layer of Fuchsia, another operating system being developed internally by Google, uses Flutter, which means that Flutter can support Android, IOS, and future Fuchsia. On the big front end, Flutter is currently better positioned to iterate on better and better solutions for cross-platform development.

For more information about cross-platform, see: Summary of mobile cross-platform technology Solutions

Application architecture

Software Architecture refers to a series of abstract patterns involved in the process of Software development, which are used to guide the design of various aspects of large-scale Software systems. Software Architecture is the theoretical basis for building computer Software systems. In the development of Android, software architecture patterns such as MVC, MVP and MVVM have been proposed successively, which provide a theoretical basis for the development of Android projects.

MVC mode (Model — view — controller) but the Activity class is too bloated, to solve this problem, there is a MVP (Model — view — Presenter), not only to manipulate data, but also update the view; To MVVM (model-view-ViewModel) to solve the MVP a large number of manual View and Model synchronization problem, providing a two-way binding mechanism.

Hotfix and plug-in

The so-called hot fix refers to the repair solution proposed to fix the problem on the line, the process of repair does not need to re-issue the version! The main application scenario of hot fix is to allow users to fix online defects without feeling, such as Tinker, Andfix, Sophix, etc. Plug-in is to reduce module coupling, reduce the scale of the main program, can be loaded on demand, such as DroidPlugin, OpenAtlas and so on. The details of the various hotfixes and plugins are no longer expanded. Just to say one thing, Android 7.0 has restrictions on calling Native NDK, especially Android 9.0 has restrictions on calling Java SDK. The next thing you want to do with Android apps is to dance with handcuffs on your feet. You can dance but it’s probably not pretty.

For thermal repair, please refer to:

Android hotfix technology summary Android hotfix framework comparison

For plugins, please refer to:

Ctrip Android App plug-in and dynamic loading technology analysis mogujie Android componentalization and plug-in Android Plug-in ClassLoader details

App dynamic framework

As applications continue to deliver speeches, their functions become more and more complex, and applications are packaged in the same App for different screen devices and language resources in different countries, application packages keep increasing. According to statistics, the size of application packages has increased by 5 times since 2012. Mobile phones now have more storage space, but the quality of users’ photos, videos and other media files is improving, resulting in a shrinking amount of available space. To that end, Google talked about the introduction of a new App dynamic framework (the Android App Bundle, or AAB) for Android at Google I/O last year. Split Apk is used for dynamic loading and AAB is used for dynamic delivery, which can significantly reduce the application volume and storage space occupation.

For more information about App Bundle, see:

Introduction to Android Dynamic framework App Bundles

Kotlin

Kotlin is an official Static programming language recommended by Google and interoperable with Java. Kotlin compiles to Java bytecode, can also compile to JavaScript, and runs on devices without JVMS for simplicity and security. Using Kotlin to write Android apps faster can make developers more productive and write less boilerplate code, which has been called the Swift of the Android world. According to a survey conducted by the Google developer community, about 50 percent of Android developers have used Kotlin. Not everyone is encouraged to use Kotlin; learning a new language is like an investment, balancing the team’s costs against its benefits. If you’re a native Android developer, mastering Kotlin is a must-have skill. As a veteran of mobile development, I published the Kotlin Primer in 2018, and I’m still impressed by Kotlin’s concise syntax.

Fuchsia

Fuchsia, the third system developed by Google after Android and Chrome OS, has been partially available on Github. Unlike the Linux kernel used by Android, Fuchsia uses the newer Zircon kernel. Compared with the current Android system, the hardware requirements such as memory or memory are greatly reduced. It can be seen that this is a system for household appliances facing the Internet of things. The Flutter engine +Dart language is likely to become the main UI development framework for Fuchsia. Fuchsia’s choice of Flutter as its UI is not surprising. Google owns the Dart language, not only without the fear of being sued, but also with the flexibility to make specific changes to the Dart VM when Fuchsia needs to.

Will Fuchsia be the End of Android? I don’t think it’s likely to replace Android for at least the next three to five years. It took Three years for Google to develop Android, which was a top priority to compete with Apple’s iOS. Fuchsia is only a pilot project, and Fuchsia is based on a new Zircon kernel rather than a mature Linux kernel. There is still a long way to go. Below is a diagram of Fuchsia’s overall technical architecture.

Fuchsia’s modular function-based operating system should enable each component module to update its capabilities independently, ensuring a consistent experience. After Fuchsia occupies a certain share in the IOT field, and its good cross-platform, it can gradually penetrate into mobile phones, laptops and other devices, so as to create a unified platform experience of perfect connectivity between mobile phones, computers and IOT, so that multi-terminal devices can not do without Fuchsia. In October 2018, Google demonstrated Fuchsia’s connectivity to Android devices at UnPlugFest (UPF), a testing conference organized by the Bluetooth Special Interest Group (Bluetooth SIG). Fuchsia is positioned as the Internet of Things, and it is believed that with the arrival of 5G era, Fuchsia will likely dominate. For now, though, Fuchsia has a long way to go.

The future of Android development

The evolution process of mobile operating system is from symbian feature phone with keystroke interaction to Android/IOS smart phone with touch screen interaction, from small screen phone to full screen, fringe screen and water drop screen. To summarize, any system does two things: input and output. After receiving external input signals, the operating system processes the output information.

Android development so far, has become the world’s most extensive user mobile operating system, mobile phone industry competition is extremely fierce, after several reshuffle, domestic mobile phone manufacturers are mainly Huami OV four companies, and with the growth of mobile Internet peak, domestic Android development demand is becoming less and less, so where is the future of Android?

At present, Android’s development at the application level has peaked, and its future development is mainly concentrated in the industry combining artificial intelligence and 5G. Intelligent cars, smart homes and IOT will be the broad market for Android’s development. But the singularity of AI has not yet arrived, and the technology is still in its early stages. When it does, it will explode and redefine the way of life. Intelligent and Internet-based cars are a big trend in the future. Google has indeed made efforts in the automotive field in the past two years. The number of Android Auto users has increased by 250% in the past year. With the inherent mobile characteristics and the increasing demand for Internet services, cars need a system with multiple sensory capabilities, which may become the next key exploration area of Android after mobile phones and TV.

For Android developers, I have the following tips:

  • I will try my best to become an expert in the Field of Android and improve my thinking and ability of engineering architecture, because software engineering ideas are all the same. If you excel in one area, even if Android is obsolete, the interviewer will still believe you can excel in the new area.
  • In the case of depth, I can broaden my scope appropriately, summarize every project, and be familiar with the overall structure of the whole system and have a profound understanding of the core.