in, out, inout
Unlike Java there are three directional tags that can be specified in the method prototypes when defining an AIDL interface. These tags indicate which way the data will go. Let’s see an example first:
package com.pycitup.pyc.aidl;
import com.example.app.Bar;
interface IBoundService {
void getAll(out
void save(inout Bar bar);
void delete(in Bar bar);
}
in
means that the object is transfered from client to service and only used for inputs. If any changes are made to thebar
object in the service then they won’t reflect in the client.out
indicates that the object has no relevant data and will be populated by the service and returned as a response.inout
means that the data gets copied, i.e., if any changes are made tobar
in the service then that’ll also reflect in the client’sbar
object.
說得很詳細~~~~