1 of 26

UNIT 1

INTRODUCTION

2 of 26

History of Android.

  • Android Inc. was founded in Palo Alto, California, in October 2003 by Andy Rubin, Rich Miner, Nick Sears, and Chris White. Rubin described the Android project as having "tremendous potential in developing smarter mobile devices that are more aware of its owner's location and preferences". The early intentions of the company were to develop an advanced operating system for digital cameras, and this was the basis of its pitch to investors in April 2004

3 of 26

Android Hardware

  • The main hardware platform for Android is ARM (the ARMv7 and ARMv8-A architectures), with x86 and x86-64 architectures also officially supported in later versions of Android. The unofficial Android-x86 project provided support for x86 architectures ahead of the official support. Since 2012, Android devices with Intel processors began to appear, including phones and tablets. While gaining support for 64-bit platforms, Android was first made to run on 64-bit x86 and then on ARM64. Since Android 5.0 "Lollipop", 64-bit variants of all platforms are supported in addition to the 32-bit variants. An unofficial experimental port of the operating system to the RISC-V architecture was released in 2021.

4 of 26

Android Software

  • The main components of android architecture are following:-

  • Applications
  • Application Framework
  • Android Runtime
  • Platform Libraries
  • Linux Kernel

5 of 26

Android Arch.

  • Android architecture contains different number of components to support any android device needs. Android software contains an open-source Linux Kernel having collection of number of C/C++ libraries which are exposed through an application framework services.

  • Among all the components Linux Kernel provides main functionality of operating system functions to smartphones and Dalvik Virtual Machine (DVM) provide platform for running an android application.

6 of 26

Applications

  • Applications is the top layer of android architecture. The

pre-installed applications like home, contacts, camera, gallery etc and third-party applications downloaded from the play store like chat applications, games etc. will be installed on this layer only.

  • It runs within the Android run time with the help of the classes and services provided by the application framework.

7 of 26

Application framework –

  • Application Framework provides several important classes which are used to create an Android application. It provides a generic abstraction for hardware access and also helps in managing the user interface with application resources. Generally, it provides the services with the help of which we can create a particular class and make that class helpful for the Applications creation.

  • It includes different types of services activity manager, notification manager, view system, package manager etc. which are helpful for the development of our application according to the prerequisite.

8 of 26

Application runtime –

  • Android Runtime environment is one of the most important part of Android. It contains components like core libraries and the Dalvik virtual machine(DVM). Mainly, it provides the base for the application framework and powers our application with the help of the core libraries.

  • Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual machine and specially designed and optimized for android to ensure that a device can run multiple instances efficiently. It depends on the layer Linux kernel for threading and low-level memory management. The core libraries enable us to implement android applications using the standard JAVA or Kotlin programming languages.

9 of 26

Platform libraries –

  • The Platform Libraries includes various C/C++ core libraries and Java based libraries such as Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android development.

  • Media library provides support to play and record an audio and video formats.
  • Surface manager responsible for managing access to the display subsystem.
  • SGL and OpenGL both cross-language, cross-platform application program interface (API) are used for 2D and 3D computer graphics.
  • SQLite provides database support and FreeType provides font support.
  • Web-Kit This open source web browser engine provides all the functionality to display web content and to simplify page loading.
  • SSL (Secure Sockets Layer) is security technology to establish an encrypted link between a web server and a web browser.

10 of 26

Linux Kernel –

  • Linux Kernel is heart of the android architecture. It manages all the available drivers such as display drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which are required during the runtime.
  • The Linux Kernel will provide an abstraction layer between the device hardware and the other components of android architecture. It is responsible for management of memory, power, devices etc.
  • The features of Linux kernel are:
  • Security: The Linux kernel handles the security between the application and the system.
  • Memory Management: It efficiently handles the memory management thereby providing the freedom to develop our apps.
  • Process Management: It manages the process well, allocates resources to processes whenever they need them.
  • Network Stack: It effectively handles the network communication.
  • Driver Model: It ensures that the application works properly on the device and hardware manufacturers responsible for building their drivers into the Linux build.

11 of 26

Android Security Model

  • Three Party Consent Model
  • In order to abstract

unnecessary details, we will frame the Android security model as a three-party consent model.

  • The security model is based on

the consent of the following

parties:

  • Operating System
  • Application
  • End-User

12 of 26

Android Permission model

  • App permissions help support user privacy by protecting access to the following:
  • Restricted data, such as system state and a user's contact information.
  • Restricted actions, such as connecting to a paired device and recording audio.

Figure 1. Diagram that shows the high-level workflow for using permissions on Android.

13 of 26

Types of permissions

  • Android categorizes permissions into different types, including

install-time permissions, runtime permissions, and special permissions. Each permission's type indicates the scope of restricted data that your app can access, and the scope of restricted actions that your app can perform, when the system grants your app that permission.

  • Install-time permissions
  • Normal permissions
  • Signature permission
  • Runtime permissions
  • Special permissions

14 of 26

Install-time permissions

  • Install-time permissions give your app limited access to restricted data, and they allow your app to perform restricted actions that minimally affect the system or other apps. When you declare install-time permissions in your app, the system automatically grants your app the permissions when the user installs your app.

15 of 26

Normal permissions

  • These permissions allow access to data and actions that extend beyond your app's sandbox. However, the data and actions present very little risk to the user's privacy, and the operation of other apps.
  • Signature permissions
  • If the app declares a signature permission that another app has defined, and if the two apps are signed by the same certificate, then the system grants the permission to the first app at install time. Otherwise, that first app cannot be granted the permission.

16 of 26

Runtime permissions

  • Runtime permissions, also known as dangerous permissions, give your app additional access to restricted data, and they allow your app to perform restricted actions that more substantially affect the system and other apps. Therefore, you need to request runtime permissions in your app before you can access the restricted data or perform restricted actions. When your app requests a runtime permission, the system presents a runtime permission prompt, as shown in Figure 3.

Figure 3. The system permission prompt that appears when your app requests a runtime permission.

17 of 26

Special permissions

  • Special permissions correspond to particular app operations. Only the platform and OEMs can define special permissions. Additionally, the platform and OEMs usually define special permissions when they want to protect access to particularly powerful actions, such as drawing over other apps.

  • The Special app access page in system settings contains a set of user-toggleable operations. Many of these operations are implemented as special permissions.

18 of 26

Application Sandbox

  • The Android platform takes advantage of the Linux user-based protection to identify and isolate app resources. This isolates apps from each other and protects apps and the system from malicious apps. To do this, Android assigns a unique user ID (UID) to each Android application and runs it in its own process.

  • Android uses the UID to set up a kernel-level Application Sandbox. The kernel enforces security between apps and the system at the process level through standard Linux facilities such as user and group IDs that are assigned to apps. By default, apps can't interact with each other and have limited access to the OS. If app A tries to do something malicious, such as read application B's data or dial the phone without permission, it's prevented from doing so because it doesn't have the appropriate default user privileges.

19 of 26

Sign your app

  • Android requires that all APKs be digitally signed with a certificate before they are installed on a device or updated. When releasing using Android App Bundles, you need to sign your app bundle with an upload key before uploading it to the Play Console and Play App Signing takes care of the rest. For apps distributing using APKs on the Play Store (created before August 2021) or on other stores, you must manually sign your APKs for upload.

  • The following is a high-level overview of the steps you might need to take to sign and publish a new app to Google Play:
  • Generate an upload key and keystore
  • Sign your app with your upload key
  • Configure Play App Signing
  • Upload your app to Google Play
  • Prepare & roll out release of your app

For more info: https://developer.android.com/studio/publish/app-signing

20 of 26

Encryption

  • In cryptography, encryption is the process of encoding information. This process converts the original representation of the information, known as plaintext, into an alternative form known as ciphertext. Ideally, only authorized parties can decipher a ciphertext back to plaintext and access the original information.

21 of 26

Why is data encryption necessary?

  • Privacy: Encryption ensures that no one can read communications or data at rest except the intended recipient or the rightful data owner. This prevents attackers, ad networks, Internet service providers, and in some cases governments from intercepting and reading sensitive data.

  • Security: Encryption helps prevent data breaches, whether the data is in transit or at rest. If a corporate device is lost or stolen and its hard drive is properly encrypted, the data on that device will still be secure. Similarly, encrypted communications enable the communicating parties to exchange sensitive data without leaking the data.

  • Data integrity: Encryption also helps prevent malicious behavior such as on-path attacks. When data is transmitted across the Internet, encryption (along with other integrity protections) ensures that what the recipient receives has not been tampered with on the way.

  • Authentication: Public key encryption, among other things, can be used to establish that a website's owner owns the private key listed in the website's TLS certificate. This allows users of the website to be sure that they are connected to the real website (see What is public key encryption? to learn more).

  • Regulations: For all these reasons, many industry and government regulations require companies that handle user data to keep that data encrypted. Examples of regulatory and compliance standards that require encryption include HIPAA, PCI-DSS, and the GDPR.

22 of 26

What are some common encryption algorithms?

  • Commonly used symmetric encryption algorithms include:

  • AES
  • 3-DES
  • SNOW
  • Commonly used asymmetric encryption algorithms include:

  • RSA
  • Elliptic curve cryptography

23 of 26

What are the different types of encryption?

  • The two main kinds of encryption are symmetric encryption and asymmetric encryption. Asymmetric encryption is also known as public key encryption.

  • In symmetric encryption, there is only one key, and all communicating parties use the same (secret) key for both encryption and decryption. In asymmetric, or public key, encryption, there are two keys: one key is used for encryption, and a different key is used for decryption. The decryption key is kept private (hence the "private key" name), while the encryption key is shared publicly, for anyone to use (hence the "public key" name). Asymmetric encryption is a foundational technology for TLS (often called SSL).

24 of 26

Rooting (Android)

  • Rooting is the process of allowing users of the Android mobile operating system to attain privileged control (known as root access) over various Android subsystems. As Android is based on a modified version of the Linux kernel, rooting an Android device gives similar access to administrative (superuser) permissions as on Linux or any other Unix-like operating system such as FreeBSD or macOS.

  • Rooting is often performed with the goal of overcoming limitations that carriers and hardware manufacturers put on some devices. Thus, rooting gives the ability (or permission) to alter or replace system applications and settings, run specialized applications ("apps") that require administrator-level permissions or perform other operations that are otherwise inaccessible to a normal Android user. On some devices, rooting can also facilitate the complete removal and replacement of the device's operating system, usually with a more recent release of its current operating system.

  • https://en.wikipedia.org/wiki/Rooting_(Android)

25 of 26

What Are APK Files?

  • Android applications are distributed as APK files. APK files are basically ZIP files similar to the JAR files used to package Java libraries. An APK file contains app code in the DEX file format, native libraries, resources, assets, etc. It must be digitally signed with a certificate to allow installation on an Android device.

26 of 26

APK Package Contents

  • An APK file is a compressed package that contains the following files and directories:

  • assets — directory with application assets.
  • res — directory with all resources that are not compiled into resources.arsc. These are all resources except the files in res/values. All XML resources are converted to binary

XML, and all .png files are optimized (crunched) to save space and improve runtime performance when inflating these files.

  • lib — directory with compiled native libraries used by your app. Contains multiple

directories — one for each supported CPU architecture (ABI).

  • META-INF — directory with APK metadata, such as its signature.
  • AndroidManifest.xml — application manifest in the binary XML file format. This contains

application metadata — for example, its name, version, permissions, etc.

  • classes.dex — file with app code in the Dex file format. There can be additional .dex

files (named classes2.dex, etc.) when the application uses multidex.

  • resources.arsc — file with precompiled resources, such as strings, colors, or styles.