diff options
Diffstat (limited to 'ravenwood/junit-impl-src/android')
-rw-r--r-- | ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java | 31 |
1 files changed, 24 insertions, 7 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 172cec3b8e13..3d2bb8e78a7e 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java @@ -105,6 +105,9 @@ public class RavenwoodRuntimeEnvironmentController { private static final String LIBRAVENWOOD_INITIALIZER_NAME = "ravenwood_initializer"; private static final String RAVENWOOD_NATIVE_RUNTIME_NAME = "ravenwood_runtime"; + private static final String ANDROID_LOG_TAGS = "ANDROID_LOG_TAGS"; + private static final String RAVENWOOD_ANDROID_LOG_TAGS = "RAVENWOOD_" + ANDROID_LOG_TAGS; + /** * When enabled, attempt to dump all thread stacks just before we hit the * overall Tradefed timeout, to aid in debugging deadlocks. @@ -232,20 +235,22 @@ public class RavenwoodRuntimeEnvironmentController { // Make sure libravenwood_runtime is loaded. System.load(RavenwoodCommonUtils.getJniLibraryPath(RAVENWOOD_NATIVE_RUNTIME_NAME)); + Log_ravenwood.setLogLevels(getLogTags()); Log_ravenwood.onRavenwoodRuntimeNativeReady(); // Do the basic set up for the android sysprops. RavenwoodSystemProperties.initialize(); + // Enable all log levels for native logging, until we'll have a way to change the native + // side log level at runtime. // Do this after loading RAVENWOOD_NATIVE_RUNTIME_NAME (which backs Os.setenv()), // before loadFrameworkNativeCode() (which uses $ANDROID_LOG_TAGS). - if (RAVENWOOD_VERBOSE_LOGGING) { - RavenwoodCommonUtils.log(TAG, "Force enabling verbose logging"); - try { - Os.setenv("ANDROID_LOG_TAGS", "*:v", true); - } catch (ErrnoException e) { - throw new RuntimeException(e); - } + // This would also prevent libbase from crashing the process (b/381112373) because + // the string format it accepts is very limited. + try { + Os.setenv("ANDROID_LOG_TAGS", "*:v", true); + } catch (ErrnoException e) { + throw new RuntimeException(e); } // Make sure libandroid_runtime is loaded. @@ -333,6 +338,18 @@ public class RavenwoodRuntimeEnvironmentController { initializeCompatIds(); } + /** + * Get log tags from environmental variable. + */ + @Nullable + private static String getLogTags() { + var logTags = System.getenv(RAVENWOOD_ANDROID_LOG_TAGS); + if (logTags == null) { + logTags = System.getenv(ANDROID_LOG_TAGS); + } + return logTags; + } + private static void loadRavenwoodProperties() { var props = RavenwoodSystemProperties.readProperties("ravenwood.properties"); |