admin 管理员组文章数量: 1086019
认识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
版权声明:本文标题:认识IBinder和Binder 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1686728963a30134.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论