service可以列出android使用的所有服务,还可以通过Binder与实现了aidl的服务通信 mmm frameworks/native/cmds/service编译出来的service root@tcc893x:/ # /system/bin/service Usage: service [-h|-?] service list service check SERVICE service call SERVICE CODE [i32 INT | s16 STR] ... Options: i32: Write the integer INT into the send parcel. s16: Write the UTF-16 string STR into the send parcel.
1) list的使用 root@tcc893x:/ # service list Found 92 services: 0 goodbye: [] 1 hello: [] 2 AutoService: [com.semisky.midLevel.aidl.IAutoIPCService] 3 McuService: [com.semisky.midLevel.aidl.IMcuService] 4 KeyEventService: [com.semisky.midLevel.aidl.IKeyEventService] 5 RadioService: [com.semisky.midLevel.aidl.IRadioService] 6 CarInfoService: [com.semisky.midLevel.aidl.ICarInfoService] 7 sip: [android.net.sip.ISipService] 8 phone: [com.android.internal.telephony.ITelephony] 2)call的使用 调用服务定义的方法service call CarInfoService 4 i32 7,将会执行CarInfoService.test(7),其中4就是代表 void test(int code) aidl文件在eclipse里面会自动生产java文件,名字和aidl相同。 每个方法自动对于一个code,列如ICarInfoService.aidl里面的test的方法 /* *ICarInfoService.aidl */ interface ICarInfoService { void requestWaitRsgInit(IServiceCallBack serviceCallBack,String packageName,int grpId, int subId, in byte[] reqData);  void observer(IServiceCallBack serviceCallBack,String packageName,int grpId, int subId); void unregisterListener(IServiceCallBack serviceCallBack,String packageName); void test(int code); } eclipse自动给test()分配 android.os.IBinder.FIRST_CALL_TRANSACTION + 3 = 4 static final int TRANSACTION_requestWaitRsgInit = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); static final int TRANSACTION_observer = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); static final int TRANSACTION_unregisterListener = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2); static final int TRANSACTION_test = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);

更多相关文章

  1. Android文件浏览器的开发
  2. android布局文件中的include
  3. 整理android环境离线安装搭建方法——支持android 2.3.3和androi
  4. Android上传文件到Web服务器,PHP接收文件(二)
  5. Android电话拨号器实现方法

随机推荐

  1. 不使用布局文件,代码中自定义界面
  2. android 工具类 数据库管理
  3. Android中字体颜色大全-146种(完整版)
  4. Android(安卓)Studio入门小例子
  5. android按键模拟测试
  6. android 里面的测量单位
  7. Android录制视频,可限制时长,限大小
  8. android四种不同的事件实现
  9. Utilize Avahi Libraries in Android(安
  10. Android:入门级Android开发者应该知道的