Introduction to Android OS, Lecture notes of Computer science

An overview of the Android operating system for mobile devices. Covers the historical development and versions of android.

Typology: Lecture notes

2019/2020

Uploaded on 05/13/2020

ijegwa-acheme
ijegwa-acheme 🇳🇬

1 document

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Introduction to Android OS and more Lecture notes Computer science in PDF only on Docsity!

Android Overview

Android is an open source operating system based on Linux. It was mainly designed for mobile touchscreen devices as smartphones and tablets. Android can also be found in a broad range of devices and hardware such as TVs, smartwatches and cars. Android allows users to create different applications by taking advantage of each of the devices characteristics.

Android was developed since 2003 by Android Inc. and in 2005 was bought by Google. Even though Google leads the project, this is still open source. Android was presented in november 2007 and the first mobile device with Android OS was sold in October 2008.

Android OS Versions & API Level

The first commercial Android version was launched in 2008. Since then there has been a version release from time to time with new functionalities and bug fixes. Each version has a code name which identifies it and the names follow in alphabetical order. In addition, each version has an API Level which identifies it. This number is used for the development of applications and determines their compatibility.

Android Version Distribution

Before developing an application, developers must take in consideration which Android version they are going to use and for which screen types, in order to ensure compatibility. To make this choice, it is recommended to look at statistics of usage and find which are the most used screen sizes and API Level. Google periodically releases these data so that developers can take advantage of it. You can find this information in the following link: https://developer.android.com/about/dashboards/index.html?hl=es.

Android SDK

Android is the most popular mobile operating system in the world. For this reason, Google has developed tools for the development of new apps to make it as easy as possible. Within these tools we can find Android Software Development Kit (SDK). With Android SDK any programmer can code, test and debug Android applications. Android Studio bundle includes Android SDK and integrates some useful tools inside the IDE.

Android SDK versions and API Levels (part 1)

Android SDK versions are identified by a unique number; this is known as the API Level. This is a list with some general characteristics of each version:

Android 2.2 Froyo – API Level 8 (May 2010) In this version, the app execution was improved, also it includes the ability to install apps in external memory, push notifications, wifi-hostpot, adobe flash support, support for numeric and alphanumeric passwords.

Android 2.3 Gingerbread – API Level 9-10 (December 2010) Due to the success of Android, this version supports larger screens dimensions and resolutions, also in this version the User interface was updated, some of the best features where the implementation of the “cut, copy, paste” tools, NFC support, multiple camera support and video chat support using google talk.

Android SDK versions and API Levels (part 2)

Android 3.0 Honeycomb – API Level 11-13 (February 2011) This version of android was launched and optimized for tablets, was include with a new redefine interface build it for larger screens, also this was the first version to support multi core processors, an action bar was included at the top for some quick access.

Android 4.0 Ice Cream Sandwich – API Level 14-15 (October 2011) From this version, it was decided to unify android for tablet and phones, this version includes the

possibility to have software buttons on screen, widgets separations to look like they were apps, screen-shot integrated function, screen lock application shortcuts, facial unlock, Android Beam, Wifi-Direct support, customized launcher and some other features.

Android 4.1 Jelly Bean – API Level 16-18 (July 2012) This Android version was an incremental update improving performance and user interface, some of this features are: Expandable notifications, Multichannel audio, shortcuts and widgets automatically, One-Finger gesture to expand/collapse notifications, Day dream screensaver, multiple user accounts, new download notifications and some other bug fixes.

Android 4.4 KitKat – API Level 19-20 (October 2013) This version was initially known under the name of “Key Lime Pie” and some people was expected to be Android 5, this android version came with Ability for applications to use “immersive mode” (keep the navigation and status bar hidden while maintaining user interaction), Optimized on devices with low ram, in this Android version was the initial release of Android Wear platform for smartwatches.

Android 5.0 Lollipop – API Level 21-22 (November 2014) This version features a redesigned user interface built around a responsive design called “Material design”, in this version Dalvik was replace by ART, Vector drawable where include which scale without losing definition, Searches can be performed within the system settings, smart lock features, Lock screen provides shortcuts to application and notification settings and device protection.

Android Architecture - Software Stack of Android

In the previous tutorial, you learnt what is Android, different versions of Android and what features it supports. Now that you have basic understanding and knowledge about Android, in this tutorial, we will study about Android Software Stack (see the diagram below) which will help you to understand how Android works inside a device.

The Android operating system follows a layered architecture approach. All these layers are responsible for different roles and features that we have discussed below.

Linux Kernel

This layer is the foundation of the Android Platform.

 Contains all low level drivers for various hardware components support.  Android Runtime relies on Linux Kernel for core system services like, o Memory, process management, threading etc. o Network stack o Driver model o Security and more.

Hardware Abstraction Layer (HAL)

 Provides Abstraction between hardware and rest of the software stack.

Android Runtime (ART)

 Designed to run apps in a constrained environment that has limited muscle power in terms of battery, processing and memory.  Since Android 5.0, each app runs in its own process within its own instance of ART virtual machine, which makes process management more crucial.  ART uses DEX files, which is a type of bytecode, specially designed for Android, which helps ART to manage memory more efficiently.  Contains set of core libraries that enables developers to write Android Apps using Java Programming.  Prior to Android 5.0, Dalvik was used as Android runtime.  ART is capable of both Ahead-of-time (AOT) and Just-in-time (JIT) compilation.  It also has a very efficient garbage collection.

Libraries

 Exposed to developers through Android Application Framework.  Contains C/C++ libraries used by components of Android Systems.  Few features include, o SQLite Library used for data storage and light in terms of mobile memory footprints and task execution. o WebKit Library mainly provides Web Browsing engine and a lot more related features. o The surface manager library is responsible for rendering windows and drawing surfaces of various apps on the screen. o The media framework library provides media codecs for audio and video. o The OpenGl (Open Graphics Library) and SGL(Scalable Graphics Library) are the graphics libraries for 3D and 2D rendering, respectively. o The FreeType Library is used for rendering fonts.

Application Framework

 It is a collection of APIs written in Java, which gives developers access to the complete feature set of Android OS.  Developers have full access to the same framework APIs used by the core applications, so that they can enhance more in terms of functionalities of their application.  Enables and simplify the reuse of core components and services, like:

In August 2008, around an year after acquiring Android, Google announced Android Application Market - an online application store for Android Devices. This online store was later on named, Play Store and was made available to the users in October 2008, allowing users to directly download any third party application into their devices. Both paid and free applications are available on the Play Store.

WHAT IS AN APP

What is an app?

In this course we have discussed many things about apps. But, what is an app? App is an abbreviation of application. Apps are software programs that are executed in a computer, smartphone or other device. The most common use for the term app is to denominate software programs that run on smartphones or mobile devices.

As we discussed previously, Apps form part of Android's architecture. In Android, Apps contain compiled Java code, data files and resources files used by each app. All of this comes packed up in a file denominated Android Application Package (APK), with extension .apk. APKs are a variant of Java's JAR format.

Apps are packaged by using the tool AAPT (Android Asset Packaging Tool) which is included in Android SDK. To package an application, Java code is compiled, then, compiled libraries are also included and all the code is optimized so it can be executed in Android RunTime. Also, the package includes files of data and resources such as images, media files, xml, etc. An important file that is also included is the AndroidManifest.xml; we will cover its importance later on.

In Android, APKs are distributed and managed through Google Play mainly but it also supports the installation directly on the device by using .apk files.

Android App Permissions

Android implements the principle of minimal privileges. This means that applications by default only access to components they need to execute the application and nothing else. Applications do not have permissions to access other parts of the system and this creates a safe execution environment.

However, sometimes applications need to access system services or access data from other applications. To achieve this, there are some alternatives and being. The most commonly used are: to ask the user for permission to access data, or use peripherals of the device. For example, any developer must ask permissions to access text messages, camera, gps, etc.

That is why when applications are installed or updated, a window pops up where the user is prompted to authorize the explicit permissions over services or peripherals of the device. If the user refuses to accept these requests, the application is not installed.

Background Services:

Are applications that are executed in the background in a silent manner. They have little or no interaction with the user. This type of applications usually waits for an event to be generated by any hardware peripheral or any message received in order to make an action.

Even though it is possible to create applications that are silently executed in background and are invisible for the user, it is preferred that the user can control these processes. Services is another topic that will be reviewed more in depth later in the course.

Example:

Intermittent Applications:

Intermittent applications are a combination of the two previous types. They are applications that have a graphical interface where the user can interact with the app, but also listens in the background for events. An example of this type of applications are chat applications, where the user can receive messages even though the app is closed and can also open the app and read all of the messages received. When developing these types of applications, developers must consider all of the application states. This is very important because it can prevent undesired behaviors such as displaying app notifications when the app is running.

Examples:

Widgets:

They are applications that have a small graphic interface within the user’s home screen and are also known as mini-apps. The user can interact with the widget without the need of opening the app. Widgets are commonly used to display information to the user, for example: weather, battery percentage, news, emails, etc. Widgets can be static or dynamic. A widget can also perform actions to control hardware peripherals. A user can move widgets through the launcher’s home pages or change their size if the widget supports it.

Examples:

When a user starts the application, he or she is presented with the main activity. From this activity, the user can initiate other activities and they will be displayed on screen. For example: In an SMS application, the main activity is a list of messages and another activity is writing a new message.

Each activity is independent. For this reason, an activity may be initiated from a different application if it is allowed.

In order to implement an Activity, a class must inherit from the class Activity. This will be explained later on.

Services

Services are used to perform prolonged tasks or tasks for remote processes in the background. Services do not have a graphical interface. Services are very important because they can execute processes while the user is performing other tasks. For instance: Services can be used to upload images to the internet.

A service is implemented as a subclass of Services. Services is another topic that will be reviewed more in detail later in the course.

Broadcast receivers

Broadcast Receivers are used to perform specific tasks when a system wide broadcast is detected. Some of these broadcasts are originated by the system. For example: incoming calls and sms, low battery, network state changed, image captured, etc. Apps can also register their own broadcast messages so other apps can listen and respond to them. Broadcast Receivers also lack of a graphical interface and are generally used to display alerts or notifications to the users. Broadcast receivers are different to services in several ways but mostly because broadcast receivers wait for an event in order to run.

To implement a broadcast receiver, developers must inherit from the class BroadcastReceiver.

Content Providers

Content Providers manage access to a structured set of data. This data can be stored on the file system, in SQLite database or another persistent storage location. The main characteristic of the content providers is that they can share this data between applications. Data can be queried or modified through a content provider. In addition, Content providers provide an encapsulated access to data. For example, the contact list is held in a content provider and for this reason, external applications such as Whatsapp or the sms app can access contacts. A Content Provider is implemented as a subclass of ContentProvider and must implement standard set of APIs that enable other apps to perform transactions. This will be explained later on.

Additional elements of an application

Besides the components in an Android Application, there are other complementary elements for an application. These elements are:

Intents

Intents are asynchronous messages that send activities, services and broadcast receivers. The most common use of intents is to move from one activity to another, for example, when a user clicks a button to launch the next activity. It is possible to pass information, including objects, from one activity to another. Intents can also open other Android applications. Because this is a very important part of Android, we will review it more in depth later in the course.