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

Commit 8677690d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[Ravenwood] Always provide main thread" into main am: f814fea8

parents 24ac7d34 f814fea8
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -225,14 +225,9 @@ public class RavenwoodRuntimeEnvironmentController {

        ActivityManager.init$ravenwood(config.mCurrentUser);

        final HandlerThread main;
        if (config.mProvideMainThread) {
            main = new HandlerThread(MAIN_THREAD_NAME);
        final var main = new HandlerThread(MAIN_THREAD_NAME);
        main.start();
        Looper.setMainLooperForTest(main.getLooper());
        } else {
            main = null;
        }

        final boolean isSelfInstrumenting =
                Objects.equals(config.mTestPackageName, config.mTargetPackageName);
@@ -324,10 +319,8 @@ public class RavenwoodRuntimeEnvironmentController {
        }
        sMockUiAutomation.dropShellPermissionIdentity();

        if (config.mProvideMainThread) {
        Looper.getMainLooper().quit();
        Looper.clearMainLooperForTest();
        }

        ActivityManager.reset$ravenwood();

+3 −0
Original line number Diff line number Diff line
@@ -152,7 +152,10 @@ public final class RavenwoodConfig {
        /**
         * Configure a "main" thread to be available for the duration of the test, as defined
         * by {@code Looper.getMainLooper()}. Has no effect on non-Ravenwood environments.
         *
         * @deprecated
         */
        @Deprecated
        public Builder setProvideMainThread(boolean provideMainThread) {
            mConfig.mProvideMainThread = provideMainThread;
            return this;
+3 −0
Original line number Diff line number Diff line
@@ -139,7 +139,10 @@ public final class RavenwoodRule implements TestRule {
        /**
         * Configure a "main" thread to be available for the duration of the test, as defined
         * by {@code Looper.getMainLooper()}. Has no effect on non-Ravenwood environments.
         *
         * @deprecated
         */
        @Deprecated
        public Builder setProvideMainThread(boolean provideMainThread) {
            mBuilder.setProvideMainThread(provideMainThread);
            return this;