IPC in Android - sharmasadhna/mylearnings GitHub Wiki
- System V IPC mechanisms are not supported
- Majorly used IPC is Binder (complete framework--> diffrrent components in different layers--> underhood all uses Binder)
- in HAL --> Binder + Shared memory, Fast message Queue
Applications uses intents, messangers to communicate with each other or services.
- For activities and broadcast receivers, **intents **are the preferred mechanism for asynchronous IPC
- messangers can send/recieve large data with handlers, and this messanger object can be shared b/w applications via intents.
Evey component in android can be restricted with exported=false/true in xml or by setting the permissions
*****************for networking, always use https over http and sslsocket over normal socket Some applications use localhost network ports for handling sensitive IPC. You should not use this approach because these interfaces are accessible by other applications on the device. Instead, use an Android IPC mechanism where authentication is possible, such as with a Service. Binding to INADDR_ANY is worse than using loopback because then your application may receive requests from anywhere.
Binder IPC: binder is an IPC and Remote method invocation framework in Android.
Client --> Client Stub (Binder Proxies) ----> Binder driver /dev/binder ---> Server Stub (Binder Proxies) ---> server
Client's send request to the relevant *ServiceManager which has already registered the service, ServiceManager talks to the /dev/binder (using ioctl calls) and send the request to service and return response back.
With scatter gatther concept in Treble, there is only 1 copy of data is made from client to Server in the whole process. To manage binder communication across all the layers--> 3 binder contexts are created thus there different /dev/*binder nodes and different *Managers
binder driver:
/dev/binder and /dev/hwbinder libbinder libvndbinder libhwbinder
https://www.pathpartnertech.com/android-binder-ipc-framework-scatter-gather-optimization/