I'm new to programming applications for the Android OS. As far as general architecture of the OS goes, I understand that processes are implemented as Linux processes and that each one is sandboxed.
However, I'm utterly confused on the IPCs and syscalls (if any) used. I know that the IBinder is a form of this; parcels are sent back and forth between processes and Bundles are array forms of parcels (?). But even that is still unfamiliar to me. Same with Intents. All in all, I don't understand what kinds of IPCs are implemented and how.
Could someone briefly explain to me the specific methods used by user level applications in Android OS to communicate with each other and the OS? I've done kernel programming and played with various IPCs in Linux (Ubuntu and Debian) so it would help immensely if this was all explained in relation to what I'm familiar with...
Thanks in advance!
Android is a Service Oriented Architecture which means that all the applications on a device are made up of components that request work be performed by other components using a high level messages called Intents. While behind the scenes Intents that span applications are sent using Binder which relies on a special Android flavor of shared memory, the goal is for applications developers to be blissfully unaware of the implementation. The only requirement is, when a component wants to pass an object along with its "intention" to request work by another component that lives in different process, that object must be parcelable (think serializable). Additionally, in order for applications to use Intents of other applications, those Intents must be published in the manifest file using an Intent Filter.
An application that wanted to trigger the display of a webpage would have code that looks like this:
Another application that was capable of servicing that Intent by displaying the webpage would define the following intent-filters in its manifest so it would catch the Intent sent by the other application:
Beyond using Intents, you can create objects with proxy objects using AIDL that allow you to perform remote procedure calls across the process boundary.
You probably need not be concerned with how libc is performing syscalls since you are running inside a VM and are several levels removed from them. As far as "normal" IPC goes, you have sockets but you don't have System V Shared Memory as it was deemed problematic and removed.
In its most basic form, an intent is bundle of data that is sent to an instance of a specified object so that it can take it and perform some action with it. For instance, you could have a URL that you got from an RSS feed, and you want to open it in a browser that may or may not be inside your application. You would create an intent, including what target object (Activity) you want to recieve your intent and some data that you want to send to that object. Objects can have recievers, which accept intents, and are registered such that if you create an intent to say, open the url with the browser, Android will recognize that your "intent" is to use the web browser object. Since you pass along with it a URL, then the browser application can pick that up and do something with it. Intents are very flexible, and can be very specific messages, so you can send an intent to a specific object with a ComponentName specified, or you can leave that out and just add a category and Android will prompt the user with an option of all objects that say they are an object of that category ("Web Browsers" for example, and the message will be sent to whatever object (again, really just an Activity) that the user selected.
So, briefly, you have:
For a great guide on intents, just take a minute to read thid this, it's well worth it:
Android Dev Guide: Intents and Intent Filters