Vladimir Kotov Android Internals and Toolchain 1I. Android Internals
Vladimir Kotov Android Internals and Toolchain 2Android platformAndroid is a Linux-based operating system and asoftware st...
Vladimir Kotov Android Internals and Toolchain 3Android platformDeveloped by Google*2005 – purchased Android Inc2007 – est...
Vladimir Kotov Android Internals and Toolchain 4Android platformMain hardware platform for Android is ARM● support for x86...
Vladimir Kotov Android Internals and Toolchain 5Android Anatomy
Vladimir Kotov Android Internals and Toolchain 6Android Linux KernelAndroid kernel based on Linux 2.6 and 3.x (Android 4.0...
Vladimir Kotov Android Internals and Toolchain 7Android Linux KernelAndroid “is not Linux”● Users never see Linux sub syst...
Vladimir Kotov Android Internals and Toolchain 8Android Linux KernelAndroid patch of kernel enhancements● Power Management...
Vladimir Kotov Android Internals and Toolchain 9Android Native Libraries
Vladimir Kotov Android Internals and Toolchain 10Android Native Libraries● Bionic Libc● Fast and small, license-friendly, ...
Vladimir Kotov Android Internals and Toolchain 11Android Runtime
Vladimir Kotov Android Internals and Toolchain 12Android RuntimeOn Android you develop in Java... but Android does not run...
Vladimir Kotov Android Internals and Toolchain 13Android RuntimeConstraintsDesigned for 64M RAMNo swapPhone tech v. Deskto...
Vladimir Kotov Android Internals and Toolchain 14Android RuntimeDalvik Virtual Machine● Custom VM optimized for mobile dev...
Vladimir Kotov Android Internals and Toolchain 15Android RuntimeAndroid Java = Java language + Dalvik + Apache HarmonyAndr...
Vladimir Kotov Android Internals and Toolchain 16Android RuntimeZygote spawns VM processes● Already has core libraries loa...
Vladimir Kotov Android Internals and Toolchain 17Android Runtime
Vladimir Kotov Android Internals and Toolchain 18Android Runtime
Vladimir Kotov Android Internals and Toolchain 19Android Runtime● Core libraries● Core APIs for Java language (IO, Structu...
Vladimir Kotov Android Internals and Toolchain 20II. Android Developer Toolchain
Vladimir Kotov Android Internals and Toolchain 21Android offerThe first open* and comprehensive platform for mobiledevices...
Vladimir Kotov Android Internals and Toolchain 22Android offer● Apps are equivalent parts of the phoneusing the same API● ...
Vladimir Kotov Android Internals and Toolchain 23Android offer● Full multimedia hardware control, medialibraries● APIs for...
Vladimir Kotov Android Internals and Toolchain 24Android Developer Challenge● A developer challenge Google hold everyyear ...
Vladimir Kotov Android Internals and Toolchain 25Accessory Development Kit● RI for building accessoriesfor Android● Source...
Install AndroidWhat do we need for Android?• Android SDK• ADT (Android Developer Tools)• AVD (Android Virtual Device)
Vladimir Kotov Android Internals and Toolchain 27Android SDK● Android APIsDeveloper access to the Android stack● Developme...
Vladimir Kotov Android Internals and Toolchain 28Android SDK● http://developer.android.com/sdk (Linux, Mac OS X, Windows)●...
Vladimir Kotov Android Internals and Toolchain 29Android SDKSDK Manager.exe (Windows) v. tools/android (Mac, Linux)
Vladimir Kotov Android Internals and Toolchain 30Android SDKSDK packages<sdk>/tools/ Tools for debugging and testing, util...
Vladimir Kotov Android Internals and Toolchain 31Android Development Tools● Eclipse plugin● Professional-grade development...
Vladimir Kotov Android Internals and Toolchain 32Android Development Tools● Tooling● Wizard for creating new project● WYSW...
Vladimir Kotov Android Internals and Toolchain 33ADT Installation Options● ADT Bundleprovides everything you need to start...
Vladimir Kotov Android Internals and Toolchain 34Android Emulator● QEMU-based● Same image as on device● Same toolchain to ...
Vladimir Kotov Android Internals and Toolchain 35Android Virtual Device● Android Virtual Device (AVD) is an emulator confi...
Vladimir Kotov Android Internals and Toolchain 36Develop on Hardware Devices● Use any Android hardware device● Deploy your...
Vladimir Kotov Android Internals and Toolchain 37Dalvik Debug Monitor Server(DDMS)● Works with both the emulator and a con...
Vladimir Kotov Android Internals and Toolchain 38DEMO
Vladimir Kotov Android Internals and Toolchain 39Usefull SDK utilitiesAndroid Debug Bridge(adb)Command line tool to commun...
Vladimir Kotov Android Internals and Toolchain 40Native development kit (NDK)● Tools to build and compile your native code...
Vladimir Kotov Android Internals and Toolchain 41Application creation cycle
Vladimir Kotov Android Internals and Toolchain 42Hello, world ... finallyDEMO
Upcoming SlideShare
Loading in...5
×

Android Internals and Toolchain

3,954

Published on

Published in: Technology
0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,954
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
10
Embeds 0
No embeds

No notes for slide

Transcript of "Android Internals and Toolchain"

  1. 1. Vladimir Kotov Android Internals and Toolchain 1I. Android Internals
  2. 2. Vladimir Kotov Android Internals and Toolchain 2Android platformAndroid is a Linux-based operating system and asoftware stack designed for mobile devicesKey ApplicationsHome, Phone, BrowserApplication FrameworkJava layer system servicesMiddlewaresLibraries, Dalvik VMOperating systemLinux kernel
  3. 3. Vladimir Kotov Android Internals and Toolchain 3Android platformDeveloped by Google*2005 – purchased Android Inc2007 – established Open Handset Alliance (OHA)2012 – Oracle v. Google on Java APICompatibilityDefinitionDocumentto certify devicesSDK + toolsto createapplications
  4. 4. Vladimir Kotov Android Internals and Toolchain 4Android platformMain hardware platform for Android is ARM● support for x86 from the Android x86 projectAdvanced RISC Machine● 7.9 billion shipped in 2011– 95% smartphones– 90% hard disk drives● Reduced instruction set computing (RISC)● Lower costs, Less heat, Less power usage● Reduced complexity and simpler design● Good interfacing to many devices
  5. 5. Vladimir Kotov Android Internals and Toolchain 5Android Anatomy
  6. 6. Vladimir Kotov Android Internals and Toolchain 6Android Linux KernelAndroid kernel based on Linux 2.6 and 3.x (Android 4.0)● Why Linux?● Great memory and process management● Permissions-based security model● Proven driver model● Support for shared libraries● Open source
  7. 7. Vladimir Kotov Android Internals and Toolchain 7Android Linux KernelAndroid “is not Linux”● Users never see Linux sub system● Not the full set of standard Linux utilities● August 2011, Linus Torvalds - "eventually Android andLinux would come back to a common kernel, but it willprobably not be for four to five years"
  8. 8. Vladimir Kotov Android Internals and Toolchain 8Android Linux KernelAndroid patch of kernel enhancements● Power Management● Ashmem● Binder IPC● Low Memory KillerDecember 2011 - Android MainliningProject to put some Android drivers,patches and features back into theLinux kernel
  9. 9. Vladimir Kotov Android Internals and Toolchain 9Android Native Libraries
  10. 10. Vladimir Kotov Android Internals and Toolchain 10Android Native Libraries● Bionic Libc● Fast and small, license-friendly, optimized for mobile● Function Libraries● WebKit, Media Framework, SQLite● Native Servers● Surface Manager, Audio Manager● Hardware Abstraction Libraries● WiFi, Bluetooth, GPS, Camera
  11. 11. Vladimir Kotov Android Internals and Toolchain 11Android Runtime
  12. 12. Vladimir Kotov Android Internals and Toolchain 12Android RuntimeOn Android you develop in Java... but Android does not run Java Bytecode !
  13. 13. Vladimir Kotov Android Internals and Toolchain 13Android RuntimeConstraintsDesigned for 64M RAMNo swapPhone tech v. DesktopCPU specificOracle JVM problemsMemory HogSlow startupIP licensing restrictionsCustom Virtual Machine. Why?
  14. 14. Vladimir Kotov Android Internals and Toolchain 14Android RuntimeDalvik Virtual Machine● Custom VM optimized for mobile devices● Register-based JVM● More efficient and compact● Use memory efficiently● Dalvik Executable Code (.dex)– 30% fewer instructions– 35% fewer code units● Trace JIT compiler (since 2.2)
  15. 15. Vladimir Kotov Android Internals and Toolchain 15Android RuntimeAndroid Java = Java language + Dalvik + Apache HarmonyAndroid Java API = Java SE – AWT/Swing + Android APISun-Java = Java language + JVM + JDK
  16. 16. Vladimir Kotov Android Internals and Toolchain 16Android RuntimeZygote spawns VM processes● Already has core libraries loaded● When an app is launched, zygote is forked● Fork core libraries are shared with zygote● Solves HotSpot start-up performance and memory problems
  17. 17. Vladimir Kotov Android Internals and Toolchain 17Android Runtime
  18. 18. Vladimir Kotov Android Internals and Toolchain 18Android Runtime
  19. 19. Vladimir Kotov Android Internals and Toolchain 19Android Runtime● Core libraries● Core APIs for Java language (IO, Structures, ...)● Core Platform Services, Application Framework● Activity Manager, Package Manager, Window Manager,Resource Manager, Content Providers, View System● Hardware Services● Telephony, Location, Bluetooth, WiFi, USB, Sensor
  20. 20. Vladimir Kotov Android Internals and Toolchain 20II. Android Developer Toolchain
  21. 21. Vladimir Kotov Android Internals and Toolchain 21Android offerThe first open* and comprehensive platform for mobiledevices● an operating system, user-interface and applications● a mobile phone without the proprietary obstacles thathave hindered mobile innovation● an open-source development platform
  22. 22. Vladimir Kotov Android Internals and Toolchain 22Android offer● Apps are equivalent parts of the phoneusing the same API● Reuse and replacement of applicationcomponents● GSM, EDGE, 3G, 4G, LTE data transfer● Comprehensive location-based APIs● Wi-Fi hardware access and peer-to-peerconnection
  23. 23. Vladimir Kotov Android Internals and Toolchain 23Android offer● Full multimedia hardware control, medialibraries● APIs for sensor hardware● Libraries for Bluetooth and NFC● Shared data stores and APIs for contacts,social networking● Background Services, applications, andprocesses● Home-screen Widgets and Live Wallpaper
  24. 24. Vladimir Kotov Android Internals and Toolchain 24Android Developer Challenge● A developer challenge Google hold everyyear for Android mobile platform● Demonstrates the capabilities of Androidplatform● Developers submit their apps to one of 10specially-designated ADC categories● Top 20 applications in each category willproceed to the second round● Community vote constituting 40% of thefinal judging score
  25. 25. Vladimir Kotov Android Internals and Toolchain 25Accessory Development Kit● RI for building accessoriesfor Android● Source code and hardwarespecifications● ADK 2012 is based on theArduino open sourceelectronics prototypingplatform
  26. 26. Install AndroidWhat do we need for Android?• Android SDK• ADT (Android Developer Tools)• AVD (Android Virtual Device)
  27. 27. Vladimir Kotov Android Internals and Toolchain 27Android SDK● Android APIsDeveloper access to the Android stack● Development toolsCompile and debug your applications● Android Virtual Device Manager● Emulator● Documentation● Sample code
  28. 28. Vladimir Kotov Android Internals and Toolchain 28Android SDK● http://developer.android.com/sdk (Linux, Mac OS X, Windows)● Installation Option1: SDK Tools Only● Initially contains only the basic SDK tools● Need to install the Platform-tools and Android platform(s)● Installation Option2: ADT Bundle● Eclipse + ADT plugin● Android SDK Tools● Android Platform-tools● The latest Android platform● The latest Android system image for the emulator
  29. 29. Vladimir Kotov Android Internals and Toolchain 29Android SDKSDK Manager.exe (Windows) v. tools/android (Mac, Linux)
  30. 30. Vladimir Kotov Android Internals and Toolchain 30Android SDKSDK packages<sdk>/tools/ Tools for debugging and testing, utilities todevelop an app (sdk manager, ddms, emulator)<sdk>/platform-tools/Platform-dependent tools for developing, supportlatest features of the Android platform and areupdated with new platform (adb, fastboot, aapt)<sdk>/docs/<sdk>/sources/Latest documentation for the Android APIs<sdk>/platforms/ a) SDK Platform for each version of Android,android.jar with a fully compliant Android libraryb) System images for Android emulator<sdk>/add-ons/<sdk>/extras/Special APIs and static libraries you can includein your app sources in order to use powerful APIsthat arent available in the standard platform
  31. 31. Vladimir Kotov Android Internals and Toolchain 31Android Development Tools● Eclipse plugin● Professional-grade development environment● Free, open-source, and runs on most major OS● Provides the emulator
  32. 32. Vladimir Kotov Android Internals and Toolchain 32Android Development Tools● Tooling● Wizard for creating new project● WYSWYG UI Designer● Code / XML editor● Integrated with● AVD Manager● DDMS
  33. 33. Vladimir Kotov Android Internals and Toolchain 33ADT Installation Options● ADT Bundleprovides everything you need to start - Eclipse IDE withbuilt-in ADTEclipse Juno Release● Existing IDEDownload ADT plugin– Help > Install New Software.– Add Repositoryhttps://dl-ssl.google.com/android/eclipse/Configure ADT plugin
  34. 34. Vladimir Kotov Android Internals and Toolchain 34Android Emulator● QEMU-based● Same image as on device● Same toolchain to work withdevice or emulator● Mimics all of the hardware andsoftware features of a typicalmobile device● Startup may be slow, try “GraphicsAcceleration” and “Virtual MachineAcceleration”, or use a deviceinstead
  35. 35. Vladimir Kotov Android Internals and Toolchain 35Android Virtual Device● Android Virtual Device (AVD) is an emulator configurationto model an actual device by defining hardware andsoftware options● Hardware profile - hardware features (camera,physical, memory)● Mapping to a system image - version of the Androidplatform will run on the virtual device● Dedicated storage area - the devices user data,emulated SD card● Other options - emulator skin, emulated SD card
  36. 36. Vladimir Kotov Android Internals and Toolchain 36Develop on Hardware Devices● Use any Android hardware device● Deploy your app to connecteddevices directy from the IDE● Live, on-device debugging, testing,and profiling● Enable debugging over USB● Developer options in the systemSettings
  37. 37. Vladimir Kotov Android Internals and Toolchain 37Dalvik Debug Monitor Server(DDMS)● Works with both the emulator and a connected device● Capabilities● Heap usage for a process● Track memory allocation of objects● Work with an emulator or devices file system● Examining thread information● Network Traffic tool (Android 4.0)● LogCat
  38. 38. Vladimir Kotov Android Internals and Toolchain 38DEMO
  39. 39. Vladimir Kotov Android Internals and Toolchain 39Usefull SDK utilitiesAndroid Debug Bridge(adb)Command line tool to communicate with anemulator instance or device (client, server,daemon)Important commands:- devices – show device list- install – install application file- pull / push – copy files to/from device- logcat - print log data- shell – start remote shell on deviceAndroid DeviceMonitor (monitor)Tool for Android application debugging andanalysis without ADTHierarchy Viewer(hierarchyviewer)Debug and optimize your user interface. Visualrepresentation of the layouts View hierarchyProGuard Obfuscates your code
  40. 40. Vladimir Kotov Android Internals and Toolchain 40Native development kit (NDK)● Tools to build and compile your native code forthe device architecture● A way to package your library into the APK file todistribute your application easily● A set of native system headers supported forAndroid platform (libc, libz, liblog, JNI headers)● Documentation, samplesIf the speed and efficiency of C/C++ is required
  41. 41. Vladimir Kotov Android Internals and Toolchain 41Application creation cycle
  42. 42. Vladimir Kotov Android Internals and Toolchain 42Hello, world ... finallyDEMO

×