Summary of Andorid Binder Inter-process communication---

Source: Internet
Author: User

One, server and service Manager interprocess communication

When the service manager process starts, the Service Manager entity object has been created and there is no Service Manager local object.

The server first gets the server proxy object with a handle value of 0. There is no server reference object.

Server----->service Manager

server locates the target process: Locate the Service Manager entity object according to the handle value 0 of the server proxy object, and then locate the service manger process, which is the target process.

Data passed by the Server : Includes the flat_binder_object struct, where handle is the handle value of the reference object for Service Manager, the service The manager's Reference object references the server's entity object, and the server's entity object references the server's local object. (binder_transaction function case binder_type_binder).

Service Manager processes data: Svcinfo struct PTR is a reference object handle value for Servicer Manager, and name is the string passed in.

Service Manager----->server

Service Manager locates the target process: The target process is found by Thread->transaction_stack->from, the server process.

Data passed by Service Manager : Returns the correct value of 0.

Server processes data: Server loops wait.


II. Client and service Manager interprocess communication

When the service manager process starts, the Service Manager entity object has been created and there is no local object for service manager.

The client first obtains the client proxy object with a handle value of 0. No Client Reference object.

Client----->service Manager

Client Locate the target process: Locate the Service Manager entity object based on the handle value 0 of the Client process proxy object, and then locate the service manger process, which is the target process.

data passed by Client:svcinfo struct name that string.

Service Manager working with data: getting The binder_object struct, in which pointer points to the handle value of the Service Manager's Reference object, which refers to the entity object of the server.

Service Manager----->Client

< Span style= "font-size:14px" >         service Manager Span style= "font-size:14px" > Find the target process:

< Span style= "font-size:14px" >          service Manager The data passed: the contents of the passed Flat_binder_object struct, and the handle value of the reference object (the entity object referencing the server) that was handle to the client. binder_transaction function case  binder_type_handle

Client Process data: Returns the client proxy object (the handle value is the handle value of the client-referenced object above).


III. client and server interprocess communication

The client proxy object, client reference object, server entity object, Server local object, is now available.

Client ----->server

Client Locate the target process: based on the handle value of the client proxy object, the client reference object is first found, and the object is referenced by the client Then locate the server entity object, and through the server entity object, locate the server process, which is the target process.

data passed by the Client: A descriptive descriptor used for matching. And such as the Get_value command.

Server processing data: Locate the server local object based on the found server entity object, and use the server local object to run the Get_value command to get the value .

Server----->Client

Server Locate the target process: Locate the target process, which is the client process, based on Thread->transaction_stack->from.

Server data passed: The passed data return value is the value obtained by Getval ( using the server local object to run the Get_value command to get the value ).

Client processing data: Reads the results returned above.

Summary of Andorid Binder Inter-process communication---

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.