Your SlideShare is downloading. ×
Android internals 06 - Binder, Typical subsystem (rev_1.1)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Android internals 06 - Binder, Typical subsystem (rev_1.1)

3,830

Published on

Course: Android Internals …

Course: Android Internals
Lecture 6: Binder, Typical subsystem

Published in: Education, Technology
0 Comments
15 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,830
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
418
Comments
0
Likes
15
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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 6 Android IPC Typical Android subsystem yegor.yelizarov(at)gmail.comRev: 1.1Last update: 06/01/2012 http://vk.com/android_internals 3 Egor Elizarov SPbSU 2012
  • 4. Previous time VM types Virtualization approaches Dalvik VM features Interpreter core types JIT algorithm Android application start up process 4 Egor Elizarov SPbSU 2012
  • 5. IPC Approaches Classic – System V IPC – Posix IPC Modern – Binder – Cross Memory Attach (CMA) – KNEM – Kdbus 5 Egor Elizarov SPbSU 2012
  • 6. Linux IPC Pipe Socket Signal Semaphore Message queue Shared memory 6 Egor Elizarov SPbSU 2012
  • 7. 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
  • 8. 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
  • 9. Binder facilities 9 Egor Elizarov SPbSU 2012
  • 10. 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
  • 11. RPC main idea 11 Egor Elizarov SPbSU 2012
  • 12. OOP patterns used in Binder Bridge Mediator Proxy 12 Egor Elizarov SPbSU 2012
  • 13. Application layer 13 Egor Elizarov SPbSU 2012
  • 14. Application layer transaction 14 Egor Elizarov SPbSU 2012
  • 15. Android Interface Definition Language 15 Egor Elizarov SPbSU 2012
  • 16. AIDL example 16 Egor Elizarov SPbSU 2012
  • 17. Application layer internals 17 Egor Elizarov SPbSU 2012
  • 18. 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
  • 19. Service Manager workflow 19 Egor Elizarov SPbSU 2012
  • 20. Middleware layer Provide binder facilities to java framework Marshalling/unmarshalling Parcels Interaction with kernel Managing threads 20 Egor Elizarov SPbSU 2012
  • 21. Middleware layer internals 21 Egor Elizarov SPbSU 2012
  • 22. Kernel layer 22 Egor Elizarov SPbSU 2012
  • 23. Binder in action 23 Egor Elizarov SPbSU 2012
  • 24. 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
  • 25. Typical subsystem scheme 25 Egor Elizarov SPbSU 2012
  • 26. Next Time Graphic subsystem HW acceleration 26 Egor Elizarov SPbSU 2012
  • 27. Useful links http://vk.com/android_internals http://0xlab.org/~jserv/android-binder-ipc.pdf http://cs736-android.pbworks.com/w/page/5834468/IPC %20Binder http://www.angryredplanet.com/~hackbod/openbinder/docs/ html/BinderIPCMechanism.html http://mylifewithandroid.blogspot.com/2008/01/about- binders.html 27 Egor Elizarov SPbSU 2012
  • 28. Useful links (2) http://free-electrons.com/doc/posix-api.pdf http://lwn.net/Articles/466304/ http://www.slideshare.net/opersys/android- internals https://github.com/keesj/gomo/wiki/AndroidNati veBinder http://lwn.net/Articles/472984/ 28 Egor Elizarov SPbSU 2012
  • 29. 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

×