introduction to android · 2014-05-26 · introduction to android lecture 1 android native...
Post on 19-Jun-2020
13 Views
Preview:
TRANSCRIPT
Introduction to AndroidLecture 1
Android Native Development Kit
9 February 2014
NDK Introduction to Android, Lecture 1 1/30
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 2/30
Outline
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 3/30
Rules and Grading
I Petre Eftime & Laura Gheorghe
I Course and lab: 17:00 - 20:00, Tuesdays
I Project: 20:00 - 21:00, TuesdaysI Grading
I 10% lecture and lab activityI 10% assignmentI 40% projectI 40% final examI 10% bonus for feedback
NDK Introduction to Android, Lecture 1 4/30
Outline
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 5/30
Android Architecture
Source: http://commons.wikimedia.org
NDK Introduction to Android, Lecture 1 6/30
Android Architecture
I Linux kernelI AOSP
I RuntimeI LibrariesI Application framework
I Applications
NDK Introduction to Android, Lecture 1 7/30
Linux kernel
I Patches on top of mainline Linux
I Android Mainlining Project
I Wakelocks (also added to Linux 3.5)
I Low-Memory Killer, Binder, Alarm, Logger, etc.
I Only suspend to memory
NDK Introduction to Android, Lecture 1 8/30
Android Runtime
I Dalvik Virtual Machine (Java VM)
I Runs Dalvik-specific byte-code generated from Java-basedapps, system components
I Apache Harmony project (implementation of Java libraries)
I Designed for embedded systems (slow CPU, small RAM, noswap, battery)
I Works with .dex files instead of .jar filesI Dalvik Executable FormatI .dex is 50% smaller than corresponding .jar
NDK Introduction to Android, Lecture 1 9/30
Android Runtime
. . .
Class1.java
Class2.java
ClassN.java
. . .
Class1.classconstant pool
class definitiondata
Javacompiler
Class2.classconstant pool
class definitiondata
ClassN.classconstant pool
class definitiondata
classes.dexheader
constant poolClass1 definitionClass2 definition
...ClassN definition
data
dx
NDK Introduction to Android, Lecture 1 10/30
Libraries
I bioniC (libc)I Much smaller than glibc
I sqliteI Managing SQL databases
I OpenGL ESI Standard software interface for 3D processing hardware
I WebKitI Display web pagesI Android, Apple iOS, BlackBerry, Tizen
I SSLI Securing the communication over Internet
NDK Introduction to Android, Lecture 1 11/30
Application Framework
I ServicesI Managers
I TelephonyI LocationI ActivityI PackageI Notification
I Content Providers
NDK Introduction to Android, Lecture 1 12/30
Application Framework
Application process System processes
Binder Service 1
Thread
Binder Service N
Thread. . .
Application APIRPCstub
Native application libraries
JNI
NDK Introduction to Android, Lecture 1 13/30
Outline
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 14/30
Application components
I User interactionI Activities
I Background functionalityI ServicesI Broadcast ReceiversI Content Providers
NDK Introduction to Android, Lecture 1 15/30
Activity
I User interface
I Similar to a window from window-based GUIs
I Cannot be minimized, maximized, resized
I Uses the whole visual area
I User interacts with a single activity at a timeI Activities stack
I Activities launch other activitiesI Back button for returning to the previous activityI No forward button
I Start activities with intents
NDK Introduction to Android, Lecture 1 16/30
Activity Lifecycle
Source: http://developer.android.com
NDK Introduction to Android, Lecture 1 17/30
Service
I Background threadI Runs in the same process as the application
I Can be configured to run in another process
I Provide services to the other applications
I Communication through the Binder
NDK Introduction to Android, Lecture 1 18/30
Broadcast Receiver
I Receive broadcast announcementsI Low batteryI RebootI Application state changes
I Can receive global or local broadcastsI Choose which broadcasts to receive
I Intent filters
I Intents
I Active only when receiving a broadcast
NDK Introduction to Android, Lecture 1 19/30
Content Provider
I Store and share application data
I Required for sharing data
I Relational database
I URI for identifying the provider and the table
I Content Resolver uses the URI to send a query to the provider
I Active only when responding to a request
NDK Introduction to Android, Lecture 1 20/30
Outline
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 21/30
Intents
I Send message, determine action executionI Purpose
I Start activities, start or bind servicesI Delivering broadcast messages to receivers
I Dispatched by the Android systemI Includes action and data
I ACTION DIAL content://contacts/people/1
I TypesI Explicit: directed towards a specific receiverI Implicit: a receiver which can resolve the action
NDK Introduction to Android, Lecture 1 22/30
Binder
I Lightweight RPC
I Remote object invocation
I In process and interprocess
I Transmit parcels of data
I Synchronous calls (blocking)
NDK Introduction to Android, Lecture 1 23/30
Outline
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 24/30
SDK Tools
I Android SDK ManagerI Download SDK packages
I AVD ManagerI Manages Android Virtual Devices (for emulator)
I EmulatorI Virtual mobile devices running on a PC
I Dalvik Debug Monitor Server (ddms)I Debugging toolI Port forwarding, screen capture, call and SMS spoofing,
location spoofing, etc.
NDK Introduction to Android, Lecture 1 25/30
SDK Tools
I Android Debug Bridge (adb)I Communication between the development tools and (virtual)
device
I dxI Generates the classes.dex file from several .class files
I Android Interface Definition Language (aidl)I To allow clients from another application to access your serviceI Generates interfaces and stubs that are used by the Binder
I Android Asset Packaging Tool (aapt)I Create, update and view Zip-compatible archives (zip, apk, jar)I Compile resources into binary assets (XML files, etc.)
I dexdumpI Disassembler toolI Obtain the Dalvik bytecode from classes.dex
NDK Introduction to Android, Lecture 1 26/30
Android Debug Bridge
I Three componentsI Client: runs on the development machineI Server: background process on the development machineI Daemon: background process on the (virtual) device
I Copy files
I Install applications
I Debug
I Shell on the (virtual) device
NDK Introduction to Android, Lecture 1 27/30
Emulator
I QEMU
I Screen, Keyboard, Network, Audio, GPS, RadioI Can be acceleration through virtualization
I x86 System ImageI Intel Hardware Accelerated Execution Manager (HAXM) on
WindowsI KVM on Linux
I GPU accelerated
NDK Introduction to Android, Lecture 1 28/30
Outline
Rules and Grading
Android Architecture
Application components
IPC
Tools
Keywords
NDK Introduction to Android, Lecture 1 29/30
Keywords
I Linux kernel
I AOSP
I Android Runtime
I Libraries
I Activities
I Services
I Broadcast Receivers
I Content Providers
I Intents
I Binders
I ADB
I Emulator
NDK Introduction to Android, Lecture 1 30/30
top related