Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Android Framework
Instructor: Alberto Panizzo, CTO at Amarula Solutions BV A company focused on OSS within Embedded solutions.
a.y. 2011/2012
Alberto Panizzo
Goal
Give a comprehensive introduction to Android, oriented towards application development. Not an Android porting course No rooting techniques Enable you to develop proficiently applications in Android: You'll know what to look for and where, and you'll learn the basic best practices Your code won't cause a headache to the next developer who takes a look at it
Alberto Panizzo
Main topics
Application's building blocks Multitasking and shared resources Data management Security Best practices X-ray view of the Camera stack
Alberto Panizzo
Reference books
Tons of books on Android application development... Suggested: LearningAndroid,Marko Gargenta O'REILLY But we'll not follow it completely...
Alberto Panizzo
Course organisation
3 credits, 30 hours, frontal lessons + lab When: Tuesday: 14:30-16:30 Wednesday: 9:00-12:00 Where: All in room 27A Web: http://retis.sssup.it/~panizzo/android Mail: panizzo@retis.sssup.it Subscribe to the mailinglist!
Alberto Panizzo
Prerequisites
Object Oriented Programming Autonomy with Java Autonomy with Linux ~ Personal laptop
Alberto Panizzo
Final test
Present a Project: o Develop an Application o Analysis of a Framework Subsystem o Analysis and proposal of a solution to open problems (?) (Boot time reduction, etc.) I want you to be trained, not educated on Android Details will be available in the website
Alberto Panizzo
Q&A?
Any Questions?
Alberto Panizzo
Lecture 1
A glance at the past. What is Android and what devices it address Android Stack and key features Other ways to code in Android
Alberto Panizzo
lzo_do_compress(Android History)
2005: Google buys Andy Rubin's Android Inc Was working on location-aware mobile devices. [1] 2007: Announcement of the Open Handset Alliance Aimed to:"offer consumers a richer, less expensive, and better mobile experience" [2] 2008: Source code made available, Android SDK 1.0 is released, HTC G1 is sold 2009: Evolution of the platform (Cupcake, Donut, Eclair) and more than 20 devices running Android. 2011: 100 M of Activations world wide (Honeycomb, Icecream Sandwich)
Alberto Panizzo
Google's Motivations
Google's business is Advertisement Before Android/iPhone there was WAP..... If every cellphone owners can go on the Internet and use google.com in a standard way... Google income increases exponentially without changing anything in its product wallet. Whatever was Android/iPhone/Blackberry Google was pointing at standard web browsing all over the world [3] Now Google makes money through GoogleAPI fees + AndroidMarket
Alberto Panizzo
Lecture 1
A glance at the past. What is Android and what devices it address Android Stack and key features Other ways to code in Android
Alberto Panizzo
What is Android?
It is a modern, comprehensive, portable and open mobile stack. Fit modern mobile device resources in terms of: o Memory / CPU power / hardware helpers Support all the modern mobile devices peripherals: o Camera / Sensors / GPS / Mass storage .. Highly connected: o 3G/3G/4G networks / Wifi / Bluetooth / NFC
Alberto Panizzo
Device ecosystem
Alberto Panizzo
Devices specs
Minimum: RAM: 128MB - 1GB (Run hardly on 64MB) CPU: 500MHz - 1.2GHz Screen / Touch panel (Can manage mouse input..) Then: Audio I/O Hardware accelerations (2D 3D Graphics/AV Codecs) Connectivity (Wifi/Bluetooth/Modem) Sensors (Camera/Proximity/Gyroscope/Accelerometer/GPS) ...
Alberto Panizzo
Alberto Panizzo
Alberto Panizzo
A note on versions
[4]
http://developer.android.com/resources/dashboard/platform-versions.html
Alberto Panizzo
Lecture 1
A glance at the past. What is Android and what devices it address Android Stack and key features Other ways to code in Android
Alberto Panizzo
Architecture
Alberto Panizzo
Based on Linux
Google says: "It offers consolidated model for managing Process / Memory / Security" But also: Open Source, Ported on all common architectures, Portable, Stable, Support all kind of peripheral, Big and spread community of developers, Lot of companies involved in its development ... More?
Alberto Panizzo
Based on Linux
How to fit more the mobile devices lack of resources? New Power management layer New Low Memory Killer New Shared memory manager (ASHMem) New Physical contiguous memory allocator (pmem) New behaviors: New IPC mechanism: Binder Increased the tethering capability New usb device drivers (adb / mass_storage ...) ..
Alberto Panizzo
Alberto Panizzo
Alberto Panizzo
Alberto Panizzo
Memory management
Android Shared Memory ASHMem: Allocate shared memory between processes as SHM Maintain a user ref count If all users free the shared object, the shared memory will be automatically released. Process memory allocator PMEM: Allocate large physical contiguous memory regions Used mostly for driving 2D/3D hardware engines
Alberto Panizzo
Alberto Panizzo
Alberto Panizzo
Architecture
Alberto Panizzo
Alberto Panizzo
Architecture
Alberto Panizzo
Private libc
Bionic is a custom implementation of C libraries focusing on: size and speed Does not support C++ exception model Support only a subset of pthread API Implements Android specific functionalities: o log API o give programmatic access to systemproperties Released under BSD license: not persistent and not propagative
Alberto Panizzo
Architecture
Alberto Panizzo
Userspace libraries
Core libraries: SurfaceFlinger: video compositor manager AudioFlinger: audio compositor manager ... External libraries: Webkit: web render engine used by Safari, Chrome.. SQLite: light, full-featured SQL engine Media libraries: Packet Video OpenCore / Stagefright OpenGL ESx: 2D/3D graphics library ALSALib: Open audio library ...
Alberto Panizzo
Architecture
Alberto Panizzo
Alberto Panizzo
Architecture
Alberto Panizzo
Application Framework
SetofManagers/Serviceswhichexposeall thefunctionalitiesavailabletotheapplications. From core Managers as: ActivityManager, WindowManager, PackageManager, NotificationManager.. implementing the runtime ecosystem. To system Services as: TelephonyService, LocationService, SensorService, WifiService ... implementing functionalities available to the applications. WrittenprimarilyinJava,withthesamerulesasanormal application
Alberto Panizzo
Lecture 1
A glance at the past. What is Android and what devices it address Android Stack and key features Other ways to code in Android
Alberto Panizzo
Alberto Panizzo
Alberto Panizzo
Interesting graph
[9]
Alberto Panizzo
Links of interest
[1]http://www.businessweek.com/technology/content/aug2005/tc20050817_0949_tc024.htm [2]http://www.openhandsetalliance.com/ [3]http://www.itbusinessedge.com/cm/blogs/bentley/%20more-on-g1-and-googles-goals-withandroid/?cs=15048 [4]http://developer.android.com/resources/dashboard/platform-versions.html [5]http://lwn.net/Articles/460644/ [6]http://elinux.org/Android_Binder [7]https://sites.google.com/site/io/dalvik-vm-internals [8]http://www.google.com/events/io/2009/sessions/HowToCodeThee.html [9]http://www.businessinsider.com/the-one-chart-you-need-to-see-to-understand-mobile2011-11?utm_source= %23frankguillen&utm_medium=twitter&utm_campaign=FrankGuillen+Buzz
Alberto Panizzo