This set of slides introduces the basics of the Android development framework and mobile development in general. First, a brief overview on the history of mobile development is introduced. Then, the architecture of the Android platform is discussed, commenting on the role and functionalities of each architectural layer.
1. Introduction to Android 6.x
Ilio Catallo, Eleonora Ciceri – Politecnico di Milano
ilio.catallo@polimi.it, eleonora.ciceri@polimi.it
2. What is Android?
¤ Android is an open-source software stack that includes
the operating system, middleware and built-in mobile
applications
¤ Based on a modified version of Linux
¤ The full source code can be downloaded
¤ Vendors add their own proprietary extensions to
differentiate their products from others
¤ Example: Samsung’s terminals are shipped with a custom
user interface called TouchWiz
2
3. Mobile development in a nutshell
2001 20092007
Prehistory
Developers
code in low-
level languages
(e.g., C++) and
need to
understand the
specific HW they
are coding for
Middle age
Symbian provides
proprietary APIs that
encourage the
development of rich
mobile apps
• Difficult to work with
different HW
implementations (e.g.,
GPS)
• Java code can be
executed in a JME, at
the price of restricted
access to the HW
Renaissance
iPhone and Windows Phone provide a
richer development environment for
mobile applications
• Built on a proprietary operating system
• Explicit application approval
mechanism
Modern time
Android offers a
unified approach to
application
development meant
to operate on any
compatible device
3
4. AndroidArchitecture
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine 4
5. Android architecture:
Kernel
¤ The Linux kernel handles low-level
hardware interactions, including drivers
and memory management
¤ The Android kernel is actually a branch of
the standard Linux kernel
¤ Several features have been added or
modified to tackle the mobile usage
scenario
¤ The most significant feature is a custom
power managementsolution (i.e.,
wakelocks) designed so that the
default state of the device is sleep
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
5
6. Android architecture:
Android Run Time
¤ Android applications are:
¤ written in Java as the programming
language
¤ executed by means of a custom virtual
machine (VM) named Android Runtime
(ART)
¤ Every app runs in its own ART instance
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
6
7. Android architecture:
Android Run Time
¤ Android runtime pros:
¤ ART creates an abstraction layer that
ensures developers not to worry about
specific HW implementations
¤ ART is designed so that multiple
instances run efficiently on a single
mobile device
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
7
8. Android architecture:
Core Libraries
¤ The core Android libraries provide most of
the JSE environment
¤ Example: java.util.*
¤ Further libraries are added to the Java
standard libraries to provide specific
functionalities
¤ Example: user interface framework
android.view.*
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
8
9. Android architecture:
Libraries
¤ The libraries contain all the code (C/C++
libraries) that provides the main features of
the Android OS
¤ Examples: WebKit, SSL, OpenGL
¤ The libraries are all internal
implementations of Android
¤ They are not directly exposed to the
published Android API
¤ The application framework layer
accesses these libraries through the ART
VM
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
9
10. Android architecture:
Application Framework
¤ The application framework exposes the
Android capabilities that developers can
use in their applications
¤ Examples: window manager, location
manager, databases, telephony,
sensors
¤ The application framework defines the set
of APIs made available by the Android OS
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
10
11. Android architecture:
Application
¤ This layer comprises the applications that
ship with the Android devices
¤ Examples: SMS application, music
player
¤ Moreover, in many cases Android devices
also ship with some proprietary Google
mobile apps
¤ Examples: Google Play Store, Gmail
email client
Meier c01.indd V1 - 11/24/2011 Page 16
16 x CHAPTER 1 HELLO, ANDROID
Application Layer
Application Framework
Native Apps
(Contacts, Maps, Browser, etc.)
Graphics
(OpenGL, SGL, FreeType)
Third-Party Apps
Location-Based
Services
Telephony
Bluetooth / NFC /
Wi-Fi Direct
Notifications
Media
libc
SSL & Webkit Android Libraries
Android Run Time
SQLite
Views
Resource
Manager
Surface
Manager
Dalvik
Virtual Machine
Memory
Management
Process
Management
Power
Management
Hardware Drivers
(USB, Display, Bluetooth, etc.)
Content
Providers
Window
Manager
Activity
Manager
Package
Manager
Developer Apps
Libraries
Linux Kernel
FIGURE 1-1
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik VM. Rather than using a traditional Java VM such
as Java ME, Android uses its own custom VM designed to ensure that multiple instances run effi-
ciently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, includ-
ing security, threading, and process and memory management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS. Although you can do this, in most cases
there’s no reason you should need to.
If the speed and efficiency of C/C++ is required for your application, Android provides a native
development kit (NDK). The NDK is designed to enable you to create C++ libraries using the libc
and libm libraries, along with native access to OpenGL.
c01.indd 16c01.indd 16 4/11/2012 10:03:27 A4/11/2012 10:03:27 A
www.it-ebooks.info
11