AIDL中的in,out,inout

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 the bar 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 to bar in the service then that’ll also reflect in the client’s bar object.


說得很詳細~~~~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章