@Implements(value=android.os.MessageQueue.class, isInAndroidSdk=false) public class ShadowLegacyMessageQueue extends ShadowMessageQueue
The shadow MessageQueue
for LooperMode.Mode.LEGACY
.
In LooperMode.Mode.LEGACY
Robolectric puts Message
s into the scheduler queue instead of sending them to be handled on a separate thread. Message
s that are scheduled to be dispatched can be triggered by calling ShadowLooper.idleMainLooper()
.
ShadowLooper
ShadowMessageQueue.Picker
Constructor and Description |
---|
ShadowLegacyMessageQueue() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
enqueueMessage(Message msg,
long when) |
Message |
getHead()
Retrieves the current Message at the top of the queue.
|
Scheduler |
getScheduler()
Return this queue’s Scheduler.
|
static void |
nativeDestroy(int ptr) |
protected static void |
nativeDestroy(long ptr) |
static Number |
nativeInit() |
static boolean |
nativeIsIdling(int ptr) |
protected static boolean |
nativeIsIdling(long ptr) |
protected void |
removeSyncBarrier(int token) |
void |
reset()
Reset the messageQueue state.
|
void |
setHead(Message msg)
Sets the current Message at the top of the queue.
|
void |
setScheduler(Scheduler scheduler)
Set this queue’s Scheduler.
|
@HiddenApi @Implementation public static Number nativeInit()
@HiddenApi @Implementation(minSdk=18, maxSdk=20) public static void nativeDestroy(int ptr)
@Implementation(minSdk=21) protected static void nativeDestroy(long ptr)
@HiddenApi @Implementation(minSdk=19, maxSdk=20) public static boolean nativeIsIdling(int ptr)
@Implementation(minSdk=21, maxSdk=22) protected static boolean nativeIsIdling(long ptr)
public Scheduler getScheduler()
ShadowMessageQueue
Return this queue’s Scheduler.
Only supported in LooperMode.Mode.LEGACY
.
getScheduler
in class ShadowMessageQueue
public void setScheduler(Scheduler scheduler)
ShadowMessageQueue
Set this queue’s Scheduler.
Only supported in LooperMode.Mode.LEGACY
.
setScheduler
in class ShadowMessageQueue
public Message getHead()
ShadowMessageQueue
Retrieves the current Message at the top of the queue.
Only supported in LooperMode.Mode.LEGACY
.
getHead
in class ShadowMessageQueue
public void setHead(Message msg)
ShadowMessageQueue
Sets the current Message at the top of the queue.
Only supported in LooperMode.Mode.LEGACY
.
setHead
in class ShadowMessageQueue
public void reset()
ShadowMessageQueue
Reset the messageQueue state. Should not be called by tests - it intended for use by the Robolectric framework.
reset
in class ShadowMessageQueue
@Implementation protected boolean enqueueMessage(Message msg, long when)
@Implementation @HiddenApi protected void removeSyncBarrier(int token)