• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)

Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1)



Course: Android Internals

Course: Android Internals
Lecture 10: Debugging/Profiling, Bluetooth/WiFI/RIL



Total Views
Views on SlideShare
Embed Views



4 Embeds 114

http://www.slashdocs.com 108
http://www.verious.com 3
http://www.docshut.com 2
http://www.kpbird.com 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1) Android internals 10 - Debugging/Profiling, Bluetooth/WiFI/RIL (rev_1.1) Presentation Transcript

    • Android internals Egor Elizarov SPbSU 2012
    • Legal info Android internals by Egor Elizarov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License You are free to – copy, distribute, display, and perform the work – make derivative works Under the following conditions – Attribution. You must give the original author credit – Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one All pictures and trademarks are the property of their respective owners. Use of these trademarks and pictures is subject to owners permissions. Corrections, suggestions, contributions and translations are welcome! 2 Egor Elizarov SPbSU 2012
    • Lecture 10 Debugging / profiling WiFi / Bluetooth / RIL yegor.yelizarov(at)gmail.comRev: 1.1 http://vk.com/android_internalsLast update: 06/01/2012 3 Egor Elizarov SPbSU 2012
    • Previous time Suspend/Resume process Android PM main components Android Input subsystem *.kl, *.kcm, *.idc configuration files Sensor subsystem Input noise reduction approaches Android data storage 4 Egor Elizarov SPbSU 2012
    • Useful host/target configuration 5 Egor Elizarov SPbSU 2012
    • Debugging/profiling agenda Very good presentation about debugging & profiling by Tim Bird Most popular approaches Tools covered by Tim in brief Few words about not covered approaches 6 Egor Elizarov SPbSU 2012
    • Debugging approaches 7 Egor Elizarov SPbSU 2012
    • Logging logcat – obtaining android log – For both C/C++ (LOGE) & Java (Log.e) code – Have rich formatting options dmesg – obtatining kernel log – printk() – Extra logs from userspace through /dev/kmsg Stdio redirection – For both Java (log.redirect-stdio) & Native (xargs) code 8 Egor Elizarov SPbSU 2012
    • GNU debugger (gdb) DDD can be used as graphic backend On target  $ gdbserver :1234 --attach pid  Or $gdbserver :1234 /system/bin/app● On host  $ adb forward tcp:1234 tcp:1234 && gdbclient app :1234 app  Or $ arm-eabi-gdb  # file ./out/target/product/generic/symbols/system/bin/app_process  # set solib-search-path ./out/target/product/generic/symbols/system/lib  # target remote target_ip:1234 9 Egor Elizarov SPbSU 2012
    • Google debuggers Fastboot – Protocol & tool to communicate with host over USB – Install images, erase partitions, booting from host – Supported in UBoot ADB – Remote shell, install, file copy, etc. – Work over Network/USB 10 Egor Elizarov SPbSU 2012
    • Tracing & dumping Strace – Shows system calls for a process (or set of processes) Dalvik Debug Monitor Servic (DDMS) – Integrated into Eclipse – Provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat and much more Dumpsys / Dumpstate – Dumps huge amounts of information about the system, including status, counts and statistics – Dumpsys show status information from Android service 11 Egor Elizarov SPbSU 2012
    • Virtual Network Computing VNC - Graphical desktop sharing system Transmits input events from host to target Transmits screen updates from target to host On target – androidvncserver & On host – vncviewer target_ip:5901 12 Egor Elizarov SPbSU 2012
    • Profiling approaches 13 Egor Elizarov SPbSU 2012
    • CPU and memory statistics Common profiling workflow Smem – Analyze of system-wide memory usage OProfile – CPU usage statistic for both kernel & userspace – Monitors execution point periodically – Should be enabled in kernel 14 Egor Elizarov SPbSU 2012
    • Tracing Bootchart – Analyze system booting process – init should be recompiled to add Bootchart support TraceView – Java methods tracing – Can be used with DDMS 15 Egor Elizarov SPbSU 2012
    • Benchmarks Rowboat bench – Set of benchmarks for CPU, 2D, 3D, etc. – Developed by Rowboat team 0xbench – Another set of benchmarks – Developed by 0xlab team Lots of benchmarks in Google Play 16 Egor Elizarov SPbSU 2012
    • Linux Trace Toolkit next generation Work for both kernel and userspace Useful to debug threads and processes Allow to trace only some events Allow userspace events (/mnt/debugfs/ltt/write_event) Kernel patches + ltt-control + ltt-viewer 17 Egor Elizarov SPbSU 2012
    • Add LTTng support to Android 18 Egor Elizarov SPbSU 2012
    • Different tricks Activity Manager - control applications – am start -a android.intent.action.MAIN -n com.android.camera/com.android.camera.Camera & input keyevent X – send keyboard events sendevent – send touch events setprop/getprop - control system properties sqlite - access database start/stop - restart whole system 19 Egor Elizarov SPbSU 2012
    • WiFi in Android Supports IEEE 802.11 abgn Supports both IPv4 and IPv6 Based on customized wpa_supplicant Wifi drivers compiled as modules (Wifi HAL can changed to support built-in drivers) 20 Egor Elizarov SPbSU 2012
    • Wifi subsystem 21 Egor Elizarov SPbSU 2012
    • Porting Wifi driver 22 Egor Elizarov SPbSU 2012
    • Bluetooth in Android Bluetooth is covered by IEEE 802.15.1 Android BT is based on the BlueZ stack Android provides subset of BlueZ functionality Android supports point-to-point and multiple- point connections Supports maximum 9 simultaneous connections 23 Egor Elizarov SPbSU 2012
    • Bluetooth workflow 24 Egor Elizarov SPbSU 2012
    • Bluetooth subsystem 25 Egor Elizarov SPbSU 2012
    • RIL in Android Most devices have separate Radio Frequency module for signal strength measurement etc. Modem often have own CPU with running OS (Ex: Mentor Nucleus) Usually have firmware Often kernel interface to these devices is PPP 26 Egor Elizarov SPbSU 2012
    • RIL subsystem 27 Egor Elizarov SPbSU 2012
    • Next Time Exam 28 Egor Elizarov SPbSU 2012
    • Useful links http://vk.com/android_internals http://elinux.org/images/c/c9/Android-tips-and-tricks-2010-10.pdf http://developer.android.com/guide/developing/debugging/index.html http://source.android.com/tech/debugging/native-memory.html http://developer.android.com/guide/developing/debugging/ddms. html 29 Egor Elizarov SPbSU 2012
    • Useful links (2) http://code.google.com/p/android-vnc-server/wiki/README http://softteco.blogspot.com/2011/03/android-low-level-shell- click-on-screen.html http://lttng.org/ http://softteco.blogspot.com/2011/03/android-low-level-shell- click-on-screen.html http://www.kandroid.org/online-pdk/guide/telephony.html 30 Egor Elizarov SPbSU 2012
    • Thanks to Sergey Matyukevich for review and advices (www.linkedin.com/pub/sergey- matyukevich/31/889/769) Nikolay F. Fominykh for review and advices Vladimir Barinov for review and advices (http://www.linkedin.com/pub/vladimir- barinov/2a/18a/bab) 31 Egor Elizarov SPbSU 2012