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 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
  2. 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?
  3. "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
  4. 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
  5. ‣ 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:
  6. 1. develop in Java 2. run Android ≠ Android “is

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

    Slow startup IP licensing restrictions Memory hog Low memory consumption VM forking Register based
  8. 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
  9. Android Java Android Runtime Oracle Java Android API = Java

    SE – AWT/Swing + Android API = Dalvik Java language + Apache Harmony + Java language = + + JVM JDK
  10. ‣ 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
  11. 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
  12. Android Build process Write Java code .java Compile .class Compile

    .dex Add Android resources Compile .apk res/ res/
  13. Install Android ‣ Android SDK ‣ Android Studio ‣ AVD

    (Android Virtual Device) developer.android.com/sdk/installing/studio.html
  14. 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
  15. 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
  16. Develop on Hardware Devices • Developer options in Settings •

    USB debugging • Trust application from unknown source Enable: