Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Insides and Tools

Alexey Buzdin
September 17, 2014

Android Insides and Tools

Alexey Buzdin

September 17, 2014
Tweet

More Decks by Alexey Buzdin

Other Decks in Programming

Transcript

  1. Android insides Alexey Buzdin

  2. Linux-based operating system Android is Software stack designed* for mobile

    devices {
  3. Android history 2014 – Android L with ART unveiled 2005

    – Google purchased Android Inc 2007 – Open Handset Alliance established 2010 – First device in Nexus line 2012 – Oracle v. Google dispute on Java API 2013 – ART and KitKat introduced
  4. Android Linux Kernel based on Linux 2.6 and 3.x (Android

    4.0) •Great memory and process management •Permissions-based security model •Proven driver model •Support for shared libraries •Open source currently developed internally in Google Why Linux?
  5. Android Anatomy

  6. "Eventually Android and Linux would come back to a common

    kernel, but it will probably not be for four to five years" ≠ Android “is not Linux” Modified Linux sub system Limited set of Linux utilities August 2011, Linus Torvalds
  7. Android Linux Kernel ‣ Kernel enhancements ‣ Power Management ‣

    Ashmem ‣ Binder IPC ‣ Low Memory Killer December 2011 - Android Mainlining Project to put Android drivers, patches and features back into the Linux kernel
  8. None
  9. Device data External devices Startup script Mount point Symbolic link

    to /mt/sdcard. System
  10. Android Native Libraries

  11. ‣ Function Libraries ‣ WebKit, Media Framework, SQLite ‣ Native

    Servers ‣ Surface Manager, Audio Manager ‣ Hardware Abstraction Libraries ‣ WiFi, Bluetooth, GPS, Camera Android Native Libraries Optimized for mobile:
  12. Android Native Libraries

  13. 1. develop in Java 2. run Android ≠ Android “is

    not Java” Java API Android runtime
  14. Android Runtime Custom Virtual Machine. Why? Java VM Android VM

    Slow startup IP licensing restrictions Memory hog Low memory consumption VM forking Register based
  15. Android Runtime " ‣ 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 ‣ 35% more bytes ‣ Trace JIT compiler (since 2.2) Dalvik Virtual Machine
  16. Android Java Android Runtime Oracle Java Android API = Java

    SE – AWT/Swing + Android API = Dalvik Java language + Apache Harmony + Java language = + + JVM JDK
  17. ‣ Daemon that spawns VM processes ‣ Preloads core libraries

    ‣ Forked when app is launched ‣ Core libraries are shared with zygote ‣ Solves HotSpot start-up performance Android Runtime Zygote Core lib Zygote Core lib Core lib MyCode MyCode root App1 App2
  18. Android Runtime

  19. Android API

  20. Android API 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
  21. Android Applications

  22. Java Build process Write Java code .java Compile .class Package

    .jar
  23. Android Build process Write Java code .java Compile .class Compile

    .dex Add Android resources Compile .apk res/ res/
  24. Android tools

  25. Install Android ‣ Android SDK ‣ Android Studio ‣ AVD

    (Android Virtual Device) developer.android.com/sdk/installing/studio.html
  26. Android SDK ‣ Android APIs ‣ Developer access to the

    Android stack ‣ Development tools ‣ Compile and debug your applications ‣ Android Virtual Device Manager ‣ Emulator ‣ Documentation ‣ Sample code
  27. Android SDK

  28. SDK Manager.exe (Windows) v. tools/android (Mac, Linux) • Android SDK

    Tools • Android SDK Platform-tools • Android 4.0.3 (API 15): • SDK Platform • Extras: • Android Support Repository • Android Support Library • Google Repository • Google USB Driver Download
  29. GenyMotion www.genymotion.com/

  30. Develop on Hardware Devices • Developer options in Settings •

    USB debugging • Trust application from unknown source Enable:
  31. the end