TestLooperManager
public
class
TestLooperManager
extends Object
| java.lang.Object | |
| ↳ | android.os.TestLooperManager |
Blocks a looper from executing any messages, and allows the holder of this object to control when and which messages get executed until it is released.
A TestLooperManager should be acquired using
acquireLooperManager(Looper). Until release() is called,
the Looper thread will not execute any messages except when execute(Message) is called.
The test code may use next() to acquire messages that have been queued to this
Looper/MessageQueue and then execute(Message) to run any that desires.
Summary
Public methods | |
|---|---|
void
|
execute(Message message)
Executes the given message on the Looper thread this wrapper is attached to. |
MessageQueue
|
getMessageQueue()
Returns the |
boolean
|
hasMessages(Handler h, Object object, Runnable r)
Returns true if there are any queued messages that match the parameters. |
boolean
|
hasMessages(Handler h, Object object, int what)
Returns true if there are any queued messages that match the parameters. |
Message
|
next()
Returns the next message that should be executed by this queue, may block if no messages are ready. |
void
|
recycle(Message msg)
Called to indicate that a Message returned by |
void
|
release()
Releases the looper to continue standard looping and processing of messages, no further interactions with TestLooperManager will be allowed after release() has been called. |
Inherited methods | |
|---|---|
java.lang.Object
| |
Public methods
execute
void execute (Message message)
Executes the given message on the Looper thread this wrapper is attached to.
Execution will happen on the Looper's thread (whether it is the current thread or not), but all RuntimeExceptions encountered while executing the message will be thrown on the calling thread.
| Parameters | |
|---|---|
message |
Message |
getMessageQueue
MessageQueue getMessageQueue ()
Returns the MessageQueue this object is wrapping.
| Returns | |
|---|---|
MessageQueue |
|
hasMessages
boolean hasMessages (Handler h, Object object, Runnable r)
Returns true if there are any queued messages that match the parameters.
| Parameters | |
|---|---|
h |
Handler: the value of getTarget() |
object |
Object: the value of obj, null for any
|
r |
Runnable: the value of getCallback() |
| Returns | |
|---|---|
boolean |
|
hasMessages
boolean hasMessages (Handler h, Object object, int what)
Returns true if there are any queued messages that match the parameters.
| Parameters | |
|---|---|
h |
Handler: the value of getTarget() |
object |
Object: the value of obj, null for any
|
what |
int: the value of what |
| Returns | |
|---|---|
boolean |
|
next
Message next ()
Returns the next message that should be executed by this queue, may block if no messages are ready.
Callers should always call recycle(Message) on the message when all
interactions with it have completed.
| Returns | |
|---|---|
Message |
|
recycle
void recycle (Message msg)
Called to indicate that a Message returned by next() has been parsed
and should be recycled.
| Parameters | |
|---|---|
msg |
Message |
release
void release ()
Releases the looper to continue standard looping and processing of messages, no further interactions with TestLooperManager will be allowed after release() has been called.
Interfaces
Classes
- AsyncTask
- BaseBundle
- BatteryManager
- Binder
- Build
- Build.VERSION
- Build.VERSION_CODES
- Bundle
- CancellationSignal
- ConditionVariable
- CountDownTimer
- CpuUsageInfo
- Debug
- Debug.InstructionCount
- Debug.MemoryInfo
- DropBoxManager
- DropBoxManager.Entry
- Environment
- FileObserver
- Handler
- HandlerThread
- HardwarePropertiesManager
- LocaleList
- Looper
- MemoryFile
- Message
- MessageQueue
- Messenger
- Parcel
- ParcelFileDescriptor
- ParcelFileDescriptor.AutoCloseInputStream
- ParcelFileDescriptor.AutoCloseOutputStream
- ParcelUuid
- PatternMatcher
- PersistableBundle
- PowerManager
- PowerManager.WakeLock
- Process
- ProxyFileDescriptorCallback
- RecoverySystem
- RemoteCallbackList
- ResultReceiver
- StatFs
- StrictMode
- StrictMode.ThreadPolicy
- StrictMode.ThreadPolicy.Builder
- StrictMode.VmPolicy
- StrictMode.VmPolicy.Builder
- SystemClock
- TestLooperManager
- TokenWatcher
- Trace
- UserHandle
- UserManager
- VibrationEffect
- Vibrator
- WorkSource
Enums
Exceptions


