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

Commit 137d0215 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove references to MessageQueue.mUseConcurrent in test utilities" into main

parents bf91614d 37404f7e
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ public class TestableLooper {
    private static final Field MESSAGE_QUEUE_MESSAGES_FIELD;
    private static final Field MESSAGE_NEXT_FIELD;
    private static final Field MESSAGE_WHEN_FIELD;
    private static Field MESSAGE_QUEUE_USE_CONCURRENT_FIELD = null;

    private Looper mLooper;
    private MessageQueue mQueue;
@@ -63,14 +62,6 @@ public class TestableLooper {
    private TestLooperManager mQueueWrapper;

    static {
        try {
            MESSAGE_QUEUE_USE_CONCURRENT_FIELD =
                    MessageQueue.class.getDeclaredField("mUseConcurrent");
            MESSAGE_QUEUE_USE_CONCURRENT_FIELD.setAccessible(true);
        } catch (NoSuchFieldException ignored) {
            // Ignore - maybe this is not CombinedMessageQueue?
        }

        try {
            MESSAGE_QUEUE_MESSAGES_FIELD = MessageQueue.class.getDeclaredField("mMessages");
            MESSAGE_QUEUE_MESSAGES_FIELD.setAccessible(true);
@@ -155,15 +146,6 @@ public class TestableLooper {
        mLooper = l;
        mQueue = mLooper.getQueue();
        mHandler = new Handler(mLooper);

        // If we are using CombinedMessageQueue, we need to disable concurrent mode for testing.
        if (MESSAGE_QUEUE_USE_CONCURRENT_FIELD != null) {
            try {
                MESSAGE_QUEUE_USE_CONCURRENT_FIELD.set(mQueue, false);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
    }

    /**
+0 −12
Original line number Diff line number Diff line
@@ -100,18 +100,6 @@ public class TestLooper {
            throw new RuntimeException("Reflection error constructing or accessing looper", e);
        }

        // If we are using CombinedMessageQueue, we need to disable concurrent mode for testing.
        try {
            Field messageQueueUseConcurrentField =
                    MessageQueue.class.getDeclaredField("mUseConcurrent");
            messageQueueUseConcurrentField.setAccessible(true);
            messageQueueUseConcurrentField.set(mLooper.getQueue(), false);
        } catch (NoSuchFieldException e) {
            // Ignore - maybe this is not CombinedMessageQueue?
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Reflection error constructing or accessing looper", e);
        }

        mClock = clock;
    }