Dump JVM arguments on startup
Flag: EXEMPT host test change only
Bug: 371602426
Test: atest RavenwoodBivalentTest, check the log
Change-Id: I061dad98f1e1f2ebea3dba41a48307c96b990010
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 1c1f157..979076e 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
@@ -67,6 +67,7 @@
import com.android.server.LocalServices;
import com.android.server.compat.PlatformCompat;
+import org.junit.internal.management.ManagementFactory;
import org.junit.runner.Description;
import java.io.File;
@@ -204,6 +205,8 @@
// Some process-wide initialization. (maybe redirect stdout/stderr)
RavenwoodCommonUtils.loadJniLibrary(LIBRAVENWOOD_INITIALIZER_NAME);
+ dumpCommandLineArgs();
+
// We haven't initialized liblog yet, so directly write to System.out here.
RavenwoodCommonUtils.log(TAG, "globalInitInner()");
@@ -588,4 +591,18 @@
+ " access to system property '" + key + "' denied via RavenwoodConfig");
}
}
+
+ private static void dumpCommandLineArgs() {
+ Log.i(TAG, "JVM arguments:");
+
+ // Note, we use the wrapper in JUnit4, not the actual class (
+ // java.lang.management.ManagementFactory), because we can't see the later at the build
+ // because this source file is compiled for the device target, where ManagementFactory
+ // doesn't exist.
+ var args = ManagementFactory.getRuntimeMXBean().getInputArguments();
+
+ for (var arg : args) {
+ Log.i(TAG, " " + arg);
+ }
+ }
}