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

Commit 1e58e8e3 authored by David Brazdil's avatar David Brazdil
Browse files

Pass core platform API policy property to ART

When starting ART, read property
""persist.debug.dalvik.vm.core_platform_api_policy" and pass its value
on the command line. This enables users to enable core platform API
violation reporting on demand. Note that the settings take effect after
a reboot.

Bug: 125701194
Test: compiles, boots, reporting observed
Change-Id: I97507afc85d8e186736700979c5dbf2ad0f79f12
parent dc7b7de8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -664,6 +664,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
    char lockProfThresholdBuf[sizeof("-Xlockprofthreshold:")-1 + PROPERTY_VALUE_MAX];
    char nativeBridgeLibrary[sizeof("-XX:NativeBridge=") + PROPERTY_VALUE_MAX];
    char cpuAbiListBuf[sizeof("--cpu-abilist=") + PROPERTY_VALUE_MAX];
    char corePlatformApiPolicyBuf[sizeof("-Xcore-platform-api-policy:") + PROPERTY_VALUE_MAX];
    char methodTraceFileBuf[sizeof("-Xmethod-trace-file:") + PROPERTY_VALUE_MAX];
    char methodTraceFileSizeBuf[sizeof("-Xmethod-trace-file-size:") + PROPERTY_VALUE_MAX];
    std::string fingerprintBuf;
@@ -1010,6 +1011,16 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
        addOption("--generate-mini-debug-info");
    }

    // If set, the property below can be used to enable core platform API violation reporting.
    property_get("persist.debug.dalvik.vm.core_platform_api_policy", propBuf, "");
    if (propBuf[0] != '\0') {
      snprintf(corePlatformApiPolicyBuf,
               sizeof(corePlatformApiPolicyBuf),
               "-Xcore-platform-api-policy:%s",
               propBuf);
      addOption(corePlatformApiPolicyBuf);
    }

    /*
     * Retrieve the build fingerprint and provide it to the runtime. That way, ANR dumps will
     * contain the fingerprint and can be parsed.