SlideShare a Scribd company logo
Dominik Helleberg | inovex GmbH


Core Android
Dominik Helleberg
 Mobile Development
 Android
 HTML5




   http://dominik-helleberg.de/+
Core

Android
Warum?
                 Neugier
                 Verständnis
                             - Bugs
                             - Beispiele
                             - Doku
                 Anwendungen / Projekte
http://www.ouya.tv/about/
https://mediacenter.motorola.com/Image-Gallery/MOTOACTV-Golf-Edition-8c1.aspx
http://www.tolino.de
https://www.honeywellaidc.com/en-US/resources/image-library/Pages/default.aspx?
Category=7800&keywords=7800&title=7800&description=7800
Android is different…
Android is open?




https://twitter.com/Arubin/status/27808662429
Android Architektur
   Stock Apps                       User Apps


 Framework / API
                                        Java
 System Services

            Dalvik / Runtime / Zygote


  Libs                HAL                      Init

                     Kernel
Android Architektur / Source




                                                      https://android.googlesource.com/
   Stock Apps                       User Apps


 Framework / API
                                        Java
 System Services

            Dalvik / Runtime / Zygote


  Libs                HAL                      Init

                     Kernel
Get the source!
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo


$ repo init -u https://android.googlesource.com/platform/manifest


$ repo sync



Check: http://source.android.com
Sources: approx. 16 GB
Getting around AOSP
abi           docs              packages
bionic        external          pdk
bootable      frameworks        prebuilts
build         gdk               sdk
cts           hardware          system
dalvik        libcore           tools
development   libnativehelper
device        ndk
Getting around AOSP
               Stock Apps
 abi           docs
                  IMEs           packages
               Wallpapers..
 bionic        external          pdk
 bootable      frameworks        prebuilts
android core
  build
 Framework     gdk               sdk
    icons
 cts           hardware          system
 dalvik        libcore           tools
                               The....
 development   libnativehelper S D K
 device        ndk
packages
  Calendar

  Contacts

  Gallery2

  Launcher2
Framework
base/core/java/android/app/ActivityManager.java


base/core/java/android/widget/RelativeLayout.java


base/packages/SystemUI/res/*
base/core/res/res/*


base/core/java/android/os/PowerManager.java
sdk

bash_completion/adb.bash


screenshot/
Compile...
 You need:
 •  Ubuntu LTS (10.04) or Mac OS X
 •  A bunch of tools
 •  HDD space (~ 30 GB)
 •  Time (Hours - depending on your HW)
Compile...
 $ source build/envsetup.sh


 including device/generic/armv7-a-neon/vendorsetup.sh
 including device/generic/armv7-a/vendorsetup.sh
 ....
Compile...
 $ lunch
 You're building on Linux
 Lunch menu... pick a combo:
   1. full-eng
   2. full_x86-eng
   3. vbox_x86-eng
   4. full_mips-eng
   5. full_grouper-userdebug
  ...
 Which would you like? [full-eng]
zzzzzZZZZZZzzzzzz
device mappings
crespo              Samsung    Nexus S

manta               Samsung    Nexus 10

mako                LG         Nexus 4

grouper / tilapia   Asus       Nexus 7

toro / maguro       Samsung    Galaxy Nexus

wingray             Motorola   Xoom
…zzZZZzz… and run!
 $ emulator &
…zzZZZzz… and run!
Architecture by example - GPS
   Stock Apps                       User Apps


 Framework / API
                                        Java
 System Services

            Dalvik / Runtime / Zygote


  Libs                HAL                      Init

                     Kernel
Architecture by example - GPS
         Stock Apps                 User Apps


locationManager = (LocationManager) 	
     	this.getSystemService(Context.LOCATION_SERVICE);	
	
locationManager.requestLocationUpdates(	
     	LocationManager.GPS_PROVIDER, 0, 0,
     	locationListener);
Architecture by example - GPS
 frameworks/base/location/java/android/location/
 LocationManager.java

     Framework / API             System Services

	try {	
        mService.requestLocationUpdates(request,
     	     	transport, intent, packageName);	
  } catch (RemoteException e) {	
       Log.e(TAG, "RemoteException", e);	
  }
Architecture by example - GPS
frameworks/base/location/java/android/location/
LocationManager.java

     Framework / API            System Services

	
private final ILocationManager mService;
Architecture by example - GPS
    frameworks/base/location/java/android/location/
    ILocationListener.aidl

        Framework / API             System Services

	void requestLocationUpdates(	
	      	in LocationRequest request, 	
	      	in ILocationListener listener,	
	      	in PendingIntent intent, 	
	      	String packageName);
Architecture by example - GPS
 frameworks/base/services/java/com/android/server/
 LocationManagerService.java

     Framework / API            System Services

		
	LocationProviderInterface provider =
     	mProvidersByName.get(name);	
	...	
	provider.setRequest(providerRequest,
     	worksource);
Architecture by example - GPS
 frameworks/base/services/java/com/android/server/
 location/GpsLocationProvider.java

      Framework / API            System Services

		
		
	private native boolean native_start();
Architecture by example - GPS
    hardware/libhardware/include/hardware/gps.h

 	/** Represents the standard GPS interface. */	
typedef struct {	
  		
  	 int    (*init)( GpsCallbacks* callbacks );	
	
     /** Starts navigating. */	
     int   (*start)( void );	
...	
	
	        Libs             HAL               Init
Architecture by example - GPS

    development/tools/emulator/system/gps/
    gps_qemu.c


    device/samsung/manta/gps/gps.exynos5.so
		
	

         Libs          HAL            Init
What’s next? Tips + Tricks
•  Level 1:
     Check source for samples and understanding
•  Level 2:
     Compile your own emulator images
•  Level 3:
     Get a supported nexus device and burn images
•  Level 4:
     Get a development board an build android
     embedded Software
Level 1: grep
$ jgrep LocationManager

./base/core/java/android/app/ContextImpl.java:60:import android.location.ILocationManager;
./base/core/java/android/app/ContextImpl.java:61:import android.location.LocationManager;
./base/core/java/android/app/ContextImpl.java:403:           return new LocationManager(ctx, ILocationManager.Stub.asInterfa
./base/core/java/android/content/Context.java:1749: * <dd> A {@link android.location.LocationManager} for controlling location
./base/core/java/android/content/Context.java:1795: * @see android.location.LocationManager
./base/core/java/android/content/Context.java:1912: * android.location.LocationManager} for controlling location
./base/core/java/android/content/Context.java:1916: * @see android.location.LocationManager
./base/core/java/android/provider/Settings.java:3096:    * LocationManager service for testing purposes during application deve
./base/core/java/android/webkit/GeolocationService.java:23:import android.location.LocationManager;
./base/core/java/android/webkit/GeolocationService.java:39: private LocationManager mLocationManager;
./base/core/java/android/webkit/GeolocationService.java:54:    mLocationManager = (LocationManager) context.getSystemServ
./base/core/java/android/webkit/GeolocationService.java:55:    if (mLocationManager == null) {
./base/core/java/android/webkit/GeolocationService.java:118:     if (LocationManager.NETWORK_PROVIDER.equal
....
Level 1: AndroidXRef




http://androidxref.com/
Level 1: explain-plz
      @local:/Volumes/android/dalvik $ explain-plz

      Explanation for folder dalvik:
       This directory contains the Dalvik virtual machine and core class library,
       as well as related tools, libraries, and tests.

         Git project directory: dalvik
         Git fetch URL: https://android.googlesource.com/platform/dalvik

         Subfolders with explanation:
          dexdump
          dexgen
          dx
          opcode-gen
          tools/hprof-conv
          vm

https://github.com/timroes/explain-plz
Level 2: ccache
$ export USE_CCACHE=1
$ export CCACHE_DIR=/<path_of_your_choice>/.ccache
$ prebuilts/misc/linux-x86/ccache/ccache -M 50G

The suggested cache size is 50-100G.
You can watch ccache being used by doing the following:

$ watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s




http://source.android.com/source/building.html
Level 3
Level 4




https://android-build.linaro.org/
Credits
http://www.ouya.tv/about/
https://mediacenter.motorola.com/Image-Gallery/MOTOACTV-Golf-Edition-8c1.aspx
http://www.tolino.de
https://www.honeywellaidc.com/en-US/resources/image-library/Pages/default.aspx?
Category=7800&keywords=7800&title=7800&description=7800
https://android-build.linaro.org/
http://source.android.com/source/building.html
DANKE!

More Related Content

PPTX
Reverse engineering android apps
PDF
Applied Computer Science Concepts in Android
PDF
Building framework with shared code on Android and iOS using React Native. UA...
PPTX
How to implement a simple dalvik virtual machine
PDF
Droidcon Greece '15 - Reverse Engineering in Android: Countermeasures and Tools
PPT
Reverse Engineering Android Application
PDF
Using the Android Native Development Kit (NDK)
PPTX
Optimizing Spring Boot apps for Docker
Reverse engineering android apps
Applied Computer Science Concepts in Android
Building framework with shared code on Android and iOS using React Native. UA...
How to implement a simple dalvik virtual machine
Droidcon Greece '15 - Reverse Engineering in Android: Countermeasures and Tools
Reverse Engineering Android Application
Using the Android Native Development Kit (NDK)
Optimizing Spring Boot apps for Docker

What's hot (20)

PPTX
Android ndk
PDF
Android reverse engineering: understanding third-party applications. OWASP EU...
PDF
How to reverse engineer Android applications
PPT
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
PPT
Using Maven2
PDF
Using the Android Native Development Kit (NDK)
PDF
Note - Apache Maven Intro
PDF
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
PDF
Our Puppet Story (GUUG FFG 2015)
PDF
How to Reverse Engineer Web Applications
PDF
Cross-Platform App Development with Flutter, Xamarin, React Native
PPT
Gerência de Configuração com Maven
PDF
PPT
Maven 2.0 - Improve your build patterns
PDF
How the Atlassian Plugin SDK Cured Cancer and Reunited Soundgarden - Atlassia...
PDF
Asynchronous Systems with Fn Flow
PDF
Maven 3 Overview
PDF
Mobile development in 2020
Android ndk
Android reverse engineering: understanding third-party applications. OWASP EU...
How to reverse engineer Android applications
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
Using Maven2
Using the Android Native Development Kit (NDK)
Note - Apache Maven Intro
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Our Puppet Story (GUUG FFG 2015)
How to Reverse Engineer Web Applications
Cross-Platform App Development with Flutter, Xamarin, React Native
Gerência de Configuração com Maven
Maven 2.0 - Improve your build patterns
How the Atlassian Plugin SDK Cured Cancer and Reunited Soundgarden - Atlassia...
Asynchronous Systems with Fn Flow
Maven 3 Overview
Mobile development in 2020
Ad

Viewers also liked (20)

PDF
Java Svet - Communication Between Android App Components
PDF
Android Ice Cream Sandwich WJAX 2011
PDF
Supercharge your ui
PDF
Embedded Android
PDF
Android Studio und gradle
PDF
Why do we need more nerds?
PDF
Android Development Tools
PDF
One APK to rule them all
PDF
Android ActionBar Navigation reloaded
PDF
Android Studio vs. ADT
PDF
Android Development Tools
PDF
Renderscript in Android 3.x
PPTX
Android Effective UI: Tips, Tricks and Patterns
PPTX
Android Enterprise Integration
PDF
Rich Graphics & OpenGL mit Android
ODP
Android Camera Architecture
PPTX
Android app dev company in pune
PDF
Android bluetooth
PPTX
Camera 2.0 in Android 4.2
PPTX
Clean architecture
Java Svet - Communication Between Android App Components
Android Ice Cream Sandwich WJAX 2011
Supercharge your ui
Embedded Android
Android Studio und gradle
Why do we need more nerds?
Android Development Tools
One APK to rule them all
Android ActionBar Navigation reloaded
Android Studio vs. ADT
Android Development Tools
Renderscript in Android 3.x
Android Effective UI: Tips, Tricks and Patterns
Android Enterprise Integration
Rich Graphics & OpenGL mit Android
Android Camera Architecture
Android app dev company in pune
Android bluetooth
Camera 2.0 in Android 4.2
Clean architecture
Ad

Similar to Core Android (20)

PDF
An Introduction To Android
PDF
Android Internals
PDF
Android Internals
PDF
Android OS Porting: Introduction
PDF
Working with the AOSP - Linaro Connect Asia 2013
PDF
Inside Android's UI
PDF
Inside Android's UI / ABS 2013
PDF
Discover System Facilities inside Your Android Phone
PDF
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
PDF
Inside Android's UI at AnDevCon VI
PDF
Inside Android's UI at AnDevCon V
PPT
Enhancing and modifying_the_core_android_os
PDF
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
PDF
Embedded Android in Real Life - Live Embedded Event 2021
PDF
Android Platform Debugging & Development
PDF
Droidcon uk2012 androvm
PDF
Android Internals at Linaro Connect Asia 2013
PDF
Build Your First Android App Session #1
PDF
Building aosp
PDF
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...
An Introduction To Android
Android Internals
Android Internals
Android OS Porting: Introduction
Working with the AOSP - Linaro Connect Asia 2013
Inside Android's UI
Inside Android's UI / ABS 2013
Discover System Facilities inside Your Android Phone
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Inside Android's UI at AnDevCon VI
Inside Android's UI at AnDevCon V
Enhancing and modifying_the_core_android_os
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Embedded Android in Real Life - Live Embedded Event 2021
Android Platform Debugging & Development
Droidcon uk2012 androvm
Android Internals at Linaro Connect Asia 2013
Build Your First Android App Session #1
Building aosp
Android Security Development - Part 2: Malicious Android App Dynamic Analyzi...

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Spectroscopy.pptx food analysis technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PDF
KodekX | Application Modernization Development
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Unlocking AI with Model Context Protocol (MCP)
Spectroscopy.pptx food analysis technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
sap open course for s4hana steps from ECC to s4
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
KodekX | Application Modernization Development
MIND Revenue Release Quarter 2 2025 Press Release
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Reach Out and Touch Someone: Haptics and Empathic Computing

Core Android

  • 1. Dominik Helleberg | inovex GmbH Core Android
  • 2. Dominik Helleberg Mobile Development Android HTML5 http://dominik-helleberg.de/+
  • 4. Warum? Neugier Verständnis - Bugs - Beispiele - Doku Anwendungen / Projekte http://www.ouya.tv/about/ https://mediacenter.motorola.com/Image-Gallery/MOTOACTV-Golf-Edition-8c1.aspx http://www.tolino.de https://www.honeywellaidc.com/en-US/resources/image-library/Pages/default.aspx? Category=7800&keywords=7800&title=7800&description=7800
  • 7. Android Architektur Stock Apps User Apps Framework / API Java System Services Dalvik / Runtime / Zygote Libs HAL Init Kernel
  • 8. Android Architektur / Source https://android.googlesource.com/ Stock Apps User Apps Framework / API Java System Services Dalvik / Runtime / Zygote Libs HAL Init Kernel
  • 9. Get the source! $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo $ chmod a+x ~/bin/repo $ repo init -u https://android.googlesource.com/platform/manifest $ repo sync Check: http://source.android.com Sources: approx. 16 GB
  • 10. Getting around AOSP abi docs packages bionic external pdk bootable frameworks prebuilts build gdk sdk cts hardware system dalvik libcore tools development libnativehelper device ndk
  • 11. Getting around AOSP Stock Apps abi docs IMEs packages Wallpapers.. bionic external pdk bootable frameworks prebuilts android core build Framework gdk sdk icons cts hardware system dalvik libcore tools The.... development libnativehelper S D K device ndk
  • 12. packages Calendar Contacts Gallery2 Launcher2
  • 15. Compile... You need: •  Ubuntu LTS (10.04) or Mac OS X •  A bunch of tools •  HDD space (~ 30 GB) •  Time (Hours - depending on your HW)
  • 16. Compile... $ source build/envsetup.sh including device/generic/armv7-a-neon/vendorsetup.sh including device/generic/armv7-a/vendorsetup.sh ....
  • 17. Compile... $ lunch You're building on Linux Lunch menu... pick a combo: 1. full-eng 2. full_x86-eng 3. vbox_x86-eng 4. full_mips-eng 5. full_grouper-userdebug ... Which would you like? [full-eng]
  • 19. device mappings crespo Samsung Nexus S manta Samsung Nexus 10 mako LG Nexus 4 grouper / tilapia Asus Nexus 7 toro / maguro Samsung Galaxy Nexus wingray Motorola Xoom
  • 20. …zzZZZzz… and run! $ emulator &
  • 22. Architecture by example - GPS Stock Apps User Apps Framework / API Java System Services Dalvik / Runtime / Zygote Libs HAL Init Kernel
  • 23. Architecture by example - GPS Stock Apps User Apps locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, locationListener);
  • 24. Architecture by example - GPS frameworks/base/location/java/android/location/ LocationManager.java Framework / API System Services try { mService.requestLocationUpdates(request, transport, intent, packageName); } catch (RemoteException e) { Log.e(TAG, "RemoteException", e); }
  • 25. Architecture by example - GPS frameworks/base/location/java/android/location/ LocationManager.java Framework / API System Services private final ILocationManager mService;
  • 26. Architecture by example - GPS frameworks/base/location/java/android/location/ ILocationListener.aidl Framework / API System Services void requestLocationUpdates( in LocationRequest request, in ILocationListener listener, in PendingIntent intent, String packageName);
  • 27. Architecture by example - GPS frameworks/base/services/java/com/android/server/ LocationManagerService.java Framework / API System Services LocationProviderInterface provider = mProvidersByName.get(name); ... provider.setRequest(providerRequest, worksource);
  • 28. Architecture by example - GPS frameworks/base/services/java/com/android/server/ location/GpsLocationProvider.java Framework / API System Services private native boolean native_start();
  • 29. Architecture by example - GPS hardware/libhardware/include/hardware/gps.h /** Represents the standard GPS interface. */ typedef struct { int (*init)( GpsCallbacks* callbacks ); /** Starts navigating. */ int (*start)( void ); ... Libs HAL Init
  • 30. Architecture by example - GPS development/tools/emulator/system/gps/ gps_qemu.c device/samsung/manta/gps/gps.exynos5.so Libs HAL Init
  • 31. What’s next? Tips + Tricks •  Level 1: Check source for samples and understanding •  Level 2: Compile your own emulator images •  Level 3: Get a supported nexus device and burn images •  Level 4: Get a development board an build android embedded Software
  • 32. Level 1: grep $ jgrep LocationManager ./base/core/java/android/app/ContextImpl.java:60:import android.location.ILocationManager; ./base/core/java/android/app/ContextImpl.java:61:import android.location.LocationManager; ./base/core/java/android/app/ContextImpl.java:403: return new LocationManager(ctx, ILocationManager.Stub.asInterfa ./base/core/java/android/content/Context.java:1749: * <dd> A {@link android.location.LocationManager} for controlling location ./base/core/java/android/content/Context.java:1795: * @see android.location.LocationManager ./base/core/java/android/content/Context.java:1912: * android.location.LocationManager} for controlling location ./base/core/java/android/content/Context.java:1916: * @see android.location.LocationManager ./base/core/java/android/provider/Settings.java:3096: * LocationManager service for testing purposes during application deve ./base/core/java/android/webkit/GeolocationService.java:23:import android.location.LocationManager; ./base/core/java/android/webkit/GeolocationService.java:39: private LocationManager mLocationManager; ./base/core/java/android/webkit/GeolocationService.java:54: mLocationManager = (LocationManager) context.getSystemServ ./base/core/java/android/webkit/GeolocationService.java:55: if (mLocationManager == null) { ./base/core/java/android/webkit/GeolocationService.java:118: if (LocationManager.NETWORK_PROVIDER.equal ....
  • 34. Level 1: explain-plz @local:/Volumes/android/dalvik $ explain-plz Explanation for folder dalvik: This directory contains the Dalvik virtual machine and core class library, as well as related tools, libraries, and tests. Git project directory: dalvik Git fetch URL: https://android.googlesource.com/platform/dalvik Subfolders with explanation: dexdump dexgen dx opcode-gen tools/hprof-conv vm https://github.com/timroes/explain-plz
  • 35. Level 2: ccache $ export USE_CCACHE=1 $ export CCACHE_DIR=/<path_of_your_choice>/.ccache $ prebuilts/misc/linux-x86/ccache/ccache -M 50G The suggested cache size is 50-100G. You can watch ccache being used by doing the following: $ watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s http://source.android.com/source/building.html