java.lang.Object | |
↳ | android.os.Binder |
Known Direct Subclasses |
Base class for a remotable object, the core part of a lightweight remote procedure call mechanism defined by IBinder. This class is an implementation of IBinder that provides the standard support creating a local implementation of such an object.
Most developers will not implement this class directly, instead using the aidl tool to describe the desired interface, having it generate the appropriate Binder subclass. You can, however, derive directly from Binder to implement your own custom RPC protocol or simply instantiate a raw Binder object directly to use as a token that can be shared across processes.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.IBinder
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor initializes the object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Convenience method for associating a specific interface with the Binder.
| |||||||||||
Reset the identity of the incoming IPC to the local process.
| |||||||||||
Implemented to call the more convenient version
dump(FileDescriptor, PrintWriter, String[]).
| |||||||||||
Flush any Binder commands pending in the current thread to the kernel
driver.
| |||||||||||
Return the ID of the process that sent you the current transaction
that is being processed.
| |||||||||||
Return the ID of the user assigned to the process that sent you the
current transaction that is being processed.
| |||||||||||
Default implementation returns an empty interface name.
| |||||||||||
Check to see if the process that the binder is in is still alive.
Note that if you're calling on a local binder, this always returns true
because your process is alive if you're calling it.
| |||||||||||
Add the calling thread to the IPC thread pool.
| |||||||||||
Local implementation is a no-op.
| |||||||||||
Default implementation always returns true -- if you got here,
the object is alive.
| |||||||||||
Use information supplied to attachInterface() to return the
associated IInterface if it matches the requested
descriptor.
| |||||||||||
Restore the identity of the incoming IPC back to a previously identity
that was returned by clearCallingIdentity().
| |||||||||||
Default implementation rewinds the parcels and calls onTransact.
| |||||||||||
Local implementation is a no-op.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Print the object's state into the given stream.
| |||||||||||
Is called before the object's memory is being reclaimed by the VM.
| |||||||||||
Default implementation is a stub that returns false.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface android.os.IBinder
|
Default constructor initializes the object.
Convenience method for associating a specific interface with the Binder. After calling, queryLocalInterface() will be implemented for you to return the given owner IInterface when the corresponding descriptor is requested.
Reset the identity of the incoming IPC to the local process. This can be useful if, while handling an incoming call, you will be calling on interfaces of other objects that may be local to your process and need to do permission checks on the calls coming into them (so they will check the permission of your own local process, and not whatever process originally called you).
Implemented to call the more convenient version dump(FileDescriptor, PrintWriter, String[]).
fd | The raw file descriptor that the dump is being sent to. |
---|---|
args | additional arguments to the dump request. |
Flush any Binder commands pending in the current thread to the kernel driver. This can be useful to call before performing an operation that may block for a long time, to ensure that any pending object references have been released in order to prevent the process from holding on to objects longer than it needs to.
Return the ID of the process that sent you the current transaction that is being processed. This pid can be used with higher-level system services to determine its identity and check permissions. If the current thread is not currently executing an incoming transaction, then its own pid is returned.
Return the ID of the user assigned to the process that sent you the current transaction that is being processed. This uid can be used with higher-level system services to determine its identity and check permissions. If the current thread is not currently executing an incoming transaction, then its own uid is returned.
Default implementation returns an empty interface name.
Check to see if the process that the binder is in is still alive. Note that if you're calling on a local binder, this always returns true because your process is alive if you're calling it.
Add the calling thread to the IPC thread pool. This function does not return until the current process is exiting.
Local implementation is a no-op.
Default implementation always returns true -- if you got here, the object is alive.
Use information supplied to attachInterface() to return the associated IInterface if it matches the requested descriptor.
Restore the identity of the incoming IPC back to a previously identity that was returned by clearCallingIdentity().
token | The opaque token that was previously returned by clearCallingIdentity(). |
---|
Default implementation rewinds the parcels and calls onTransact. On the remote side, transact calls into the binder to do the IPC.
code | The action to perform. This should be a number between FIRST_CALL_TRANSACTION and LAST_CALL_TRANSACTION. |
---|---|
data | Marshalled data to send to the target. Most not be null. If you are not sending any data, you must create an empty Parcel that is given here. |
reply | Marshalled data to be received from the target. May be null if you are not interested in the return value. |
flags | Additional operation flags. Either 0 for a normal RPC, or FLAG_ONEWAY for a one-way RPC. |
RemoteException |
---|
Local implementation is a no-op.
Print the object's state into the given stream.
fd | The raw file descriptor that the dump is being sent to. |
---|---|
fout | The file to which you should dump your state. This will be closed for you after you return. |
args | additional arguments to the dump request. |
Is called before the object's memory is being reclaimed by the VM. This can only happen once the VM has detected, during a run of the garbage collector, that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue, because it provides more control
over the way the VM deals with references during garbage collection.
Throwable |
---|
Default implementation is a stub that returns false. You will want to override this to do the appropriate unmarshalling of transactions.
If you want to call this, call transact().
RemoteException |
---|