Android applications threads most often communicate within a process, sharing the process’s memory as discussed in Chapter 4. However, communication across process boundaries—i.e. Interprocess Communication (IPC)—is supported by the Android platform through the Binder Framework, that manages the data transactions when there is no shared memory area between the threads.
The most common IPC use cases are handled by high-level components in Android, such as intents, system services, content providers, etc. They can be used by an application without it having to know whether it communicates within the process or between processes. Sometimes, however, it is necessary for an application to define a more explicit communication model, and be more involved in the actual communication. This chapter covers how threads communicate across process boundaries, which includes:
IPC is managed by the Linux OS, which supports several IPC techniques: signals, pipes, message queues, semaphores, and shared memory. In Android’s modified Linux kernel the Linux IPC techniques have been replaced by the Binder Framework, which enables a Remote Procedure Call (RPC) mechanism between processes; a client process can call remote methods in a server process as if the methods were executed locally. Hence, data can be passed to ...