Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of calling C++ binder?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article, "what is the process of calling C++ binder?", so the editor summarizes the following, with detailed contents and clear steps, which can be used for reference. I hope you can get something after reading this article. Let's take a look at this "C++ binder call process is what" article.

This paper mainly receives the process that the client transfers to the server through binder, that is, the process from transact to onTransact.

A request from the client

Step 1:transact calls remote's transact in one step, and the remote object is an IBinder instance obtained through ServiceManager.

Step 2:BinderProxy:transact: calling transactNative

Step 3:android_util_Binder:android_os_BinderProxy_transact

Step 4:BpBinder:transact

Step 5:IPCThreadState:transact, call writeTransactionData to write the data to mOut, and then call waitForResponse to call talkWithDriver to write the data to the underlying driver. If there is a result, it will read the result to mIn.

Server processing:

IPCThreadState:joinThreadPool, there is a loop, which reads and executes the underlying data continuously through getAndExecuteCommand. When the command sent by the client is processed, it is BR_TRANSACTION, and the transact of BBinder is called for processing.

Step 6: BBinder:transact- > onTransact. This time, the implementation of the onTransact,java layer in C layer is also realized through the encapsulation of C++ layer.

The principle of binder is simply that two processes have a piece of memory mapped to the same block of physical memory, if it is not mapped, then the two processes use a logical address, and the physical memory will not be mapped to the same block of memory, so mapping and memory sharing memory to achieve communication is the essential work of binder.

The above is the content of this article on "what is the process of calling C++ binder". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 219

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report