The following articlesArticleIs a more in-depth analysis of the binder mechanism.
Directory
1.Android-Binder Mechanism-servicemanager
2. Android-Binder Mechanism-General Service Registration
3. Android-Binder Mechanism-get common service
4. Android-Binder Mechanism-interaction between client and common service
5. Android-Binder Mechanism-binder framework Summary
6. Android-Binder Mechanism-processstate and ipcthreadstate
7. Android-Binder Mechanism-driver
Android-Binder Mechanism-binder framework Summary
UML
Description
1. Take the vertical line of ixxx in the middle as the standard, and the client processes on the left. Their names are similar to BP *** and server processes on the right. Their names are similar to bn ***;
2. take a horizontal dotted line in the middle as the boundary line. The preceding line executes specific services, such as addservcie, getservice, and startpreview. They are all common services and data interaction is executed below, it means that the above business data is packaged into the data packet structure defined by the binder, and then sent or received through the binder driver;
3. in the first article, servicemanager is not built based on the BN *** class, but the version I used is not built like this. servicemanager can also be built using bn, built with BP *** and BN ***, letProgramReadingCodeIt is easier and the code structure is more concise, so it is basically done through BP *** and BN;
4. both bn *** and BP *** inherit two base classes: ixxx and bbinder (or bprefbase ), in fact, it is also explained that bpxxx and bnxxx both need to complete the tasks at the business layer and also need to execute the corresponding tasks of data transmission;
5. ipcthreadstate is a role that really deals with drivers. A process can have several;
6. The processstate task is very simple. One is to open the binder device for ipcthreadstate, and the other is to get servicemanager;
7. The client must have at least two servers: servicemanager and xxxservice;
Through this figure, have you found many rules for complicated binder;