Android Project Report for OS Students, Study notes of Operating Systems

Android Project Report for BSCS Students

Typology: Study notes

2018/2019

Uploaded on 03/03/2019

muhammad-annas-zulfiqar
muhammad-annas-zulfiqar 🇵🇰

3

(1)

1 document

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
REPORT
ANDROID OPERATING SYSTEM
Muhammad Annas Zulqar |
CSC-17S-084
Atizaz Nawaz | CSC-17S-070
Bilal Raza | CSC-17S-087
Aan Ahmed Dahar | CSC-17S-075
Submitted to:
Ma’am Saima Sipy
INTRODUCTION
Android working framework is a standout amongst the most generally utilized portable Operating System
nowadays. Android versatile working framework depends on the Linux part and is created by Google.
Android working framework is principally intended for cell phones and tablets. Since Android is an open
source it has turned into the quickest developing versatile working framework. Because of its open source
it has turned out to be most loved for some purchasers and consumers. Also, programming engineers can
Report Android Operating System
1 | Page
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Android Project Report for OS Students and more Study notes Operating Systems in PDF only on Docsity!

REPORT

ANDROID OPERATING SYSTEM

Muhammad Annas Zulfiqar |

CSC-17S-

Atizaz Nawaz | CSC-17S-

Bilal Raza | CSC-17S-

Affan Ahmed Dahar | CSC-17S-

Submitted to:

Ma’am Saima Sipy

INTRODUCTION

Android working framework is a standout amongst the most generally utilized portable Operating System nowadays. Android versatile working framework depends on the Linux part and is created by Google. Android working framework is principally intended for cell phones and tablets. Since Android is an open source it has turned into the quickest developing versatile working framework. Because of its open source it has turned out to be most loved for some purchasers and consumers. Also, programming engineers can

without much of a stretch change and add upgraded include in it to meet the most recent prerequisites of the versatile innovation. Android clients download more than 1.5 billion applications and amusements from Google Play every month. Because of Its Powerful improvement structure clients also, programming engineers can make their own applications for extensive variety of gadgets. A portion of the key highlights of Android working framework are: Application Frame work, Dalvik virtual machine, Integrated browser, Optimized Graphics, SQLite, Media Support, GSM Technology, Bluetooth, Edge, 3G, Wi-Fi, Camera and GPS echo help the developers for better software development Android provides Android Software development kit (SDK).

Unlike other mobile operating systems, Android is written in Java and is run on virtual machines. Android features the Dalvik Runtime Machine and Android Runtime in newer versions which executes its own bytecode. Dalvik is a core component and all Android user applications and the application framework are written in Java and executed in Dalvik.

The android is a powerful operating system and it supports large number of applications in Smartphones. These applications are more comfortable and advanced for the users. The hardware that supports android software is based on ARM architecture platform. The android is an open source operating system means that it’s free and any one can use it. The android has got millions of apps available that can help you managing your life one or other way and it is available low cost in market at that reason android is very popular.

Android became the world’s leading smartphone platform at the end of 2010. For the first quarter of 2012, Android had a 59% smartphone market share worldwide. At the half of 2012, there were 400 million devices activated and 1 million activations per day. Analysts point to the advantage to Android of being a multi-channel, multi-carrier OS.

AOSP – Android Open Source Project:

The platform was created by Android Inc. which was bought by Google and released as the Android Open Source Project (AOSP) in 2007. According to Google: “ The goal of the Android Open Source Project is to create a successful real-world product that improves the mobile experience for end users.” Currently, the Android Open Source Project (AOSP) is governing the Android maintenance and development cycle

Versions:

One of most interesting feature of the Android is that it has the ability to update itself. Android has been upgraded often since the original release of Astro. List of Android version names are: Cupcake, Donut, Éclair, Froyo, Gingerbread, Honeycomb, Ice-cream Sandwich, Jellybean etc. Latest Android version is Pie 9.

ANDROID ARCHETECTURE

Android consists of a kernel based on the Linux kernel, with middleware, libraries and APIs written in C and application software running on an application framework which includes Java-compatible libraries based on Apache Harmony. Android uses the Dalvik virtual machine with just-in-time compilation to run Dalvik dex-code (Dalvik Executable), which is usually translated from Java bytecode.

The main hardware platform for Android is the ARM architecture. There is support for x86 from the Android x86 project and Google TV uses a special x86 version of Android.

Android software stack is subdivided into five parts: Applications, Application Framework, Libraries, Android Runtime, and the Linux Kernel.

Application Layers:

It is the most upper layer in android architecture. All the applications like camera, Google maps, browser, SMS, calendars, contacts are native applications. These applications work with end user with the help of application framework to operate.

Shell:

The shell is the user space of the operating system. It acts as the intermediary between the user and the operating system. The Android shell is divided into the following parts

Application Framework:

Android applications which are developing, this layer contain needed classes and services. Developers can reuse and extend the components already present in API. In this layer, there are managers which enable the application for accessing data. These are as follows

Activity manager: It manages the lifecycle of applications. It enables proper management of all the activities. All the activities are controlled by activity manager.

Resource manager: It provides access to non-code resources such as graphics etc. Notification manager: It enables all applications to display custom alerts in status bar.

Location manager: It fires alerts when user enters or leaves a specified geographical location. Package manager: It is used to retrieve the data about installed packages on device.

Window manager : It is used to create views and layouts.

Telephony manager: It is used to handle settings of network connection and all information about services on device.

Android Runtime:

In this section, all the android applications are executed. Android has its own virtual machine i.e. DVM (Dalvik Virtual Machine), which is used to execute the android application. With this DVK, users can execute multiple applications at the same time.

Libraries:

Android has its own libraries, which is written in C/C++. These libraries cannot be accessed directly. With the help of application framework, we can access these libraries. There are many libraries like web libraries to access web browsers, libraries for android and video formats etc.

1. Foreground Process: This is the app currently in use by the user. Other processes can be
considered foreground processes if they’re interacting with the process that’s currently in
the foreground. There are a few foreground processes at any given time
2. Visible Process: This is a process that isn’t in the foreground but is still affecting what is
seen on the screen. For example, a foreground process maybe a dialog but the visible
process is the app in the background of the screen which triggered the dialog.
3. Service Process: This is a process that isn’t tied to any app on screen but is still doing
something in the background such as playing music or downloading files
4. Background Process: These are processes that are currently not visible to the user and
therefore do not have any impact on the user experience. These are apps that are paused
and are kept in memory for quick access in the future. They do not use valuable CPU
time and other resources apart from memory
5. Empty Process: This does not contain any app data anymore. They are kept around for
caching purposes to speed launch later but maybe killed by the system if necessary.

Usually only background and empty processes are killed by the system and so the user experience stays unaffected. Android only kills apps when the memory usage goes too high but usually Android does not kill apps

Processes can contain multiple threads such as in Linux based systems. Most Android applications implement thread to separate the UI from input handling and I/O operations or long running calculations.

Applications & Tasks:

Android applications are made up of processes and their included threads. Tasks are a series of activities of possibly multiple applications. A task is basically a history of a user’s actions. E.g. When a user reads their mail and opens a link which uses the browser application. In this case, the task is made up of two applications (mail and browser) and many activities. The importance of the task concept is that it allows users to navigate backwards like popping elements of a stack.

Application Internals:

The structure of an Android applications is based on four different components which are Activity, Service, Broadcast Receiver and Content Provider. An application doesn’t necessarily have all these components, but it should at least have an Activity in order to present a graphical user interface.

Services and broadcast receivers allow applications to perform jobs in the background. Services usually run for a long time, but broadcast receivers can be triggered by events and run for a short time.

Application Life Cycles:

An activity is a single screen of an application. It contains visual elements that allow user interaction. An application contains many activities. The state of an android applications processes is determined by the state of the application’s components, such as its activities. As the application components alter their states the underlying type of the process is changed. All activities are subclasses from android-app. Activity and their life cycle is controlled by the On… () functions.

As an application starts, the following functions are called sequentially OnCreate(), OnStart() and OnResume(). OnCreate() is called only one in the lifetime of a process but OnStart() and OnResume() are called more often. If an activity loses focus then the OnPause() function is called. If the activity is no longer visible then the OnStop() function is called. Before deleting the activity OnDestroy() function is called which end the activity lifetime The following describes the functions in detail:

  • OnCreate(): The initial functions that initialized the activity.
  • OnStart(): The process type changes to visible and the activity is about to become visible to the user
  • OnResume(): The process is is set to foreground. The application gets focus and can get user input.
  • OnPause(): When the device goes to sleep or the application loses focus the process is set to visible. From here, the process may be resumed or stopped
  • OnStop(): The activity is not visible and the process type is set to background and the application can be killed at any time
  • OnDestroy(): This method is called right before the system kills the process and the application deletes the activity

FILE MANAGEMENT

Besides flash memory file systems, Android devices typically support the following media-based file systems:

  • EXT2 / EXT3 / EXT4 - The EXTended file system is the standard Linux file system, with EXT being the current version. Since 2010, EXT4 is often used in place of YAFFS2 or JFFS2 as the file system for internal flash memory on Android devices.
  • MSDOS - The MSDOS driver supports the FAT12, FAT16 and FAT32 file systems.
  • VFAT - The VFAT is not actually a file system, but an extension to the FAT12, FAT16, and FAT32 file systems. Thus, you will always see the VFAT kernel module in conjunction with the MSDOS module. External SD Cards are commonly formatted using VFAT.

Pseudo file systems

VFS also supports pseudo file systems, which are not media based. The Linux kernel supports several pseudo file systems which are:

  • cgroup - The cgroup (control group) pseudo file system provides a means to access, and define, various kernel parameters. While cgroup is the pseudo file system, there are several different process control groups. If your Adroid device supports process control groups, you will find a list of the groups in the file /proc/cgroups. Android uses cgroups for acct (user accounting), and cpuctl (CPU control).
  • rootfs - This file system serves as the mount point for the root file system ("/").
  • procfs - The procfs file system is normally mounted on the /proc directory and reflects several kernel data structures. The operations on these files read live kernel data. The number directories reflect the process IDs (the thread group leader process ID) for each running task. The /proc/ filesystems file generates a list of the currently registered file systems. File systems followed by NODEV are pseudo file systems, as there is no related device. The /proc/sys directory contains kernel parameters, some of which are tunable.
  • sysfs - The device model for the kernel is an object-oriented structure that reflects the devices known by the kernel through the sysfs file system, which is normally mounted on the / sys directory.
  • tmpfs - The tmpfs file system is often mounted on the /dev directory. Since it is a pseudo file system, any data in the /dev directory is lost when the device is rebooted.
  • Each app process is forked from an existing process called Zygote. The Zygote process starts when the system boots and loads common framework code and resources (such as activity themes). To start a new app process, the system forks the Zygote process then loads and runs the app's code in the new process. This approach allows most of the RAM pages allocated for framework code and resources to be shared across all app processes.
  • Most static data is mmapped into a process. This technique allows data to be shared between processes, and allows it to be paged out when needed. Example static data include: Dalvik code (by placing it in a pre-linked .odex file for direct mmapping), app resources (by designing the resource table to be a structure that can be mmapped and by aligning the zip entries of the APK), and traditional project elements like native code in .so files.
  • In many places, Android shares the same dynamic RAM across processes using explicitly allocated shared memory regions (either with ashmem or gralloc). For example, window surfaces use shared memory between the app and screen compositor, and cursor buffers use shared memory between the content provider and client.

Due to the extensive use of shared memory, determining how much memory your app is using requires care.

Switch App:

When users switch between apps, Android keeps apps that are not foreground—that is, not visible to the user or running a foreground service like music playback— in a least-recently used (LRU) cache. For example, when a user first launches an app, a process is created for it; but when the user leaves the app, that process does not quit. The system keeps the process cached. If the user later returns to the app, the system reuses the process, thereby making the app switching faster.

If your app has a cached process and it retains memory that it currently does not need, then your app— even while the user is not using it— affects the system's overall performance. As the system runs low on memory, it kills processes in the LRU cache beginning with the process least recently used. The system also accounts for processes that hold onto the most memory and can terminate them to free up RAM.

SCHEDULING

The key concept present in any operating system which allows the system to support multitasking, multiprocessing, etc. is Task Scheduling. Task Scheduling is the core which refers to the way the different processes can share the common CPU. Scheduler and dispatcher are the softwares which help to carry out this assignment. Android operating system uses O (1) scheduling algorithm as it is based on Linux Kernel 2.6. Therefore, the scheduler is names as Completely Fair Scheduler as the processes can schedule within a constant amount of time, regardless of how many processes are running on the operating system.

Schedulers in Android:

An I/O scheduler, in simple terms, is a system process that controls the way the cpu processes and accepts data. It also controls the way memory is accessed and manipulated.

For android here are some I/O schedulers:

-Anticipatory Prioritizes read operations over write. It anticipates synchronous read operations.

-BFQ : Instead of time slices allocation by CFQ, BFQ assigns budgets. Disk is granted to an active process until it’s budget (number of sectors) expires. BFQ assigns high budgets to non-read tasks. Budget assigned to a process varies over time as a function of it’s behavior. It is a very accurate scheduler.

-CFQ : Completely Fair Queuing scheduler maintains a scalable per-process I/O queue and attempts to distribute the available I/O bandwidth equally among all I/O requests. Each per-process queue contains synchronous requests from processes. Time slice allocated for each queue depends on the priority of the ‘parent’ process. Gives all round performance.

-Deadline : Goal is to minimize I/O latency or starvation of a request. The same is achieved by round robin policy to be fair among multiple I/O requests. Five queues are aggressively used to reorder incoming requests. It is a real time scheduler.

-Noop : Inserts all the incoming I/O requests to a First In First Out queue and implements request merging.

-SIO : Simple I/O scheduler aims to keep minimum overhead to achieve low latency to serve I/O requests. No priority queues concepts, but only basic merging. Sio is a mix between noop & deadline. No reordering or sorting of requests occurs.

-V(R) : Unlike other schedulers, synchronous and asynchronous requests are not treated separately, instead a deadline is imposed for fairness. The next request to be served is based on it’s distance from last request. Highly unstable and unreliable.

SECURITY

Android has security features built into the operating system that significantly reduce the frequency and impact of application security issues. The system is designed so you can typically build user’s apps with default system and file permissions and avoid difficult decisions about security. Some of the core security features that help you build secure apps include:

The Android Application Sandbox, which isolates user’s app data and code execution from other apps.

An application framework with robust implementations of common security functionality such as cryptography, permissions, and secure IPC. Technologies like ASLR, NX, ProPolice, safe_iop, 14 OpenBSD dlmalloc, OpenBSD calloc, and Linux mmap_min_addr to mitigate risks associated with common memory management errors.

An encrypted file system that can be enabled to protect data on lost or stolen devices.

User-granted permissions to restrict access to system features and user data.

Application-defined permissions to control application data on a per-app basis.

Nevertheless, it is important that you be familiar with the Android security best practices in this document. Following these practices as general coding habits will reduce the likelihood of inadvertently introducing security issues that adversely affect your users.

Storing Data

The most common security concern for an application on Android is whether the data that you save on the device is accessible to other apps. There are three fundamental ways to save data on the device: Using internal storage by default, files that you create on internal storage are accessible only to user’s app. This protection is implemented by Android and is enough for most applications.

NETWORKING

Networking on Android is not significantly different from other Linux environments. The key consideration is making sure that appropriate protocols are used for sensitive data, such as HttpsURLConnection for secure web traffic. We prefer use of HTTPS over HTTP anywhere that HTTPS is supported on the server, because mobile devices frequently connect on networks that are not secured, such as public Wi-Fi hotspots. Authenticated, encrypted socket-level communication can be easily implemented using the SSLSocket class. Given the frequency with which Android devices connect to unsecured wireless networks using Wi-Fi, the use of secure networking is strongly encouraged for all applications that communicate over the network. We have seen some applications use localhost network ports for handling sensitive IPC. We discourage this approach since these interfaces are accessible by other applications on the device. Instead, on should use an Android IPC mechanism where authentication is possible such as with a Service. (Even worse than using loopback is to bind to INADDR_ANY since then user’s application may receive requests from anywhere.) Also, one common issue that warrants repeating is to make sure that you do not trust data downloaded from HTTP or other insecure protocols. This includes validation of input in WebView and any responses to intents issued against HTTP.

CONCLUSION

Android is a much more diverse operating system than iOS and Windows Phone Mobile. Android has grown rapidly over the past 4 years becoming the most used smartphone operating system in the world. It's because Android doesn't release 1 phone from 1 company with 1 new OS every year, but countless phones from numerous companies, adding their own twist, throughout the year, developing gradually day- by-day. Android's ability to customize is unparalleled compared to Apple's and Microsoft's software allowing the user to change and customize nearly every aspect of Android which most iPhone and Windows 7 users wouldn't dream possible. We cannot say that Android is better or worse than one OS but is unique and incomparable to other mobile operating systems.

REFERENCES