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

Commit 797ec254 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Fix CombinedMessageQueue for ravenwood

Flag: EXEMPT host test change only
Bug: 379145063
Test: atest CtsContentTestCasesRavenwood
Change-Id: I32bc7fd2838c9fc8b71d787d0d1e02127b752565
parent 62493521
Loading
Loading
Loading
Loading
+15 −5
Original line number Original line Diff line number Diff line
@@ -118,11 +118,8 @@ public final class MessageQueue {
        mUseConcurrent = UserHandle.isCore(Process.myUid());
        mUseConcurrent = UserHandle.isCore(Process.myUid());
        // Even then, we don't use it if instrumentation is loaded as it breaks some
        // Even then, we don't use it if instrumentation is loaded as it breaks some
        // platform tests.
        // platform tests.
        final ActivityThread activityThread = ActivityThread.currentActivityThread();
        final Instrumentation instrumentation = getInstrumentation();
        if (activityThread != null) {
            final Instrumentation instrumentation = activityThread.getInstrumentation();
        mUseConcurrent &= instrumentation == null || !instrumentation.isInstrumenting();
        mUseConcurrent &= instrumentation == null || !instrumentation.isInstrumenting();
        }
        // We can lift this restriction in the future after we've made it possible for test authors
        // We can lift this restriction in the future after we've made it possible for test authors
        // to test Looper and MessageQueue without resorting to reflection.
        // to test Looper and MessageQueue without resorting to reflection.


@@ -130,6 +127,19 @@ public final class MessageQueue {
        mPtr = nativeInit();
        mPtr = nativeInit();
    }
    }


    @android.ravenwood.annotation.RavenwoodReplace(blockedBy = ActivityThread.class)
    private static Instrumentation getInstrumentation() {
        final ActivityThread activityThread = ActivityThread.currentActivityThread();
        if (activityThread != null) {
            return activityThread.getInstrumentation();
        }
        return null;
    }

    private static Instrumentation getInstrumentation$ravenwood() {
        return null; // Instrumentation not supported on Ravenwood yet.
    }

    @Override
    @Override
    protected void finalize() throws Throwable {
    protected void finalize() throws Throwable {
        try {
        try {