diff options
author | 2024-10-16 18:08:56 +0000 | |
---|---|---|
committer | 2024-10-16 18:08:56 +0000 | |
commit | 8b4b220d92b4cd36d75c3c6b60051a3bcd2cb219 (patch) | |
tree | 1c347c1c1078811ff627399c770b77c2474718f0 /ravenwood/junit-impl-src | |
parent | ec7676d1f550dae58c62827e4a197d4ef21ca440 (diff) |
[Ravenwood] Always provide main thread
It is very difficult for test owners to know whether a main thread is
actually required. Besides, the Ravenwood environment itself relies on a
main thread.
Flag: EXEMPT host test change only
Bug: 292141694
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh
Change-Id: I88ed44f00ce6295dcb14619428a2c7a4bea0bbdb
Diffstat (limited to 'ravenwood/junit-impl-src')
-rw-r--r-- | ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java index 24950e65c174..afa7a6c51abb 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java @@ -225,14 +225,9 @@ public class RavenwoodRuntimeEnvironmentController { ActivityManager.init$ravenwood(config.mCurrentUser); - final HandlerThread main; - if (config.mProvideMainThread) { - main = new HandlerThread(MAIN_THREAD_NAME); - main.start(); - Looper.setMainLooperForTest(main.getLooper()); - } else { - main = null; - } + final var main = new HandlerThread(MAIN_THREAD_NAME); + main.start(); + Looper.setMainLooperForTest(main.getLooper()); 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(); - } + Looper.getMainLooper().quit(); + Looper.clearMainLooperForTest(); ActivityManager.reset$ravenwood(); |