I. IPC Communication settings
1. androidmanifest.xml file
An app can occupy multiple processes
<service android:name= ". MyService "
android:process= ": Remote" >//independent one process named remote
Android Each process has a VM
Second, IBinder interface
1, using Java interface defined interface, for cross-process calls
The IPC communication of the Android framework relies on a single IBinder interface, the client invokes the Transact (business) function of the IBinder interface, and calls the remote Ontransact function through the IPC mechanism
2, Android source code, Java layer of the IBinder interface is defined in the Ibinder.java codes of the document
public interface ibinder{
Code Code PARCEL (package) The data returned by the outgoing data
public boolean transact (int code, PARCEL data, Parcel replay, int flags) throws RemoteException
}
3, IBinder two implementation class
Binders and Binderproxy
IBinder---> binderproxy (Agent)
------------------------IPC mechanism
IBinder---> Binder
4. Basic process
Client Side Binderproxy
|
Java---> Transact () (Transact () function for JNI local modules)---> Binder Driver Drive Service
|
--------------------------Linux Forwarding-----------------
|
Service-Side Binder
<--init () calls Java--
---> exectransact ()---> ontransact ()---> IOC (Implementation class implementation ontransact ())
Android Process II