Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"In/out/inout" in a AIDL interface parameter value?

I'm programming a radio streaming app. I run the "radio playing" as a remote Service by using AIDL interface technique to communicate with the Service. But I don't really understand one thing.

What is the "out" in a AIDL interface parameter value?

Like this:

String doSomething(in String a, out String[] b); 

I understand "in", that is sending data to the remote when the method is called from activity.

What is the "out", and why we need "in" and "out" in same method? In which case are they("out/inout") used? Why is the String[] "out"?

Please help..

like image 400
Theepan Karthigesan Avatar asked Jan 15 '11 14:01

Theepan Karthigesan


People also ask

What is oneway in AIDL?

The oneway keyword modifies the behavior of remote calls. When used, a remote call does not block; it simply sends the transaction data and immediately returns. The implementation of the interface eventually receives this as a regular call from the Binder thread pool as a normal remote call.

What is AIDL in Android example?

The Android Interface Definition Language (AIDL) is similar to other IDLs you might have worked with. It allows you to define the programming interface that both the client and service agree upon in order to communicate with each other using interprocess communication (IPC).

What is AIDL which data types are supported by AIDL?

all native Java data types like int,long, char and Boolean.


1 Answers

In AIDL, the out tag specifies an output-only parameter. In other words, it's a parameter that contains no interesting data on input, but will be filled with data during the method.

For example, a method that copies an array of bytes might be specified like this:

void copyArray(in byte[] source, out byte[] dest); 

The inout tag indicates that the parameter has meaning on both input and output. For example:

void charsToUpper(inout char[] chars); 

This is important because the contents of every parameter must be marshalled (serialized, transmitted, received, and deserialized). The in/out tags allow the Binder to skip the marshalling step for better performance.

like image 176
gladed Avatar answered Sep 24 '22 19:09

gladed