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

  • Published on

  • View

  • Download


Course: Android Internals Lecture 6: Binder, Typical subsystem


1. Android internals Egor Elizarov SPbSU 2012 2. Legal info Android internals by Egor Elizarov is licensed under aCreative 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 ofthese trademarks and pictures is subject to owners permissions. Corrections, suggestions, contributions and translations are welcome!2 Egor Elizarov SPbSU 2012 3. Lecture 6Android IPCTypical Android subsystemyegor.yelizarov(at)gmail.comRev: 1.1Last update: 06/01/2012 Egor Elizarov SPbSU 2012 4. Previous timeVM typesVirtualization approachesDalvik VM featuresInterpreter core typesJIT algorithmAndroid application start up process 4 Egor Elizarov SPbSU 2012 5. IPC ApproachesClassic System V IPC Posix IPCModern Binder Cross Memory Attach (CMA) KNEM Kdbus 5Egor Elizarov SPbSU 2012 6. Linux IPCPipeSocketSignalSemaphoreMessage queueShared memory6 Egor Elizarov SPbSU 2012 7. BinderLightweight IPC/RPCCustomized re-implementation of Open BinderBeOS -> ACCESS/PalmOS -> Open BinderPer process thread pool for processing requestsSynchronous calls between processesZero copy message transmission 7Egor Elizarov SPbSU 2012 8. Socket vs Binder BinderSocket Associated with PIDAssociated with FD Local onlyNetwork transparency Communication viaStream IO read/write IOCTL 8Egor Elizarov SPbSU 2012 9. Binder facilities9 Egor Elizarov SPbSU 2012 10. Parcels and marshallingParcel is a message to be send through BinderDifferent types of data can be marshalled(packed) in parcelsTo make remote procedure call bindermarshalles function arguments and meta data,sends it to remote process and unpacks theresults10Egor Elizarov SPbSU 2012 11. RPC main idea11Egor Elizarov SPbSU 2012 12. OOP patterns used in BinderBridgeMediatorProxy 12Egor Elizarov SPbSU 2012 13. Application layer13Egor Elizarov SPbSU 2012 14. Application layer transaction14Egor Elizarov SPbSU 2012 15. Android Interface Definition Language15Egor Elizarov SPbSU 2012 16. AIDL example 16Egor Elizarov SPbSU 2012 17. Application layer internals 17 Egor Elizarov SPbSU 2012 18. Service ManagerSpecial Binder node with known addressProvide information about existing servicesAll services should be registered in ServiceManager (name & binder token)Command line tool: adb servicesp binder = defaultServiceManager()->getService(String16("media.player")); 18Egor Elizarov SPbSU 2012 19. Service Manager workflow 19 Egor Elizarov SPbSU 2012 20. Middleware layerProvide binder facilities to java frameworkMarshalling/unmarshalling ParcelsInteraction with kernelManaging threads20Egor Elizarov SPbSU 2012 21. Middleware layer internals21 Egor Elizarov SPbSU 2012 22. Kernel layer 22Egor Elizarov SPbSU 2012 23. Binder in action 23Egor Elizarov SPbSU 2012 24. Typical subsytemMain logic is implemented in frameworksC++ layer contains some servers (Ex:mediaserver) connected to java framework viaBinderUse standard external libraries (Ex: libBluez)HAL as interface for HW vendors 24 Egor Elizarov SPbSU 2012 25. Typical subsystem scheme 25Egor Elizarov SPbSU 2012 26. Next TimeGraphic subsystemHW acceleration26 Egor Elizarov SPbSU 2012 27. Useful links Egor Elizarov SPbSU 2012 28. Useful links (2) 28 Egor Elizarov SPbSU 2012 29. Thanks toSergey Matyukevich for review and advices( F. Fominykh for review and advicesNikita Shulga for advices and notes( Tolstolytkin for advices and notes( Elizarov SPbSU 2012


View more >