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
Binder Lightweight IPC/RPC Customized re-implementation of Open Binder BeOS -> ACCESS/PalmOS -> Open Binder Per process thread pool for processing requests Synchronous calls between processes Zero copy message transmission 7 Egor Elizarov SPbSU 2012
Socket vs Binder Binder Socket Associated with PID Associated with FD Local only Network transparency Communication via Stream IO read/write IOCTL 8 Egor Elizarov SPbSU 2012
Parcels and marshalling Parcel is a message to be send through Binder Different types of data can be marshalled (packed) in parcels To make remote procedure call binder marshalles function arguments and meta data, sends it to remote process and unpacks the results 10 Egor Elizarov SPbSU 2012
Service Manager Special Binder node with known address Provide information about existing services All services should be registered in Service Manager (name & binder token) Command line tool: adb service sp<IBinder> binder = defaultServiceManager() ->getService(String16("media.player")); 18 Egor Elizarov SPbSU 2012
Service Manager workflow 19 Egor Elizarov SPbSU 2012
Middleware layer Provide binder facilities to java framework Marshalling/unmarshalling Parcels Interaction with kernel Managing threads 20 Egor Elizarov SPbSU 2012
Typical subsytem Main logic is implemented in frameworks C++ layer contains some servers (Ex: mediaserver) connected to java framework via Binder Use standard external libraries (Ex: libBluez) HAL as interface for HW vendors 24 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 Nikita Shulga for advices and notes (http://www.linkedin.com/pub/nikita-shulga/8/582/287) Grigory Tolstolytkin for advices and notes (http://www.linkedin.com/pub/grigory- tolstolytkin/2a/b41/74) 29 Egor Elizarov SPbSU 2012
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.