Upload
yong-heui-cho
View
4.862
Download
2
Embed Size (px)
Citation preview
Android –Application Framework
Yong Heui Cho @ Mokwon University
Some of slides are referred to:[1] Nitin Ramchandani, Android OS, slideshare.[2] Luca Bedogni & Marco Di Felice, Programming with Android: System Architecture, SlidePlayer.
2
Smart Device Structure
2. Android Studio Tutorial
3. Basic Android OS
4. Android – Application Framework5. Android – Message
3
4
Libraries (I)• Media Libraries - based on PacketVideo's OpenCORE;
the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
• LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
5
• SGL (Skia GL) - the underlying 2D graphics engine
• 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer
• FreeType - bitmap and vector font rendering
• SQLite - a powerful and lightweight relational database engine available to all applications
Libraries (II)
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
6
• Set of standardized APIs the developer will have to implement
• Available for all the components a manufacturer can integrate on its Android platform
Defines the interface that Android requires hardware “drivers” to implement.
HW Abstraction Layer
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
7
• Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language
Core Libraries
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
8
Dalvik Virtual Machine
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
Before Android 5.0 Lollipop• Designed for embedded environment • Supports multiple VM processes per device.• Highly CPU-optimized byte code interpreter.• Uses run time memory very efficiently.• Run optimized file format (.dex) Dalvik bytecode.• Java .class/.jar are converted to .dex at build time.
99
Dalvik Java Virtual Machine
Java Source Code
Java Byte Code
Java Virtual Machine
(JVM)
Java Source Code
Java Byte Code
Dalvik Byte Code
Dalvik Virtual Machine
(DVM)
JavaCompiler
JavaCompiler
DexCompiler
Stack-basedbyte-code
Register-basedbyte-code
Java Standard Edition
□ Courtesy to L. Bedogni & M. Di Felice, Programming with Android, SlidePlayer.
10
Android Runtime (ART)
• After Android 5.0 Lollipop• ART introduces the use of ahead-
of-time (AOT) compilation by compiling entire applications into native machine code upon their installation.– Faster execution of applications– Improved battery time– Improved memory allocation and
garbage collection
11
Comparison of ART & DVM
12
Application Framework (I)
• 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
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
13
• A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser
• Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data
• A Resource Manager providing access to non-code resources such as localized strings, graphics, and layout files
Application Framework (II)
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
14
1.Activities2.Intent 3.Services4.Content Providers
Important App Components
15
• Activity is an User Interface Screen.• An application may have two or more activities to handle
different phases of program.
For e.g. opening page, menu page, etc.• Activity is responsible for saving its own state so that
it can be restored later as part of the application life cycle.
Activities
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.single activity multiple activities
16
• Intent is a mechanism for describing a specific action such as pick a photo.
• Basically we register an Activity to handle an Intent.
Intents
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
17
• A content provider is a set of data wrapped up in a custom API to read and write it. This is the best way to share global data between applications.
• Google provide content provider for contacts.
Content Provider
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
18
• A service is a task that runs in the background without the user’s direct interaction, similar to a Unix daemon.
For e.g. we can have Music player program playing in background even if we are browsing other programs.
Services
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
19
• Can combined 2D and 3D surfaces• Can use OpenGL ES and 2D hardware accelerator for its
compositions
Provides a system-wide surface “composer” to render all the surfaces in a frame buffer
Surface Manager
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
20
• Handle several types of devices (headphone, ear piece…)
• Redirects audio stream to the specified output
Audio Manager
□ Courtesy to Nitin Ramchandani, Android OS, slideshare.
21
Fragment• A piece of an application's UI or
behavior that can be placed in an Activity
22
Android App Design
GUI Definition
Events Management
Application Data Management
Background Operations
User Notifications
APPLICATION DESIGN:
□ Courtesy to L. Bedogni & M. Di Felice, Programming with Android, SlidePlayer.