IRemoteObjectpublic class RemoteProxy extends Object implements IRemoteObject
IRemoteObject proxy objects.IRemoteObject.DeathRecipientDUMP_TRANSACTION, INTERFACE_TRANSACTION, MAX_TRANSACTION_ID, MIN_TRANSACTION_ID, PING_TRANSACTION| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
addDeathRecipient(IRemoteObject.DeathRecipient recipient,
int flags) |
Registers a callback used to receive death notifications of a remote object.
|
void |
dump(FileDescriptor fd,
String[] args) |
Dumps the status of the current interface to a file with a specific descriptor.
|
boolean |
equals(Object object) |
Checks whether the object calling this method equals the specified object.
|
protected void |
finalize() |
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
long |
getIdentity() |
Obtains the ID of this
RemoteProxy object. |
String |
getInterfaceDescriptor() |
Queries the interface descriptor of remote object.
|
int |
hashCode() |
Obtains the hash code of this
RemoteProxy object. |
boolean |
isObjectDead() |
Checks whether the
RemoteObject corresponding to a RemoteProxy is dead. |
IRemoteBroker |
queryLocalInterface(String descriptor) |
Queries a local interface with a specified descriptor.
|
boolean |
removeDeathRecipient(IRemoteObject.DeathRecipient recipient,
int flags) |
Deregisters a callback used to receive death notifications of a remote object.
|
static void |
sendObituary(IRemoteObject.DeathRecipient recipient) |
Sends a death notification when a remote object is released or gets offline.
|
boolean |
sendRequest(int code,
MessageParcel data,
MessageParcel reply,
MessageOption option) |
Sends a request to the peer object.
|
boolean |
setDataVersion(int dataVersion) |
set data version to the
RemoteProxy object. |
void |
slowPathDump(FileDescriptor fd,
String[] args) |
Asynchronously dumps data to a specified file.
|
public IRemoteBroker queryLocalInterface(String descriptor)
queryLocalInterface 在接口中 IRemoteObjectdescriptor - Indicates the descriptor of the interface to query.public boolean addDeathRecipient(IRemoteObject.DeathRecipient recipient, int flags)
addDeathRecipient 在接口中 IRemoteObjectrecipient - Indicates the callback to be registered.flags - Indicates the flag of the death notification. This is a reserved parameter. Set it to 0.true if the callback is registered successfully; returns false otherwise.public boolean removeDeathRecipient(IRemoteObject.DeathRecipient recipient, int flags)
removeDeathRecipient 在接口中 IRemoteObjectrecipient - Indicates the callback to be deregistered.flags - Indicates the flag of the death notification. This is a reserved parameter. Set it to 0.true if the callback is deregistered successfully; returns false otherwise.public String getInterfaceDescriptor()
getInterfaceDescriptor 在接口中 IRemoteObjectpublic static final void sendObituary(IRemoteObject.DeathRecipient recipient)
recipient - Indicates the death notification to be sent.public boolean sendRequest(int code,
MessageParcel data,
MessageParcel reply,
MessageOption option)
throws RemoteException
If the peer object and RemoteProxy are on the same device, the request is sent by the IPC driver.
If they are on different devices, the request is sent by the socket driver.
sendRequest 在接口中 IRemoteObjectcode - Indicates the message code of the request.data - Indicates the MessageParcel object storing the data to be sent.reply - Indicates the MessageParcel object receiving the response data.option - Indicates a synchronous (default) or asynchronous request.true if the operation succeeds; returns false otherwise.RemoteException - Throws this exception if a remote object exception occurs.public void dump(FileDescriptor fd, String[] args) throws RemoteException
dump 在接口中 IRemoteObjectfd - Indicates the descriptor of the target file.args - Indicates parameters of this method in character string format.RemoteException - Throws this exception if a remote object exception occurs.public void slowPathDump(FileDescriptor fd, String[] args) throws RemoteException
This method applies only to data dump on the same device.
You need to obtain the file descriptor from the file and close the file descriptor after the dump is complete.
slowPathDump 在接口中 IRemoteObjectfd - Indicates the file descriptor of the target file.args - Indicates the arguments (an array of strings) to dump.RemoteException - Throws this exception if the dump command fails to be sent or
an error occurs during the dump.public boolean isObjectDead()
RemoteObject corresponding to a RemoteProxy is dead.isObjectDead 在接口中 IRemoteObjecttrue if the RemoteObject is dead; returns false otherwise.public long getIdentity()
RemoteProxy object.
RemoteProxy objects with the same ID are deemed as equal.
RemoteProxy object.public boolean setDataVersion(int dataVersion)
RemoteProxy object.dataVersion - Indicates the remote object and its data version written to MessageParcel.true if set data version success; returns false otherwise.protected void finalize()
throws Throwable
Objectfinalize method to dispose of
system resources or to perform other cleanup.
The general contract of finalize is that it is invoked
if and when the Java™ virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize method may take any action, including
making this object available again to other threads; the usual purpose
of finalize, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize method of class Object performs no
special action; it simply returns normally. Subclasses of
Object may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize 在类中 ObjectThrowable - the Exception raised by this methodWeakReference,
PhantomReferencepublic boolean equals(Object object)
Objects with the same address or ID are deemed as equal.
You can use getIdentity() to obtain the ID of the RemoteProxy object.
equals 在类中 Objectobject - Indicates the object to compare.true if the two objects are equal; returns false otherwise.Object.hashCode(),
HashMappublic int hashCode()
RemoteProxy object.hashCode 在类中 ObjectRemoteProxy object.Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)