当前位置: 首页 > news >正文

[Android]service命令的使用

在前面的讨论中,我们说到,如果在客户端懒得使用aidl文件生成的接口类进行binder,可以使用IBinder的transcat方法

	    	 Parcel dataParcel = Parcel.obtain(); Parcel resultParcel = Parcel.obtain();dataParcel.writeInterfaceToken(DESCRIPTOR);//发起请求	 aProxyBinder.transact(3, dataParcel, resultParcel, 0);

还有一个更方便的binder调用测试方式,使用service命令。

service命令

看看help信息,

$ service -h
Usage: service [-h|-?]service listservice check SERVICEservice call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR | null | fd f | nfd n | afd f ] ...
Options:i32: Write the 32-bit integer N into the send parcel.i64: Write the 64-bit integer N into the send parcel.f: Write the 32-bit single-precision number N into the send parcel.d: Write the 64-bit double-precision number N into the send parcel.s16: Write the UTF-16 string STR into the send parcel.null: Write a null binder into the send parcel.fd: Write a file descriptor for the file f into the send parcel.nfd: Write the file descriptor n into the send parcel.afd: Write an ashmem file descriptor for a region containing the data fromfile f into the send parcel.

service call调用传入对应的参数信息即可,比如

service call SERVICE_name 1 i32 112

表示调用SERVICE_name这个binder服务的第1个接口方法,传入int32类型的参数值112

service的代码在

frameworks/native/cmds/

http://www.lryc.cn/news/520098.html

相关文章:

  • 【芯片封测学习专栏 -- Substrate | RDL Interposer | Si Interposer | 嵌入式硅桥(EMIB)详细介绍】
  • spring cloud注册nacos并从nacos上拉取配置文件,spring cloud不会自动读取bootstrap.yml文件
  • 【深度学习地学应用|滑坡制图、变化检测、多目标域适应、感知学习、深度学习】跨域大尺度遥感影像滑坡制图方法:基于原型引导的领域感知渐进表示学习(一)
  • Spring Boot 支持哪些日志框架
  • 【翻译】2025年华数杯国际赛数学建模题目+翻译pdf自取
  • qt 窗口(window/widget)绘制/渲染顺序 QPainter QPaintDevice Qpainter渲染 失效 无效 原因
  • TIOBE编程语言排行靠前的编程语言的吉祥物
  • 【前端动效】HTML + CSS 实现打字机效果
  • 大疆上云API连接遥控器和无人机
  • JS逆向-atob和btoa分析
  • primitive 编写着色器材质
  • 计算机视觉算法实战——车道线检测
  • 网络安全-安全散列函数,信息摘要SHA-1,MD5原理
  • 树莓派-5-GPIO的应用实验之GPIO的编码方式和SDK介绍
  • 《零基础Go语言算法实战》【题目 2-10】接口的实现
  • Win32汇编学习笔记10.OD插件
  • 在vscode中已经安装了插件Live Server,但是在命令面板确找不到
  • C# SQL ASP.NET Web
  • 联想java开发面试题及参考答案
  • Node.js中的fs模块:文件与目录操作(写入、读取、复制、移动、删除、重命名等)
  • 代码的形状:重构的方向
  • 2021 年 3 月青少年软编等考 C 语言五级真题解析
  • 华为C语言编程规范总结
  • XML 解析器:深入解析与高效应用
  • 《系统爆破:MD5易破,后台登录可爆破?》
  • 基于微信小程序的书籍销售系统设计与实现(LW+源码+讲解)
  • SpringData-Redis缓存
  • Hadoop3.3.4伪分布式环境搭建
  • 【VUE 指令学习笔记】
  • 【深度学习】布匹寻边:抓边误差小于3px【附完整链接】