Upload
egor-elizarov
View
3.954
Download
5
Embed Size (px)
DESCRIPTION
Course: Android Internals Lecture 9: Sensors, Power Management, Input subsystem, Data storage
Citation preview
Android internalsEgor ElizarovSPbSU 2012
Egor Elizarov SPbSU 20122
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!
Egor Elizarov SPbSU 20123
Lecture 9
Power Management
Input subsystem
Sensors
Data storage
yegor.yelizarov(at)gmail.com
http://vk.com/android_internalsRev: 1.1Last update: 06/01/2012
Egor Elizarov SPbSU 20124
Previous time
Linux boot flow
Android boot flow
Android init
Main media related services
Standard media player components
Video HW acceleration
Egor Elizarov SPbSU 20125
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
Egor Elizarov SPbSU 20126
Linux suspend/resume flow
Egor Elizarov SPbSU 20127
Android Power Managment
Wakelocks
Early Suspend (disable some devices)
Interaction with kernel through SysFs
Android kernel PM on top of Linux PM
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 power button. In all other wakelocks, the CPU will run, but the user can still put the device to sleep using the power button.
Egor Elizarov SPbSU 20128
Power Managment subsystem
Egor Elizarov SPbSU 20129
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)
Egor Elizarov SPbSU 201210
Input subsystem
Egor Elizarov SPbSU 201211
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)
Egor Elizarov SPbSU 201212
Event codes
Egor Elizarov SPbSU 201213
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_Touchscreen.idc)
Egor Elizarov SPbSU 201214
Sensor types
Egor Elizarov SPbSU 201215
Sensor subsystem
Egor Elizarov SPbSU 201216
HAL/Kernel interaction
No unified interface
SysFs
DevFs
Industrial input output system (kernel/drivers/staging/iio)
Egor Elizarov SPbSU 201217
Sensor settings
Egor Elizarov SPbSU 201218
Input noise reduction
Needed for both sensors and input devices
Usually implemented in HW or FW
Precision vs jittering
Using of previous/next values
Egor Elizarov SPbSU 201219
Raw data example
Egor Elizarov SPbSU 201220
Noise reduction approaches
Polynomial approximation
Evaluation of derivatives
Integrators
Kalman filters
etc
Egor Elizarov SPbSU 201221
Data storage
Shared preferencies
Internal storage
External storage
SQLite DB
Network connection
Egor Elizarov SPbSU 201222
FS types
RootFs (linux permission support) Ext* yaffs ubifs
● External storage (same uid/gid for all files) Fat Ntfs / ntfs-3g
Egor Elizarov SPbSU 201223
External storage
Egor Elizarov SPbSU 201224
SQLite DB
Egor Elizarov SPbSU 201225
Next Time
Profiling / Debugging
WiFi / BT / RIL
Egor Elizarov SPbSU 201226
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
Egor Elizarov SPbSU 201227
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
Egor Elizarov SPbSU 201228
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)