Class ShadowLegacyMessageQueue


  • @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().

    See Also:
    ShadowLooper
    • Constructor Detail

      • ShadowLegacyMessageQueue

        public ShadowLegacyMessageQueue()
    • Method Detail

      • nativeInit

        @HiddenApi
        @Implementation
        public static java.lang.Number nativeInit()
      • nativeDestroy

        @HiddenApi
        @Implementation(minSdk=18,
                        maxSdk=20)
        public static void nativeDestroy​(int ptr)
      • nativeDestroy

        @Implementation(minSdk=21)
        protected static void nativeDestroy​(long ptr)
      • nativeIsIdling

        @HiddenApi
        @Implementation(minSdk=19,
                        maxSdk=20)
        public static boolean nativeIsIdling​(int ptr)
      • nativeIsIdling

        @Implementation(minSdk=21,
                        maxSdk=22)
        protected static boolean nativeIsIdling​(long ptr)
      • getScheduler

        public org.robolectric.util.Scheduler getScheduler()
        Description copied from class: ShadowMessageQueue
        Return this queue's Scheduler.

        Only supported in LooperMode.Mode.LEGACY.

        Specified by:
        getScheduler in class ShadowMessageQueue
      • setScheduler

        public void setScheduler​(org.robolectric.util.Scheduler scheduler)
        Description copied from class: ShadowMessageQueue
        Set this queue's Scheduler.

        Only supported in LooperMode.Mode.LEGACY.

        Specified by:
        setScheduler in class ShadowMessageQueue
      • getHead

        public android.os.Message getHead()
        Description copied from class: ShadowMessageQueue
        Retrieves the current Message at the top of the queue.

        Only supported in LooperMode.Mode.LEGACY.

        Specified by:
        getHead in class ShadowMessageQueue
      • setHead

        public void setHead​(android.os.Message msg)
        Description copied from class: ShadowMessageQueue
        Sets the current Message at the top of the queue.

        Only supported in LooperMode.Mode.LEGACY.

        Specified by:
        setHead in class ShadowMessageQueue
      • reset

        public void reset()
        Description copied from class: ShadowMessageQueue
        Reset the messageQueue state. Should not be called by tests - it intended for use by the Robolectric framework.
        Specified by:
        reset in class ShadowMessageQueue
      • enqueueMessage

        @Implementation
        protected boolean enqueueMessage​(android.os.Message msg,
                                         long when)
      • removeSyncBarrier

        @Implementation
        @HiddenApi
        protected void removeSyncBarrier​(int token)