Core Android

1.026 Aufrufe

Veröffentlicht am

In dieser Session werfen wir einen Blick auf die Android Platform jenseits der Dalvik VM. Wir entdecken den Android Source Code und erklären wo sich interessante Beispiele und Referenzen für App-Entwickler sowie nützliche Tools verbergen. Ein High-Level Überblick über die Platform-Architektur und das Platform-Build-System runden die Session ab.

Veröffentlicht in: Technologie
0 Kommentare
2 Gefällt mir
Statistik
Notizen
  • Als Erste(r) kommentieren

Keine Downloads
Aufrufe
Aufrufe insgesamt
1.026
Auf SlideShare
0
Aus Einbettungen
0
Anzahl an Einbettungen
4
Aktionen
Geteilt
0
Downloads
8
Kommentare
0
Gefällt mir
2
Einbettungen 0
Keine Einbettungen

Keine Notizen für die Folie

Core Android

  1. 1. Dominik Helleberg | inovex GmbHCore Android
  2. 2. Dominik Helleberg Mobile Development Android HTML5 http://dominik-helleberg.de/+
  3. 3. CoreAndroid
  4. 4. Warum? Neugier Verständnis - Bugs - Beispiele - Doku Anwendungen / Projektehttp://www.ouya.tv/about/https://mediacenter.motorola.com/Image-Gallery/MOTOACTV-Golf-Edition-8c1.aspxhttp://www.tolino.dehttps://www.honeywellaidc.com/en-US/resources/image-library/Pages/default.aspx?Category=7800&keywords=7800&title=7800&description=7800
  5. 5. Android is different…
  6. 6. Android is open?https://twitter.com/Arubin/status/27808662429
  7. 7. Android Architektur Stock Apps User Apps Framework / API Java System Services Dalvik / Runtime / Zygote Libs HAL Init Kernel
  8. 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. 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 syncCheck: http://source.android.comSources: approx. 16 GB
  10. 10. Getting around AOSPabi docs packagesbionic external pdkbootable frameworks prebuiltsbuild gdk sdkcts hardware systemdalvik libcore toolsdevelopment libnativehelperdevice ndk
  11. 11. Getting around AOSP Stock Apps abi docs IMEs packages Wallpapers.. bionic external pdk bootable frameworks prebuiltsandroid core build Framework gdk sdk icons cts hardware system dalvik libcore tools The.... development libnativehelper S D K device ndk
  12. 12. packages Calendar Contacts Gallery2 Launcher2
  13. 13. Frameworkbase/core/java/android/app/ActivityManager.javabase/core/java/android/widget/RelativeLayout.javabase/packages/SystemUI/res/*base/core/res/res/*base/core/java/android/os/PowerManager.java
  14. 14. sdkbash_completion/adb.bashscreenshot/
  15. 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. 16. Compile... $ source build/envsetup.sh including device/generic/armv7-a-neon/vendorsetup.sh including device/generic/armv7-a/vendorsetup.sh ....
  17. 17. Compile... $ lunch Youre 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]
  18. 18. zzzzzZZZZZZzzzzzz
  19. 19. device mappingscrespo Samsung Nexus Smanta Samsung Nexus 10mako LG Nexus 4grouper / tilapia Asus Nexus 7toro / maguro Samsung Galaxy Nexuswingray Motorola Xoom
  20. 20. …zzZZZzz… and run! $ emulator &
  21. 21. …zzZZZzz… and run!
  22. 22. Architecture by example - GPS Stock Apps User Apps Framework / API Java System Services Dalvik / Runtime / Zygote Libs HAL Init Kernel
  23. 23. Architecture by example - GPS Stock Apps User AppslocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, locationListener);
  24. 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. 25. Architecture by example - GPSframeworks/base/location/java/android/location/LocationManager.java Framework / API System Services private final ILocationManager mService;
  26. 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. 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. 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. 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. 30. Architecture by example - GPS development/tools/emulator/system/gps/ gps_qemu.c device/samsung/manta/gps/gps.exynos5.so Libs HAL Init
  31. 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. 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....
  33. 33. Level 1: AndroidXRefhttp://androidxref.com/
  34. 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 vmhttps://github.com/timroes/explain-plz
  35. 35. Level 2: ccache$ export USE_CCACHE=1$ export CCACHE_DIR=/<path_of_your_choice>/.ccache$ prebuilts/misc/linux-x86/ccache/ccache -M 50GThe 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 -shttp://source.android.com/source/building.html
  36. 36. Level 3
  37. 37. Level 4https://android-build.linaro.org/
  38. 38. Creditshttp://www.ouya.tv/about/https://mediacenter.motorola.com/Image-Gallery/MOTOACTV-Golf-Edition-8c1.aspxhttp://www.tolino.dehttps://www.honeywellaidc.com/en-US/resources/image-library/Pages/default.aspx?Category=7800&keywords=7800&title=7800&description=7800https://android-build.linaro.org/http://source.android.com/source/building.html
  39. 39. DANKE!

×