1 GettingToKnowAndroid

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Part 2: Mobile Application Development

Prepared By Gaddisa Olani (Ph.D.) 2021 1


Lesson 2: Getting to Know Android

By Gaddisa Olani (Ph.D.)


Learning Objectives
After completing this lesson, you should be able to describe:

• The design goals for the Android™ operating system

• History of Android OS

• Components of Android OS

• The cooperation of the Android operating system with Linux for memory, device,
processor, and network management

Prepared By Gaddisa
3 Olani (Ph.D.) 2021
• Linux based OS that is optimized for Mobile
Devices

• Open Source

• Maintained by Google and owned by OHA

Prepared By Gaddisa Olani (Ph.D.) 2021 4


OHA (Open Handset Alliance)
A group of 84 technology and mobile companies who have come together to accelerate
innovation in mobile and offer consumers a richer, less expensive, and better mobile
experience.

Prepared By Gaddisa Olani (Ph.D.) 2021 5


About Android
❑ Android operating system
▪ Developed by Andy Rubin and associates

▪ Mr. Rubin joined Google in 2005 when it acquired his


start-up, Android, for $50 million.

▪ Designed to power the Sidekick cell phone

❑ Initial challenges
➢ Phone battery power limitations

➢ Small CPU

➢ Limited memory space

Prepared By Gaddisa
6 Olani (Ph.D.) 2021
Brief History (cont’d.)

• The very first Android smartphone launched


in 2008 (The T-Mobile G1/HTC Dream)

• Since then, Android extended to reach entire mobile smartphones and tablets
generations
• “There are now 2.5 billion active Android devices”
Google report (2019)

Prepared By Gaddisa
7 Olani (Ph.D.) 2021
Android Logo

➢ Developed by Irina Blok at Google.


➢ Inspired by restroom logo, 2014

Prepared By Gaddisa
8 Olani (Ph.D.) 2021
Android Version

Prepared By Gaddisa
9 Olani (Ph.D.) 2021
Android OS Structure

Prepared By Gaddisa Olani (Ph.D.) 2021 10


Android OS Structure: Applications

• You will find all the Android application at the top layer. You will write
your application to be installed on this layer only. Examples of such
applications are Contacts Books, Browser, Games etc.

• Android provides a set of core applications:


✓Email Client, SMS Program, Calendar, Maps
✓Browser, Contacts, Etc

Prepared By Gaddisa Olani (Ph.D.) 2021 11


Android OS Structure: Application Framework

Application Framework
• Enable and simplify the reuse of components in the form of Java classes.
• Developers have full access to the same framework APIs used by the core applications.

Examples:
• Content Providers that enable applications to access data from other applications (such as Contacts), or to share
their own data
• A Notification Manager that enables all applications to display custom alerts in the status bar
• An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack

Prepared By Gaddisa Olani (Ph.D.) 2021 12


Android OS Structure: Libraries

• Including a set of C/C++ libraries used by components of the


Android system Exposed to developers through the Android
application framework

Prepared By Gaddisa Olani (Ph.D.) 2021 13


More Libraries

• SSL

• SQLite

• WebKit (and LibWebCore for embeddable webpages)

• Audio Manager

• Media Framework
o MediaPlayer

Prepared By Gaddisa Olani (Ph.D.) 2021 14


Graphics Libraries

• Scalable Graphics Library (SGL- for 2D)

• OpenGL for Embedded Devices (for 3D)

• FreeType (vector and bitmap fonts)

• Surface Manager
o Composes 2D and 3D windows, widgets, apps, toolbars
and more using Surface Flinger
o Uses Binder IPC to get buffers from apps to put into
frames

Prepared By Gaddisa Olani (Ph.D.) 2021 15


Android OS Structure: Android Runtime

Core Libraries
✓Providing most of the functionality available in the core libraries of the Java
language
✓APIs
➢Data Structures
➢Utilities
➢File Access
➢Network Access
➢Etc
Prepared By Gaddisa Olani (Ph.D.) 2021 16
Android OS Structure: Android Runtime

➢ It also provides a key component called Dalvik Virtual


Machine which is a kind of Java Virtual Machine specially
designed and optimized for Android.

➢ Every Android application runs in its own process, with its own
instance of the Dalvik virtual machine.

➢ Dalvik has been written so that a device can run multiple VMs
efficiently.

➢ The Dalvik VM executes files in the Dalvik Executable (.dex) format


Prepared By Gaddisa Olani (Ph.D.) 2021 17
which is optimized for minimal memory footprint.
Android OS Structure: Android Runtime

⚫ Provide an abstraction layer between the H/W and the rest of


the S/W stack
⚫ Relying on Linux Kernel 2.6 for core system services such as:

✓ Memory and Process Management


✓ Network Stack
✓ Driver Model
✓ Security

Prepared By Gaddisa Olani (Ph.D.) 2021 18


Memory management and power management

➢ Since Android devices are usually battery-powered, Android is designed to manage memory (RAM)
to keep power consumption at a minimum, in contrast to desktop operating systems which generally
assume they are connected to unlimited mains electricity.

➢ When an Android app is no longer in use, the system will automatically suspend it in memory - while
the app is still technically "open," suspended apps consume no resources (e.g. battery power or
processing power) and sit idly in the background until needed again.

➢ This has the dual benefit of increasing the general responsiveness of Android devices, since apps
don't need to be closed and reopened from scratch each time, but also ensuring background apps
don't waste power needlessly.

➢ Android manages the apps stored in memory automatically: when memory is low, the system will
begin killing apps and processes that have been inactive for a while, in reverse order since they
were last used (i.e. oldest first). This process is designed to be invisible to the user, such that
users do not need to manage memory or the killing of apps themselves.

Prepared By Gaddisa Olani (Ph.D.) 2021 19


Cont….

• Resources utilized only as needed

• Sleep-like state when dormant

• Open app remains resident in main memory


• Least recently used (LRU) algorithm for tracking

• Low memory killer (LMK) frees memory when memory


becomes scarce

Prepared By Gaddisa
20 Olani (Ph.D.) 2021
Design concerns

• Apps are designed to


accommodate numerous devices,
often without user help

• Question: How to support


different screen size and
Orientation?
Screen requirements:
❑ Design considerations: screen size, screen density, orientation, and resolution

Prepared By Gaddisa
21 Olani (Ph.D.) 2021
Device Management (cont’d.)

• Android’s four screen sizes categories


• Extra-large screens: at least 960dp x 720dp
• Large screens: at least 640dp x 480dp
• Normal screens: at least 470dp x 320dp
• Small screens: at least 426dp x 320dp

Prepared By Gaddisa
22 Olani (Ph.D.) 2021
Device Management (cont’d.)

Two screens of the same size may have a different number of pixels

Ultimate app designer’s goal


Give every user the impression that the app was designed
specifically for the user’s device
Prepared By Gaddisa
23 Olani (Ph.D.) 2021
Security Management in Android

• Multiple tiered security structure


• Protects user’s data and system’s resources (including networking
resources)

• Provides application isolation: prevents intentional damage or inadvertent


vulnerabilities from a malicious or poorly designed app
• Frequent update to Android OS

Prepared By Gaddisa
24 Olani (Ph.D.) 2021
Security Management in Android cont…
• User-defined permissions
• Individual controls device security

• Resource access must be explicitly given to the app

• 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.

Prepared By Gaddisa
25 Olani (Ph.D.) 2021
Diagram that shows the high-level workflow for using
permissions on Android.

Install-time permissions, runtime permissions, and special permissions.


Prepared By Gaddisa Olani (Ph.D.) 2021 26
How to use it in practice: AndroidManifest.xml

Prepared By Gaddisa Olani (Ph.D.) 2021 27


Rooting/JailBreaking
• Rooting is the process of gaining root (a.k.a.
administrator or super user) to a smartphone.

• By default, all smartphones only give user’s


“guest” privileges.

• This is for both safety reasons and to prevent


users from doing things developers/carriers
don’t like (i.e. getting rid of their bloatware).

Prepared By Gaddisa Olani (Ph.D.) 2021 28


The End!

Prepared By Gaddisa Olani (Ph.D.) 2021 29


Homework 1
Without changing user experience:
• how you can design your app to support different pixel densities?
• how you can design your app to support different screen size?
• how you can design your app to support different screen orientation?

Prepared By Gaddisa Olani (Ph.D.) 2021 30


Homework 2
1) How are iOS and Android similar? How are they different?
2) In terms of security, which one do you prefer and why?
3) Both iOS and Android start nearly at the same time, what makes the
second one more popular?
4) Pattern is one of the mechanism to ensure security in android OS.
List all the possible ways to break pattern locks in android?
5) Find out any vulnerability/flaws in the app you are currently using?
6) Find out the app that asks you for unnecessary permission?

Prepared By Gaddisa Olani (Ph.D.) 2021 31


Homework 3

Fin out :
• Flaws in Android OS itself
• Flaws in phone software/firmware
• Vulnerabilities within downloaded apps that you are using

Prepared By Gaddisa Olani (Ph.D.) 2021 32


Trrrrrrr466er6te3

Prepared By Gaddisa Olani (Ph.D.) 2021 33

You might also like