Android internals 09 - Sensors, Power Management, Input subsystem, Data storage (rev_1.1)

4,870 views

Published on

Course: Android Internals
Lecture 9: Sensors, Power Management, Input subsystem, Data storage

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,870
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
464
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Android internals 09 - Sensors, Power Management, Input subsystem, Data storage (rev_1.1)

  1. 1. Android internals Egor Elizarov SPbSU 2012
  2. 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. 3. Lecture 9 Power Management Input subsystem Sensors Data storage yegor.yelizarov(at)gmail.comRev: 1.1 http://vk.com/android_internalsLast update: 06/01/2012 3 Egor Elizarov SPbSU 2012
  4. 4. Previous time Linux boot flow Android boot flow Android init Main media related services Standard media player components Video HW acceleration 4 Egor Elizarov SPbSU 2012
  5. 5. Power Managment basics An idle CPU should only wake up when needed Unused hardware and devices should be disabled completely Low activity should translate to low wattage PM standards – ACPI (Advanced Configuration and Power Interface) - Mostly x86 specific – APM (Advanced Power Management) - outdated 5 Egor Elizarov SPbSU 2012
  6. 6. Linux suspend/resume flow 6 Egor Elizarov SPbSU 2012
  7. 7. Android Power Managment Wakelocks WakeLock Type CPU Screen Keyboard PARTIAL_WAKE_LOCK On* Off Off SCREEN_DIM_WAKE_LOCK On Dim Off SCREEN_BRIGHT_WAKE_LOCK On Bright Off FULL_WAKE_LOCK On Bright Bright*If you hold a partial wakelock, the CPU will continue to run, irrespective of any timers and even after the user presses the powerbutton. In all other wakelocks, the CPU will run, but the user can still put the device to sleep using the power button. Early Suspend (disable some devices) Interaction with kernel through SysFs Android kernel PM on top of Linux PM 7 Egor Elizarov SPbSU 2012
  8. 8. Power Managment subsystem 8 Egor Elizarov SPbSU 2012
  9. 9. HID Input device classes Keyboards (qwerty, hard keys) Cursor (Mouse, trackball) Multitouch (Touchscreen) External (IR/Bluetooth remote control) etc. (frameworks/base/services/input/EventHub.h) 9 Egor Elizarov SPbSU 2012
  10. 10. Input subsystem 10 Egor Elizarov SPbSU 2012
  11. 11. Control points Driver and Firmware Configuration Board Configuration Properties Resource Overlays (frameworks/base/core/res/res/values/config.xml) Key Maps (Ex: device/samsung/tuna/tuna-gpio-keypad.kl) Input Device Configuration Files (Ex: device/samsung/tuna/Melfas_MMSxxx_Touchscreen.idc) 11 Egor Elizarov SPbSU 2012
  12. 12. Event codes 12 Egor Elizarov SPbSU 2012
  13. 13. System files● Key layout files (device/samsung/tuna/tuna-gpio-keypad.kl)● Key character map files (device/samsung/tuna/tuna-gpio-keypad.kl)● Input device configuration files (device/samsung/tuna/Melfas_MMSxxx_T ouchscreen.idc) 13 Egor Elizarov SPbSU 2012
  14. 14. Sensor types 14 Egor Elizarov SPbSU 2012
  15. 15. Sensor subsystem 15 Egor Elizarov SPbSU 2012
  16. 16. HAL/Kernel interaction No unified interface SysFs DevFs Industrial input output system (kernel/drivers/staging/iio) 16 Egor Elizarov SPbSU 2012
  17. 17. Sensor settings 17 Egor Elizarov SPbSU 2012
  18. 18. Input noise reduction Needed for both sensors and input devices Usually implemented in HW or FW Precision vs jittering Using of previous/next values 18 Egor Elizarov SPbSU 2012
  19. 19. Raw data example 19 Egor Elizarov SPbSU 2012
  20. 20. Noise reduction approaches Polynomial approximation Evaluation of derivatives Integrators Kalman filters etc 20 Egor Elizarov SPbSU 2012
  21. 21. Data storage Shared preferencies Internal storage External storage SQLite DB Network connection 21 Egor Elizarov SPbSU 2012
  22. 22. FS types RootFs (linux permission support)  Ext*  yaffs  ubifs● External storage (same uid/gid for all files)  Fat  Ntfs / ntfs-3g 22 Egor Elizarov SPbSU 2012
  23. 23. External storage 23 Egor Elizarov SPbSU 2012
  24. 24. SQLite DB 24 Egor Elizarov SPbSU 2012
  25. 25. Next Time Profiling / Debugging WiFi / BT / RIL 25 Egor Elizarov SPbSU 2012
  26. 26. Useful links http://vk.com/android_internals http://docs.fedoraproject.org/en- US/Fedora/15/html/Power_Management_Guide/index.html http://kzjblog.appspot.com/2010/11/20/suspend-en.html http://developer.android.com/reference/android/os/PowerManager.html http://source.android.com/tech/input/overview.html 26 Egor Elizarov SPbSU 2012
  27. 27. Useful links (2) http://developer.android.com/guide/topics/sensors/index.html Savitzky, A.; Golay, M.J.E. (1964). "Smoothing and Differentiation of Data by Simplified Least Squares Procedures". Analytical Chemistry 36 (8): 1627–1639. doi:10.1021/ac60214a047 http://developer.android.com/guide/topics/data/data-storage.html 27 Egor Elizarov SPbSU 2012
  28. 28. 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) 28 Egor Elizarov SPbSU 2012

×