认识IBinder和Binder
IBinder源码:
package android.os;import android.annotation.NonNull;
import android.annotation.Nullable;import java.io.FileDescriptor;public interface IBinder {/*** The first transaction code available for user commands.*/int FIRST_CALL_TRANSACTION = 0x00000001;/*** The last transaction code available for user commands.*/int LAST_CALL_TRANSACTION = 0x00ffffff;/*** IBinder protocol transaction code: pingBinder().*/int PING_TRANSACTION = ('_'<<24)|('P'<<16)|('N'<<8)|'G';/*** IBinder protocol transaction code: dump internal state.*/int DUMP_TRANSACTION = ('_'<<24)|('D'<<16)|('M'<<8)|'P';/*** IBinder protocol transaction code: execute a shell command.* @hide*/int SHELL_COMMAND_TRANSACTION = ('_'<<24)|('C'<<16)|('M'<<8)|'D';/*** IBinder protocol transaction code: interrogate the recipient side* of the transaction for its canonical interface descriptor.*/int INTERFACE_TRANSACTION = ('_'<<24)|('N'<<16)|('T'<<8)|'F';int TWEET_TRANSACTION = ('_'<<24)|('T'<<16)|('W'<<8)|'T';int LIKE_TRANSACTION = ('_'<<24)|('L'<<16)|('I'<<8)|'K';/** @hide */int SYSPROPS_TRANSACTION = ('_'<<24)|('S'<<16)|('P'<<8)|'R';int FLAG_ONEWAY = 0x00000001;public static final int MAX_IPC_SIZE = 64 * 1024;public @Nullable String getInterfaceDescriptor() throws RemoteException;public boolean pingBinder();public boolean isBinderAlive();public @Nullable IInterface queryLocalInterface(@NonNull String descriptor);public void dump(@NonNull FileDescriptor fd, @Nullable String[] args) throws RemoteException;public void dumpAsync(@NonNull FileDescriptor fd, @Nullable String[] args)throws RemoteException;public void shellCommand(@Nullable FileDescriptor in, @Nullable FileDescriptor out,@Nullable FileDescriptor err,@NonNull String[] args, @Nullable ShellCallback shellCallback,@NonNull ResultReceiver resultReceiver) throws RemoteException;public boolean transact(int code, @NonNull Parcel data, @Nullable Parcel reply, int flags)throws RemoteException;public interface DeathRecipient {public void binderDied();}public void linkToDeath(@NonNull DeathRecipient recipient, int flags)throws RemoteException;public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags);
}
Binder源码:
public class Binder implements IBinder {/** Set this flag to true to detect anonymous, local or member classes* that extend this Binder class and that are not static. These kind* of classes can potentially create leaks.*/private static final boolean FIND_POTENTIAL_LEAKS = false;/** @hide */public static final boolean CHECK_PARCEL_SIZE = false;static final String TAG = "Binder";/** @hide */public static boolean LOG_RUNTIME_EXCEPTION = false; // DO NOT SUBMIT WITH TRUE/*** Control whether dump() calls are allowed.*/private static volatile String sDumpDisabled = null;
认识IBinder和Binder相关推荐
- Binder Java层实现(一):IBinder/IInterface/Binder/Stub
要点 面向对象思想的引入将进程间通信转化为通过对某个Binder对象的引用调用该对象的方法,而其独特之处在于Binder对象是一个可以跨进程引用的对象,它的实体(本地对象)位于一个进程中,而它的引用( ...
- Binder机制原理、源码、AIDL,IBinder,Binder,IInterface,BinderDriver,需要的都在这里了
导读: 本文分为三个阶段, 第一阶段,原理概述,力争说人话的基础上,讲明白Binder机制在搞什么,为什么这样搞,以及具体是怎么搞的. 第二阶段,代码层面描述,主要描述了,AIDL.IBinder.B ...
- IBinder与Binder关系
IBinder是接口,你看前面有个I,理解为接口,他的实现类必须自己编写代码逻辑来实现功能. Binder是实现了IBinder的具体实现类,他具有具体的功能,继承了Binder的类就是IBinder ...
- Binder、IBinder 和 IInterface 的关系
Binder.IBinder 和 IInterface 的关系 IBinder 接口 Binder 实现了 IBinder 接口. public class Binder implements IBi ...
- Android进阶——Android跨进程通讯机制之Binder、IBinder、Parcel、AIDL
前言 Binder机制是Android系统提供的跨进程通讯机制,这篇文章开始会从Linux相关的基础概念知识开始介绍,从基础概念知识中引出Binder机制,归纳Binder机制与Linux系统的跨进程 ...
- Android跨进程通讯机制之Binder、IBinder、Parcel、AIDL
https://blog.csdn.net/qq_30379689/article/details/79451596 前言 Binder机制是Android系统提供的跨进程通讯机制,这篇文章开始会从L ...
- Android Binder概述
背景知识 为了更好的理解binder,我们要先澄清一下概念,因为Android 基于Linux内核,我们有必要了解相关知识. 进程隔离 进程隔离是为了保护操作系统进程之间互不干扰而设计的,这个技术是为 ...
- 直接通过Binder的onTransact完成跨进程通信
1.具体代码: 服务端实现: public class IPCService extends Service {private static final String DESCRIPTOR = &qu ...
- Android进阶(六)Binder机制
一.进程通信 1.进程隔离: 进程隔离是为保护操作系统中进程互不干扰而设计的一组不同硬件和软件的技术.进程数据不共享,进程A的虚拟地址和进程B的虚拟地址不同,这样就防止进程A将数据信息写入进程B,保证 ...
最新文章
- 简单mysql 查询_MySQL简单查询详解
- 信息系统项目管理师案例分析
- Sublime编辑器上的 Vim 插件常用快捷键
- MSSSQL 脚本收藏
- javaMail操作QQ邮箱发送邮箱 Demo
- C语言学习之用指针变量,将数组a中n个整数按相反顺序存放
- 练习:写一个脚本,完成以下任务
- POJ 2240 Arbitrage(SPFA判正环)
- Windows蓝屏代码及解决方案最全合集
- ASC计算机比赛报名,新闻|2019 ASC 世界大学生超级计算机竞赛(ASC19)报名通知|信息与软件工程学院...
- 多任务学习(Multi-Task Learning)
- 第一不完全性定理证明标号分类 拆解汉译 知识背景——哥德尔原著英译拆解汉译之一
- 1000以内的水仙花数c语言实现
- 崇阳职校计算机基础知识试题及答案,崇阳职校2014年春期末考试.doc
- [LINUX学习]sheel脚本循环KILL,并启动
- NR CSI(一) CSI-RS
- 【漏洞发现-sql注入】有回显注入--sqli-labs
- 斯密特正交化(matlab)
- 记自己2017年校招一路走来
- 如何理解FFT中时间窗与RBW的关系