+ All Categories
Home > Technology > Android internals 09 - Sensors, Power Management, Input subsystem, Data storage (rev_1.1)

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

Date post: 19-May-2015
Category:
Upload: egor-elizarov
View: 3,953 times
Download: 5 times
Share this document with a friend
Description:
Course: Android Internals Lecture 9: Sensors, Power Management, Input subsystem, Data storage
28
Android internals Egor Elizarov SPbSU 2012
Transcript
Page 1: Android internals 09 - Sensors, Power Management, Input subsystem, Data storage (rev_1.1)

Android internalsEgor ElizarovSPbSU 2012

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

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!

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

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

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

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

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

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

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

Egor Elizarov SPbSU 20126

Linux suspend/resume flow

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

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.

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

Egor Elizarov SPbSU 20128

Power Managment subsystem

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

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)

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

Egor Elizarov SPbSU 201210

Input subsystem

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

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)

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

Egor Elizarov SPbSU 201212

Event codes

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

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)

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

Egor Elizarov SPbSU 201214

Sensor types

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

Egor Elizarov SPbSU 201215

Sensor subsystem

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

Egor Elizarov SPbSU 201216

HAL/Kernel interaction

No unified interface

SysFs

DevFs

Industrial input output system (kernel/drivers/staging/iio)

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

Egor Elizarov SPbSU 201217

Sensor settings

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

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

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

Egor Elizarov SPbSU 201219

Raw data example

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

Egor Elizarov SPbSU 201220

Noise reduction approaches

Polynomial approximation

Evaluation of derivatives

Integrators

Kalman filters

etc

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

Egor Elizarov SPbSU 201221

Data storage

Shared preferencies

Internal storage

External storage

SQLite DB

Network connection

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

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

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

Egor Elizarov SPbSU 201223

External storage

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

Egor Elizarov SPbSU 201224

SQLite DB

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

Egor Elizarov SPbSU 201225

Next Time

Profiling / Debugging

WiFi / BT / RIL

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

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

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

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

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

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)


Recommended