// android.os/MessageQueue.javaprivate static void initIsProcessAllowedToUseConcurrent() { if (sIsProcessAllowedToUseConcurrent != null) { return; } 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; return; } // This is a Robolectric test. // Continue to the following checks. } ..... }