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

Commit 25a65b6a authored by Shai Barack's avatar Shai Barack
Browse files

Don't force concurrent MQ in Robolectric tests

Robolectric is not yet updated to be robust to new MQ.
We only updated Test{,able}Looper and Espresso so far.

Bug: 379472827
Flag: android.os.force_concurrent_message_queue
Change-Id: I2a03c9e5753820f6efb648a40d3392c3e4135f53
parent e0e6cf98
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -145,9 +145,18 @@ public final class MessageQueue {
        }
        }


        if (Flags.forceConcurrentMessageQueue()) {
        if (Flags.forceConcurrentMessageQueue()) {
            // b/379472827: Robolectric tests use reflection to access MessageQueue.mMessages.
            // This is a hack to allow Robolectric tests to use the legacy implementation.
            try {
                Class.forName("org.robolectric.Robolectric");
            } catch (ClassNotFoundException e) {
                // This is not a Robolectric test.
                sIsProcessAllowedToUseConcurrent = true;
                sIsProcessAllowedToUseConcurrent = true;
                return;
                return;
            }
            }
            // This is a Robolectric test.
            // Continue to the following checks.
        }


        final String processName = Process.myProcessName();
        final String processName = Process.myProcessName();
        if (processName == null) {
        if (processName == null) {