TokenWatcher
abstract class TokenWatcher
A TokenWatcher watches a collection of IBinder
s. IBinders are added to the collection by calling acquire
, and removed by calling release
. IBinders are also implicitly removed when they become weakly reachable. Each IBinder may be added at most once. The acquired
method is invoked by posting to the specified handler whenever the size of the watched collection becomes nonzero. The released
method is invoked on the specified handler whenever the size of the watched collection becomes zero.
Summary
Public constructors | |
---|---|
TokenWatcher(h: Handler!, tag: String!) Construct the TokenWatcher |
Public methods | |
---|---|
open Unit |
Record that this token has been acquired. |
abstract Unit |
acquired() Called when the number of active tokens goes from 0 to 1. |
open Unit | |
open Unit |
dump() |
open Unit |
dump(pw: PrintWriter!) |
open Boolean | |
open Unit | |
abstract Unit |
released() Called when the number of active tokens goes from 1 to 0. |
Public constructors
TokenWatcher
TokenWatcher(
h: Handler!,
tag: String!)
Construct the TokenWatcher
Public methods
acquire
open fun acquire(
token: IBinder!,
tag: String!
): Unit
Record that this token has been acquired. When acquire is called, and the current count is 0, the acquired method is called on the given handler. Note that the same token
can only be acquired once. If this token
has already been acquired, no action is taken. The first subsequent call to release
will release this token
immediately.
acquired
abstract fun acquired(): Unit
Called when the number of active tokens goes from 0 to 1.
released
abstract fun released(): Unit
Called when the number of active tokens goes from 1 to 0.