-
- All Implemented Interfaces:
-
android.os.IBinder
@Internal() public final class LeakSafeOneWayBinder extends Binder
An extension of 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceLeakSafeOneWayBinder.TransactionHandler
-
Constructor Summary
Constructors Constructor Description LeakSafeOneWayBinder(LeakSafeOneWayBinder.TransactionHandler handler)
-
Method Summary
Modifier and Type Method Description voiddetach()booleanpingBinder()-
Methods inherited from class android.os.Binder
attachInterface, clearCallingIdentity, clearCallingWorkSource, dump, dumpAsync, flushPendingCommands, getCallingPid, getCallingUid, getCallingUidOrThrow, getCallingUserHandle, getCallingWorkSourceUid, getInterfaceDescriptor, isBinderAlive, joinThreadPool, linkToDeath, pingBinder, queryLocalInterface, restoreCallingIdentity, restoreCallingWorkSource, setCallingWorkSourceUid, transact, unlinkToDeath -
Methods inherited from class android.os.IBinder
getSuggestedMaxIpcSizeBytes -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LeakSafeOneWayBinder
LeakSafeOneWayBinder(LeakSafeOneWayBinder.TransactionHandler handler)
-
-
Method Detail
-
detach
void detach()
-
pingBinder
boolean pingBinder()
-
-
-
-