What is Android?

Android is an open platform for mobile development.

  • A hardware reference desgin for mobiles
  • A Linux operating system kernel
  • Open source libraries
  • A run time environment
  • An application framework and UI framework
  • Some pre-installed applications
  • Software Development Kit

Developers need only develop for Android in general, and their applications should be able to run on numerous different devices, as long as the devices are powered using Android.

Advantages to Manufacturers

  • This development model makes Android very attractive to vendors, especially those companies affected by the phenomenon of Apple’s iPhone
  • Vendors (typically hardware manufacturers) can add their own proprietary extensions to Android and customize Android to differentiate their products from others.

Birth of Android

Initially developed by Android Inc.

  • In 2005, acquired by Google
  • In Nov 2007, Open Handset Alliance (OHA) was established

OHA is a global alliance initialized by Google for reducing the cost for mobile equipment develop and facilitate technology exchange among members within the alliance.

Android Versions

For Idk what reason, Starting from Version C, Android Versions use a dessert name as version.

  • e.g. Cupcake, Donut, Eclair, Froyo, Gingerbread etc…

Fun fact: in recent versions they stopped using dessert names as version. Maybe running out of words.

Android License

Android’s source code was released under the open source Apache License.

  • anyone who wants to use Android can do so by downloading the full Android source code
  • Vendors (typically hardware manufacturers) can add their own proprietary extensions to Android and customize Android to differentiate their products from others

Android Devices

Android devices come in all shapes and sizes including, but not limited to, the following types of devices.

  • Smartphones
  • Tablets
  • E-reader devices
  • Internet TVs
  • Automobiles
  • Smart wears

Features of Android

The base Android OS supports:

  • Storage
    • SQLite, a lightweight relational database, for data storage
  • Connectivity
    • GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth (includes A2DP and AVRCP), Wi-Fi, LTE, and WiMAX
  • Messaging
    • SMS and MMS
  • Media Support
    • H.263, H.264 (in 3GP or MP4 container), MPEG-4 SP, AMR, AMR- WB (in 3GP container), AAC, HE-AAC (in MP4 or 3GP container), MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP
  • Hardware support
    • Accelerometer sensor, camera, digital compass, proximity sensor, and GPS
  • Multi-touch screens
  • Multi-tasking applications
  • Tethering
    • Sharing of Internet connections as a wired/wireless hotspot

Android Architecture

We will go from bottom to up.

Linux Kernel

Android is based on linux kernel. This layer contains all the low-level device drivers for the various hardware components of an Android device.

  • Works as a HAL (Hardware Abstraction Layer)
  • Device drivers
  • Memory management
  • Process management
  • Networking

Note:

  • Android is built on the Linux kernel, but Android is not Linux
    • No native window
    • No glibc
    • Not all standard Linux utilities included
  • Android has modified / Added features
    • IPC Binder
    • Power Manager etc.

Libraries

The Libraries here are the code that provides the main features of an Android OS.

  • C/C++ libraries
  • Interface through Java
  • Surface manager – Handling UI Windows
  • 2D and 3D graphics
  • Media codecs, SQLite, Browser engine(Webkit)

Android Runtime

The Android runtime is located in the same layer with the libraries and provides a set of core libraries that enable developers to write Android apps using the Java programming language.

The Android runtime also includes the Dalvik virtual machine, which enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine. (Android applications are compiled into Dalvik executables)

Dalvik is a specialized virtual machine designed specifically for Android and optimized for battery-powered mobile devices with limited memory and CPU power

Android Runtime - Before Android 5.0

  • Android Runtime uses Dalvik VM (not JVM, for versions before 5.0)

    • Dex files (Dalvik Executable Files)
    • Compact and efficient than class files
    • Limited memory and battery power
  • Core Libraries

    • Java Standard edition
    • Collections, I/O etc…

Android Runtime was designed specifically for Android to meet the needs of running in an embedded environment where you have limited battery, limited memory, limited CPU

Before Android 5.0, Android application are compiled to Dalvik bytecode

The Dalvik runtime is optimized for mobile applications

  • Run multiple VMs efficiently
  • Each app has its own VM

Android Runtime - Starting from Android 5.0

Android Runtime(ART) was introduced, which employes ahead-of-time (AOT) compilation instead of Just-In-Time (JIT) compilation in the old version.

Ahead-of-time (AOT) compilation:

  • Compiling entire applications into native machine code upon their installation.
  • Improves the overall execution efficiency
  • Reduces power consumption (Improved battery autonomy)
  • Provide backward compatibility, ART uses the same input bytecode as Dalvik
    • supplied through standard .dex files as part of APK files, while the .odex files are replaced with Executable and Linkable Format (ELF) executables
  • Once an application is compiled, it is run solely from the compiled ELF executable, which eliminates various application execution overheads associated with Dalvik’s interpretation and trace-based JIT compilation

However:

  • As a downside, ART requires additional time for the compilation when an application is installed, and applications take up slightly larger amounts of secondary storage (e.g., flash memory) to store the compiled code

Application Framework

The application framework exposes the various capabilities of the Android OS to application developers so that they can make use of them in their applications

  • API interface
  • E.g., Activity manager – manages application life cycle.

Applications

At this top layer are the applications that ship with the Android device

  • such as Phone, Contacts, Browser, and so on
  • as well as applications that you download and install from the Google Play.

Any applications that you write are located at this layer

  • Built in and user apps
  • Can replace built in apps

Android UI Dilemma - Unify or Differentiate?

Here’s the fundamental question: Is Android a single platform, or is it a foundation upon which carriers and handset makers build their own varyingly compatible/consistent platforms?

How Does Google Make Money From Android?

Google is an advertising company. Major revenue comes from advertising.

AdWords and Search Advertising

  • The bulk of Google’s $110.8 billion revenue in 2017 came from its proprietary advertising service, Google AdWords
  • When you use Google to search for anything from financial information to local weather, you’re given a list of search results generated by Google’s algorithm
  • The algorithm attempts to provide the most relevant results for your query, and, along with these results, you may find related suggested pages from an AdWords advertiser
  • AdWords advertisements integration touches almost all of Google’s web properties
  • Any recommended websites you see when logged into Gmail, YouTube, Google Maps, and other Google sites are generated through the AdWords platform
  • To gain the top spot in Google advertisements, advertisers have to outbid each other. Higher bids move up the list while low bids may not even be displayed
  • Advertisers pay Google each time a visitor clicks on an advertisement
  • A click may be worth anywhere from a few cents to over $50 for highly competitive search terms, including insurance, loans and other financial services