SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
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.com

Rev: 1.1                                          http://vk.com/android_internals
Last 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

Mais conteúdo relacionado

Mais procurados

Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)Egor Elizarov
 
Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Egor Elizarov
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting SequenceJayanta Ghoshal
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals UpdateOpersys inc.
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...Paris Open Source Summit
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depthChris Simmonds
 
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...ijafrc
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoTOpersys inc.
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvmdfages
 
Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on androidRamesh Prasad
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Development environment
Development environmentDevelopment environment
Development environmentmaamir farooq
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 

Mais procurados (20)

Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
 
Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting Sequence
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals Update
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
 
Exoplayer 2
Exoplayer  2Exoplayer  2
Exoplayer 2
 
Android 10
Android 10Android 10
Android 10
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoT
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvm
 
Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on android
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Development environment
Development environmentDevelopment environment
Development environment
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 

Destaque

RIL and Android Telephony
RIL and Android TelephonyRIL and Android Telephony
RIL and Android TelephonyLeaf Johnson
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer InterfaceChun-Yu Wang
 
Android telephony stack
Android telephony stackAndroid telephony stack
Android telephony stackDavid Marques
 
Android Telephony Manager and SMS
Android Telephony Manager and SMSAndroid Telephony Manager and SMS
Android Telephony Manager and SMSJussi Pohjolainen
 
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM SystemLabmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM SystemSyuan Wang
 
Psi android telephony_case_study_v10
Psi android telephony_case_study_v10Psi android telephony_case_study_v10
Psi android telephony_case_study_v10Primesoftinc
 
Encrypted Voice Communications
Encrypted Voice CommunicationsEncrypted Voice Communications
Encrypted Voice Communicationssbwahid
 
Android Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and TipsAndroid Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and TipsDroidConTLV
 
Android Application Development of NFC Peer-to-Peer Mode
Android Application Development of NFC Peer-to-Peer ModeAndroid Application Development of NFC Peer-to-Peer Mode
Android Application Development of NFC Peer-to-Peer ModeChun-Kai Wang
 
Voice encryption for gsm using arduino
Voice encryption for gsm using arduinoVoice encryption for gsm using arduino
Voice encryption for gsm using arduinoiruldaworld
 
FYP: Peer-to-Peer Communications Framework on Android Platform
FYP: Peer-to-Peer Communications Framework on Android PlatformFYP: Peer-to-Peer Communications Framework on Android Platform
FYP: Peer-to-Peer Communications Framework on Android Platformwebuiltit
 
Authentication and Ciphering
Authentication and CipheringAuthentication and Ciphering
Authentication and CipheringSokunth Che
 

Destaque (16)

RIL and Android Telephony
RIL and Android TelephonyRIL and Android Telephony
RIL and Android Telephony
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer Interface
 
Android telephony stack
Android telephony stackAndroid telephony stack
Android telephony stack
 
Android Telephony Manager and SMS
Android Telephony Manager and SMSAndroid Telephony Manager and SMS
Android Telephony Manager and SMS
 
Telephony API
Telephony APITelephony API
Telephony API
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM SystemLabmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
 
Psi android telephony_case_study_v10
Psi android telephony_case_study_v10Psi android telephony_case_study_v10
Psi android telephony_case_study_v10
 
Encrypted Voice Communications
Encrypted Voice CommunicationsEncrypted Voice Communications
Encrypted Voice Communications
 
Kernel modules
Kernel modulesKernel modules
Kernel modules
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and TipsAndroid Crash analysis and The Dalvik Garbage collector – Tools and Tips
Android Crash analysis and The Dalvik Garbage collector – Tools and Tips
 
Android Application Development of NFC Peer-to-Peer Mode
Android Application Development of NFC Peer-to-Peer ModeAndroid Application Development of NFC Peer-to-Peer Mode
Android Application Development of NFC Peer-to-Peer Mode
 
Voice encryption for gsm using arduino
Voice encryption for gsm using arduinoVoice encryption for gsm using arduino
Voice encryption for gsm using arduino
 
FYP: Peer-to-Peer Communications Framework on Android Platform
FYP: Peer-to-Peer Communications Framework on Android PlatformFYP: Peer-to-Peer Communications Framework on Android Platform
FYP: Peer-to-Peer Communications Framework on Android Platform
 
Authentication and Ciphering
Authentication and CipheringAuthentication and Ciphering
Authentication and Ciphering
 

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

Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, Greenrobot
Droidcon 2011: Gingerbread and honeycomb, Markus Junginger,  GreenrobotDroidcon 2011: Gingerbread and honeycomb, Markus Junginger,  Greenrobot
Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, GreenrobotDroidcon Berlin
 
Android Audio & OpenSL
Android Audio & OpenSLAndroid Audio & OpenSL
Android Audio & OpenSLYoss Cohen
 
Lecture02web 140phpapp01
Lecture02web 140phpapp01Lecture02web 140phpapp01
Lecture02web 140phpapp01letuan9999
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
Droidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyDroidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyBenjamin Zores
 
Introduction to Test Execution Automation Framework for Embedded Systems
Introduction to Test Execution Automation Framework for Embedded SystemsIntroduction to Test Execution Automation Framework for Embedded Systems
Introduction to Test Execution Automation Framework for Embedded SystemsHiroshiMisawa
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015Ryan Vanderwerf
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughBenjamin Zores
 
Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on LinuxGary Bisson
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android晓东 杜
 

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

Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, Greenrobot
Droidcon 2011: Gingerbread and honeycomb, Markus Junginger,  GreenrobotDroidcon 2011: Gingerbread and honeycomb, Markus Junginger,  Greenrobot
Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, Greenrobot
 
Android Audio & OpenSL
Android Audio & OpenSLAndroid Audio & OpenSL
Android Audio & OpenSL
 
Discover System Facilities inside Your Android Phone
Discover System Facilities inside Your Android Phone Discover System Facilities inside Your Android Phone
Discover System Facilities inside Your Android Phone
 
Lecture02web 140phpapp01
Lecture02web 140phpapp01Lecture02web 140phpapp01
Lecture02web 140phpapp01
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
Droidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyDroidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform Anatomy
 
Android development beginners faq
Android development  beginners faqAndroid development  beginners faq
Android development beginners faq
 
Core Android
Core AndroidCore Android
Core Android
 
Andriod
Andriod Andriod
Andriod
 
Introduction to Test Execution Automation Framework for Embedded Systems
Introduction to Test Execution Automation Framework for Embedded SystemsIntroduction to Test Execution Automation Framework for Embedded Systems
Introduction to Test Execution Automation Framework for Embedded Systems
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Hacking Android OS
Hacking Android OSHacking Android OS
Hacking Android OS
 
All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting Walkthrough
 
X Means Y
X Means YX Means Y
X Means Y
 
Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on Linux
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 

Último (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

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

  • 1. Android internals Egor Elizarov SPbSU 2012
  • 2. 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
  • 3. Lecture 10 Debugging / profiling WiFi / Bluetooth / RIL yegor.yelizarov(at)gmail.com Rev: 1.1 http://vk.com/android_internals Last update: 06/01/2012 3 Egor Elizarov SPbSU 2012
  • 4. 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
  • 5. Useful host/target configuration 5 Egor Elizarov SPbSU 2012
  • 6. 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
  • 7. Debugging approaches 7 Egor Elizarov SPbSU 2012
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. Profiling approaches 13 Egor Elizarov SPbSU 2012
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. Add LTTng support to Android 18 Egor Elizarov SPbSU 2012
  • 19. 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
  • 20. 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
  • 21. Wifi subsystem 21 Egor Elizarov SPbSU 2012
  • 22. Porting Wifi driver 22 Egor Elizarov SPbSU 2012
  • 23. 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
  • 24. Bluetooth workflow 24 Egor Elizarov SPbSU 2012
  • 25. Bluetooth subsystem 25 Egor Elizarov SPbSU 2012
  • 26. 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
  • 27. RIL subsystem 27 Egor Elizarov SPbSU 2012
  • 28. Next Time  Exam 28 Egor Elizarov SPbSU 2012
  • 29. 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
  • 30. 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
  • 31. 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