Android system-process-AIDL

introduction:

The inter-process communication of the Android system is mainly Binder, and AIDL is an Android interface definition language, mainly to realize cross-process communication more simply and conveniently.

Concept and understanding:

AIDL:Android Interface Definition Language

Serialization: An object can be represented as a sequence of bytes that contains the object type, the object's data, and its data type.

Deserialization: Through deserialization, the object can be recreated in memory according to the content in the byte sequence.

Main application scenarios:

1) Permanently save the object, save the byte sequence of the object to a local file.

2) Pass data over the network through serialized objects

3) Pass data between processes through serialized objects

Serializable interface: Serializable is quite simple to implement serialization, just add the specified serialVersionUID in the class declaration. The serialization and deserialization of objects are done automatically by the system

 pacelable interface: Android-specific way to achieve serialization. As long as this interface is implemented, objects of this class can be serialized and passed through Intent and Binder. The functions that need to be implemented in the serialization process include:

1) Serialization, WriteToPacel;

2) Deserialization, ReadFromParcel;

3) Content description, describeContents;

https://blog.csdn.net/hust_edu_csdn_123/article/details/100015327

AIDL specifies the direction of data flow

 in
where in means that the data can only flow from the client to the server, which means that the server will receive a complete data of that object, but the object on the client will not change due to the modification of the passed parameters by the server;
out
out Indicates that data can only flow from the server to the client, which means that the server will receive the empty object of that object, but the client will change synchronously after the server modifies the received empty object.
inout
inout means that data can flow in both directions between the server and the client. When nout is a directional tag, the server will receive the complete information of the object from the client, and the client will synchronize the Detailed explanation of AIDL usage for any change of object
- aidl usage - sunnyPP123's blog - CSDN blog

 

Guess you like

Origin blog.csdn.net/haigand/article/details/132352588