@Internal
public final class LeakSafeOneWayBinder
extends android.os.Binder
Binder which delegates all transactions to an internal handler, and only
supports one way transactions.
Since Binder objects can be anchored forever by a misbehaved remote process, any references
they hold can lead to significant memory leaks. To prevent that, the detach() method
clears the reference to the delegate handler, ensuring that only this simple class is leaked.
Once detached, this binder returns false from any future transactions (and pings).
Since two-way transactions block the calling thread on a remote process, this class only supports one-way calls.
| Modifier and Type | Class and Description |
|---|---|
static interface |
LeakSafeOneWayBinder.TransactionHandler |
| Constructor and Description |
|---|
LeakSafeOneWayBinder(LeakSafeOneWayBinder.TransactionHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
void |
detach() |
protected boolean |
onTransact(int code,
android.os.Parcel parcel,
android.os.Parcel reply,
int flags) |
boolean |
pingBinder() |
attachInterface, clearCallingIdentity, clearCallingWorkSource, dump, dump, dumpAsync, flushPendingCommands, getCallingPid, getCallingUid, getCallingUidOrThrow, getCallingUserHandle, getCallingWorkSourceUid, getInterfaceDescriptor, isBinderAlive, joinThreadPool, linkToDeath, queryLocalInterface, restoreCallingIdentity, restoreCallingWorkSource, setCallingWorkSourceUid, transact, unlinkToDeathpublic LeakSafeOneWayBinder(LeakSafeOneWayBinder.TransactionHandler handler)
public void detach()
protected boolean onTransact(int code,
android.os.Parcel parcel,
android.os.Parcel reply,
int flags)
onTransact in class android.os.Binderpublic boolean pingBinder()
pingBinder in interface android.os.IBinderpingBinder in class android.os.Binder