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

Introduction to the Android Open Source Project

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

Introduction to the Android Open Source Project

Introduction to the Android Open Source Project, created for GDG Devfest 2017 Belgium

Avatar for Sigmadeltasoftware

Sigmadeltasoftware

November 05, 2017

Other Decks in Programming

Transcript

  1. 2 2 Introduction Bojan Belic – GDG Devfest Belgium 2017

    Bojan Belic @bojanbelic @SigmaDelta_Soft @sigmadeltasoftware www.sigmadelta.be
  2. 3 3 Experience Bojan Belic – GDG Devfest Belgium 2017

    Team Leader Mobile Development Senior Android Developer 2013 2017
  3. 4 4 Getting Started (by yourself) Bojan Belic – GDG

    Devfest Belgium 2017 AOSP.dev — All About the AOSP https://source.android.com/ https://forum.xda-developers.com/
  4. 5 5 Before we continue Bojan Belic – GDG Devfest

    Belgium 2017 Slides will be structured in Q&A format. f.e.: Why Q&A format? Because I find it easier to explain concepts by attaching the context of a question to it. Note: Feel free to raise your hand or interrupt me at any time to ask a question of your own
  5. 6 6 Android Software Stack Bojan Belic – GDG Devfest

    Belgium 2017 “Android is an open source, Linux-based software stack created for a wide array of devices and form factors.” What is Android? Fragmentation issues? Need for contract between system & developer! Compatibility Test Suite: Platform API’s, permissions, … Trade Federation: advanced testing for both OEM & App devs
  6. 7 7 The Android Core Bojan Belic – GDG Devfest

    Belgium 2017 Can Android be considered a Linux distribution? Why the Linux kernel? Maturity and familiarity facilitates driver development Opportunity to make use of key security features. f.e.: SElinux No: not POSIX-compliant Uses Bionic as replacement for GNU C library Why use Bionic? Avoid (L)GPL license Smaller & better fit for slower CPU’s
  7. 8 8 Hardware Abstraction Layer Bojan Belic – GDG Devfest

    Belgium 2017 What is a HAL module? Driver-agnostic implementation of a standard interface defined by Android Uniform interface allows high-level Java API to access hardware capabilities C++ shared libraries (/system/lib/hw)
  8. 9 9 ART & Dalvik Bojan Belic – GDG Devfest

    Belgium 2017 What is ART? Android RunTime since Lollipop (5.0) and successor to Dalvik Ahead-of-Time compilation: better performance & battery life Improved garbage-collection & debugging How does ART work? Separate instance per app (Application Sandbox) Enhanced security Android 7.0 adds Just-In-Time compiler Run-time profiling & optimisations
  9. 10 10 Native Libraries (NDK) Bojan Belic – GDG Devfest

    Belgium 2017 What are the native libraries? Collection of libraries for native development Sometimes accessible through Java wrapper Typical use-cases? Applications with real-time requirements (f.e.: low-latency audio) Wrappers for existing C/C++ solutions
  10. 11 11 Android Java API Framework Bojan Belic – GDG

    Devfest Belgium 2017 What is the Java API Framework Basic building blocks for apps Part of SDK, change with API version
  11. 12 12 Android System/Core Apps Bojan Belic – GDG Devfest

    Belgium 2017 What are Android system apps? Apps embedded into an Android image (not removable) Core apps: available on stock Android image Are the GMS a stock part of Android? No! Obtained on license base OpenGApps is alternative Are the Core apps free? Yes, but: No guaranteed maintenance track Far more limited in functionality as opposed to GMS alternative
  12. 13 13 Building your first Android image Bojan Belic –

    GDG Devfest Belgium 2017 Are there any requirements? Compatible OS (Ubuntu / macOs / …) 150 – 250 GB of disk space (repo is +- 100 GB!) At least 8GB of RAM and 16 GB if VM How about the CPU? Use the best you have available! AMD Ryzen 1700 series 51 min vs 1:20 hours (4th gen i7)
  13. 14 14 Preparing Build Environment - 1 Bojan Belic –

    GDG Devfest Belgium 2017 What is the Repo tool? Wrapper on top of Git Submodules Feature not available at beginning of Android development Where can I download the AOSP source code? https://source.android.com/source/build-numbers#source-code-tags-and-builds Pick branch according to target device
  14. 15 15 Preparing Build Environment - 2 Bojan Belic –

    GDG Devfest Belgium 2017 How do I download the AOSP? $ repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.2_r12 .repo directory holds manifest file $ repo sync -j8
  15. 16 16 Configuring the build Bojan Belic – GDG Devfest

    Belgium 2017 How do I configure my build target? $ . build/envsetup.sh $ lunch #{product}-#{variant} Product: target device/package Variant: define level of debug tooling and system access
  16. 17 17 Building the Image Bojan Belic – GDG Devfest

    Belgium 2017 How do I trigger the build already? $ make –jN $ mmm for individual modules Go nap / get a coffee / read AOSP.dev
  17. 18 18 Build results Bojan Belic – GDG Devfest Belgium

    2017 Where can I find the build results? #{AOSP_ROOT}/out out/host : Dependencies of host machine out/target: Build output related to target out/target/common Build results which are common across devices out/target/product Build results for target product
  18. 19 19 Flashing the image Bojan Belic – GDG Devfest

    Belgium 2017 Is flashing Android devices a generic operation? No, certain vendors/chipsets require different approaches Pixel/Nexus: adb & fastboot Samsung: Odin / Heimdall Mediatek phones: SP Flash Tool
  19. 20 20 Flashing a Nexus phone Bojan Belic – GDG

    Devfest Belgium 2017 What do I need to flash a Nexus phone? adb: Android debugging bridge fastboot: Interact with device’s flash memory Necessary device drivers/ USB permissions
  20. 21 21 Bootloader Mode Bojan Belic – GDG Devfest Belgium

    2017 Can I flash the phone now? No, you need to unlock the phone first How about now? No, restart the bootloader again Please? Now it’s ok
  21. 22 22 Flashing Options Bojan Belic – GDG Devfest Belgium

    2017 What are my options? $ fastboot flashall Flashes all available images Uses data available from lunch environment $ fastboot flash boot out/target/product/angler/boot.img Flashes individual images Necessary for updates of f.e. Radio $ fastboot update out/target/product/angler/$TARGET_PRODUCT-img- eng.$USER.zip Used after ‘$ make updatepackage’ Flashes the .zip updatepackage
  22. 23 23 Modifications Bojan Belic – GDG Devfest Belgium 2017

    Can I just insert my own apps? No, AOSP doesn’t understand or support Gradle yet Android.mk files
  23. 24 24 Summary Bojan Belic – GDG Devfest Belgium 2017

    Download source using Repo tool Identify appropriate branch Configure environment using envsetup.sh Select target with lunch command Build & flash image upon completion