Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed7fe53c authored by Mark Fasheh's avatar Mark Fasheh
Browse files

Add isBlockedOnSyncBarrier() method to TestLooperManager

See: go/testable-messagequeue-bluedoc

Tests want a way to tell if we are blocked on a
sync barrier.

Bug: 379472827
Flag: android.os.message_queue_testability
Change-Id: I7eb80f6712b50df2b56bc8150564a6395705be3b
parent 09ed24da
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34765,6 +34765,7 @@ package android.os {
    method public android.os.MessageQueue getMessageQueue();
    method public boolean hasMessages(android.os.Handler, Object, int);
    method public boolean hasMessages(android.os.Handler, Object, Runnable);
    method @FlaggedApi("android.os.message_queue_testability") public boolean isBlockedOnSyncBarrier();
    method public android.os.Message next();
    method @FlaggedApi("android.os.message_queue_testability") @Nullable public Long peekWhen();
    method @FlaggedApi("android.os.message_queue_testability") @Nullable public android.os.Message pop();
+12 −0
Original line number Diff line number Diff line
@@ -122,6 +122,18 @@ public class TestLooperManager {
        return mQueue.peekWhenForTest();
    }

    /**
     * Checks whether the Looper is currently blocked on a sync barrier.
     *
     * A Looper is blocked on a sync barrier if there is a Message in the Looper's
     * queue that is ready for execution but is behind a sync barrier
     */
    @FlaggedApi(Flags.FLAG_MESSAGE_QUEUE_TESTABILITY)
    public boolean isBlockedOnSyncBarrier() {
        checkReleased();
        return mQueue.isBlockedOnSyncBarrier();
    }

    /**
     * Releases the looper to continue standard looping and processing of messages, no further
     * interactions with TestLooperManager will be allowed after release() has been called.