Intro to Android

Android

Android is an open source software and hardware system that sits on top of a Linux kernel. It also includes devices and the set of applications that run on the OS.

You can browse the source Android Open Source Project (AOSP) at source.android.com.

Architecture Layers

Android's architecture has many layers. Android Stack

If you'd like detailed information about the stack and Android's security features, you can read more here: http://source.android.com/devices/tech/security/index.html

The top of the stack is where all the builtin applications, 3rd party applications, and your applications live. All apps here are created equal and have the same access to the rest of the stack.

The second layer includes the application framework, which gives you the tools to write applications, such as the SDK, activity managers, location managers, notification managers, and the view system.

The hardware access layer is where libraries are located for interacting with GPS, Wi-Fi, Bluetooth, NFC, and other hardware features. The runtime is also at this layer.

Each application runs in it's own virtual machine (VM) instance, which means that applications can not directly invade each other's process space. The system provides Linux-style permission controls while maintaining an open system through Intents and other interprocess communication capabilities.

At it's lowest level, the Linux kernel handles drivers, power management, and other low level processes.

Compilation

The compilation phases include turning your Java files into .dex bytecode files, which is Android's version of Java bytecode. An R.java file is created so that Java can refer to the XML components and other application resources.

The output of compilation is an .apk, which at it's heart is basically a .zip file.

Here's more detail here about the stages of compilation: http://developer.android.com/tools/building/index.html

Runtime

DEX bytecode is run on a virtual machine (much like Java runs on the JVM), called the DVM, or Dalvik Virtual Machine. The DVM was written to be optimized for mobile devices.

Get all the low level details here: https://source.android.com/devices/tech/dalvik/index.html


In the future the DVM will be replaced with the new Android Run Time (ART).

Your application's resources are bound at runtime when Android determines which device it is running on and chooses the best resources for that particular device.

Intents are also a run time binding. You issue a request and any app that can respond to the request will. The user chooses which action to take based on a particular type of request or the system uses user's defaults.

Signing

Applications are signed with a key. This combined with the unique package name is what identifies an application on the system.

By default, when you create development builds, you are using a default key to sign your application. You will use a different key with a password when you prepare for release.

Note: Once you deploy your application with this release key you are forever stuck with the key and package name. That's why it's so important to determine what you'd like to use for your package name and to always keep your release key safe!


Note: It's possible to have both a debug and release signed version of the same application on your device since the package name and signature are used together to identify an application.