Home Tutorials Training Consulting Products Books Company Donate Contact us









NOW Hiring

Quick links

Share

Android Internal. This articles looks at the internals of Androids and describes a little bit the architecture of Android.

1. Android Development

1.1. Android Operation System

Android is an operating system based on a modified Linux 2.6 with a Java programming interface. Also several drivers and libraries have been modified to allow Android to run efficient on mobile devices.

It provides tools, e.g. a compiler, debugger and a device emulator as well as its own Java Virtual machine (Dalvik Virtual Machine - DVM). Android is created by the Open Handset Alliance which is led by Google.

Android uses a special virtual machine, e.g. the Dalvik Virtual Machine. Dalvik uses special bytecode. Therefore you cannot run standard Java bytecode on Android. Android provides a tool "dx" which allows to convert Java Class files into "dex" (Dalvik Executable) files. Android applications are packed into an .apk (Android Package) file by the program "aapt" (Android Asset Packaging Tool). To simplify development Google provides the Android Developer Tools (ADT) for Eclipse. The ADT performs automatically the conversion from class to dex files and creates the apk during deployment.

For an introduction into Android development please see the Android Development Tutorial. The rest of this article tries to look inside the Android runtime system.

2. Internals

During startup of the Android system the Linux kernel first calls the process "init". init reads the files "/init.rc" and "init.device.rc". "init.device.rc" is device specific, on the virtual device this file is called "init.goldfish.rc".

init.rc starts the process "Zygote" via the program "/system/bin/app_process". Zygote loads the core Java classes and performs initial processing of them. These classes can be reused by Android application and therefore this step makes them faster to start. Once the initial work of Zygote is done, the process listens to a socket and waits for requests.

A special driver called Binder allow an efficient interprocess communications (IPC) in which allow references to objects are passed between processes. The real objects are stored in Shared Memory. This way the communication between the processes is optimized as less data must be transferred.

Android does not provide a swap space like other Linux systems therefore the amound of available memory is limited to the memory on the device.

Androids uses a special C library "Bionic" instead of the standard Glibc. This library is not compatible with Glibs but requires less memory. Bionic contains a special thread implementation which optimizes the memory consumption of each thread and reduces the start time of new threads.

As of Android 2.3 the Android system uses Ext4, the standard file system for Linux. Before that it used the YAFFS file system. Some vendors replaces the standard file system by their own one.

As all application have their own Linux user application data can per default only be accesses from the application. To share data you can save files which are accessible by other applications. Alternatively application can define their own http://www.vogella.com/tutorials/Android/article.html#contentprovider - content provider. Applications which are signed with the same certificate can also define in the "AndroidManifest.xml" a "android:sharedUserId". Application with a shared user id are running in the same process and with the same user id and can access files from similar applications.

The .apk file of installed applications can be found in the folder "data/app". Using the file manager or the adb pull / push command you can download the application or install it on a device. Payed applications or application from the market which have the option "Copy Protection" selected can be found in the folder "data/app-private" which the user cannot access by default.

To further protect an application from illegal copies you can use the library "Licence Verification Library" which checks for a paid application if it has been purchased from the Android Market.

The maximum size of Android application is currently typically 16 or 24 Megabyte. How large the application can be is defined at compile time of the Android system.

3. About this website

4.2. vogella GmbH training and consulting support

TRAINING SERVICE & SUPPORT

The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

Copyright © 2012-2017 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.

See Licence.