Module 1: Foundations of Mobile Application Development

4. LECTURE 2: MOBILE OPERATING SYSTEMS

4.2. THE LINUX KERNEL

THE LINUX KERNEL

Positioned at the bottom of the Android software stack, the Linux Kernel provides a level of abstraction between the device hardware and the upper layers of the Android software stack. Based on Linux version 2.6, the kernel provides pre-emptive multitasking, low-level core system services such as memory, process and power management in addition to providing a network stack and device drivers for hardware such as the device display, Wi-Fi and audio.

ANDROID RUNTIME – ART

When an Android app is built within Android Studio it is compiled into an intermediate byte-code format (DEX format). When the application is subsequently loaded onto the device, the Android Runtime (ART) uses a process referred to as Ahead-of-Time (AOT) compilation to translate the byte-code down to the native instructions required by the device processor. This format is known as Executable and Linkable Format (ELF).

Each time the application is subsequently launched, the ELF executable version is run, resulting in faster application performance and improved battery life.

This is the third section of the architecture and available on the second layer from the bottom. This section provides a key component called Dalvik Virtual Machine (DVM) which is a kind of Java Virtual Machine specially designed and optimized for Android. The Dalvik VM makes use of Linux core features like memory management and multi- threading (Multithreading refers to a programming technique where multiple threads of execution exist within a single application. Multithreading is just one way to achieve concurrency in Java. Concurrency can also be achieved through other means, such as multiprocessing, asynchronous programming, or event-driven programming.), which is intrinsic in the Java language. The Dalvik VM enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine.

The Android runtime also provides a set of core libraries which enable Android application developers to write Android applications using standard Java programming language.

ANDROID LIBRARIES

In addition to a set of standard Java development libraries (providing support for such general-purpose tasks as string handling, networking and file manipulation), the Android development environment also includes the Android Libraries. These are a set of Java-based libraries that are specific to Android development.
 android.app − Provides access to the application model and is the cornerstone of all
Android applications.
 android.content − Facilitates content access, publishing and messaging between
applications and application components.
 android.database − Used to access data published by content providers and includes
SQLite database management classes.
 android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
 android.os − Provides applications with access to standard operating system services
including messages, system services and inter-process communication.
 android.text − Used to render and manipulate text on a device display.
 android.view − The fundamental building blocks of application user interfaces.
 android.widget − A rich collection of pre-built user interface components such as
buttons, labels, list views, layout managers, radio buttons etc.
 android.webkit − A set of classes intended to allow web-browsing capabilities to be
built into applications.
Having covered the Java-based core libraries in the Android runtime, it is now time to turn
our attention to the C/C++ based libraries contained in this layer of the Android software
stack.

C/C++ LIBRARIES

The Android runtime core libraries are Java-based and provide the primary APIs for developers writing Android applications. It is important to note, however, that the core libraries do not perform much of the actual work and are, in fact, essentially Java ―wrappers‖ around a set of C/C++ based libraries.

APPLICATION FRAMEWORK

The Application Framework is a set of services that collectively form the environment in which Android applications run and are managed. This framework implements the concept that Android applications are constructed from reusable, interchangeable and replaceable components. This concept is taken a step further in that an application is also able to publish its capabilities along with any corresponding data so that they can be found and reused by other applications.

The Android framework includes the following key services −

•         Activity Manager − Controls all aspects of the application lifecycle and activity stack.

•         Content Providers − Allows applications to publish and share data with other

•         applications.

•         Resource Manager − Provides access to non-code embedded resources such as

•         strings, color settings and user interface layouts.

•         Notifications Manager − Allows applications to display alerts and notifications to the

•         user.

•         View System − An extensible set of views used to create application user interfaces.

Capacities (What Android OS can do):

•         Application Management: Install, run, and manage apps. This is the core functionality that allows users to utilize various apps for different purposes.

•         Memory Management: Efficiently allocates and manages memory for apps and background processes to ensure smooth device operation. This capacity ensures efficient use of device resources for multitasking and app usage.

•         Security: Provides a multi-layered security approach, including app permissions, sandboxing, Google Play Protect scans, and security updates. These capacities work together to safeguard devices from potential threats.

•         User Interface (UI) Customization (core level): Offers the basic building blocks for customizing the UI, including a home screen, app drawer, notification bar, and the ability to change wallpapers. This capacity lays the foundation for further user customization through features.

•         Hardware Communication: Acts as a bridge between the software and hardware components, enabling functionalities like camera usage, sensor data access, and display control. This capacity allows the software to interact with the physical components of the device.

•         Networking: Connects devices to cellular networks and Wi-Fi for internet access, data transfer, and online services. This capacity provides the foundation for internet connectivity and online functionality.

•         Power Management: Optimizes battery usage by controlling background processes, adjusting screen brightness, and offering battery saver modes. This capacity helps conserve battery life and extend device usage time.

Features (How users interact with Android):

•         App Management (user-facing): Installing apps from the Google Play Store or other sources (with security considerations for sideloading). This feature allows users to actively choose and download apps they want to use.

•         Home Screen and App Drawer Customization: Users can personalize the home screen with widgets, shortcuts, and launchers for a more convenient and visually appealing experience. This feature builds upon the core UI customization capacity to provide user control over the home screen layout and functionality.

•         Notifications: Alerting users about new messages, updates, and events. Users can customize notification settings to manage how they receive alerts. This feature translates the core notification capacity into a user-friendly way to receive important information.

•         Widgets: Miniature apps on the home screen providing quick access to information and functionalities. This feature leverages the core app management capability to offer a more convenient way to interact with specific app functionalities.

•         Multitasking: Switching between apps and keeping multiple apps running in the background. This feature builds upon the core memory management capacity to allow users to work with multiple apps simultaneously.

•         Google Assistant: A built-in virtual assistant for answering questions, setting reminders, and controlling devices. This user-facing feature utilizes the core functionalities of the OS to perform actions and access information based on user needs.