@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 Messages into the scheduler queue instead of sending them to be handled on a separate thread. Messages that are scheduled to be dispatched can be triggered by calling ShadowLooper.idleMainLooper().
ShadowLooperShadowMessageQueue.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()
ShadowMessageQueueReturn this queue’s Scheduler.
Only supported in LooperMode.Mode.LEGACY.
getScheduler in class ShadowMessageQueuepublic void setScheduler(Scheduler scheduler)
ShadowMessageQueueSet this queue’s Scheduler.
Only supported in LooperMode.Mode.LEGACY.
setScheduler in class ShadowMessageQueuepublic Message getHead()
ShadowMessageQueueRetrieves the current Message at the top of the queue.
Only supported in LooperMode.Mode.LEGACY.
getHead in class ShadowMessageQueuepublic void setHead(Message msg)
ShadowMessageQueueSets the current Message at the top of the queue.
Only supported in LooperMode.Mode.LEGACY.
setHead in class ShadowMessageQueuepublic void reset()
ShadowMessageQueueReset 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)