@Implements(value=android.os.Message.class) public class ShadowMessage extends java.lang.Object
Constructor and Description |
---|
ShadowMessage() |
Modifier and Type | Method and Description |
---|---|
android.os.Message |
getNext()
Convenience method to provide getter access to the private field
Message.next . |
protected boolean |
isInUse()
Convenience method to provide access to the private
Message.isInUse() method. |
protected void |
recycle()
Hook to unscheduled the callback when the message is recycled.
|
void |
recycleUnchecked()
Hook to unscheduled the callback when the message is recycled.
|
static void |
reset()
Resets the static state of the
Message class by emptying the message pool. |
void |
setNext(android.os.Message next)
Convenience method to provide setter access to the private field
Message.next . |
void |
setScheduledRunnable(java.lang.Runnable r)
Stores the
Runnable instance that has been scheduled to invoke this message. |
@HiddenApi @Implementation(minSdk=21) public void recycleUnchecked()
Hook to unscheduled the callback when the message is recycled. Invokes unschedule()
and then calls through to the package private method Message.recycleUnchecked()
on the real object.
@Implementation(maxSdk=20) protected void recycle()
Hook to unscheduled the callback when the message is recycled. Invokes unschedule()
and then calls through to Message.recycle()
on the real object.
public void setScheduledRunnable(java.lang.Runnable r)
Stores the Runnable
instance that has been scheduled to invoke this message. This is called when the message is enqueued by ShadowMessageQueue.enqueueMessage(android.os.Message, long)
and is used when the message is recycled to ensure that the correct Runnable
instance is removed from the associated scheduler.
r
- the Runnable
instance that is scheduled to trigger this message.
@Implementation protected boolean isInUse()
Convenience method to provide access to the private Message.isInUse()
method. Note that the definition of “in use” changed with API 21:
In API 19, a message was only considered “in use” during its dispatch. In API 21, the message is considered “in use” from the time it is enqueued until the time that it is freshly obtained via a call to Message.obtain()
. This means that in API 21 messages that are in the recycled pool will still be marked as “in use”.
true
if the message is currently “in use”, false
otherwise.public android.os.Message getNext()
Convenience method to provide getter access to the private field Message.next
.
setNext(Message)
public void setNext(android.os.Message next)
Convenience method to provide setter access to the private field Message.next
.
next
- the new next message for the current message.getNext()
@Resetter public static void reset()
Resets the static state of the Message
class by emptying the message pool.