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

Commit febe967b authored by Alex Light's avatar Alex Light
Browse files

Start zygote with -Xopaque-jni-ids:swapable

This allows the use of structural class redefinition on debuggable
apps.

Also allows override of this via the new 'dalvikvm.vm.opaque-jni-ids'
option.

Test: Manual
Test: ./art/tools/jvmti-agents/field-counts/count-fields.py 'Ldalvik/system/ClassExt;.instanceJfieldIDs:Ljava/lang/Object;' 'Ldalvik/system/ClassExt;.staticJfieldIDs:Ljava/lang/Object;' 'Ldalvik/system/ClassExt;.jmethodIDs:Ljava/lang/Object;'
Bug: 134162467
Change-Id: I9e9c7e5a7ff95d62f9969ebeb472e81a7357d7f9
parent 07235288
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -692,6 +692,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p
    char methodTraceFileSizeBuf[sizeof("-Xmethod-trace-file-size:") + PROPERTY_VALUE_MAX];
    std::string fingerprintBuf;
    char jdwpProviderBuf[sizeof("-XjdwpProvider:") - 1 + PROPERTY_VALUE_MAX];
    char opaqueJniIds[sizeof("-Xopaque-jni-ids:") - 1 + PROPERTY_VALUE_MAX];
    char bootImageBuf[sizeof("-Ximage:") - 1 + PROPERTY_VALUE_MAX];

    // Read if we are using the profile configuration, do this at the start since the last ART args
@@ -883,6 +884,14 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p
                         "default");
    }

    // Only pass an explicit opaque-jni-ids to apps forked from zygote
    if (zygote) {
      parseRuntimeOption("dalvik.vm.opaque-jni-ids",
                        opaqueJniIds,
                        "-Xopaque-jni-ids:",
                        "swapable");
    }

    parseRuntimeOption("dalvik.vm.lockprof.threshold",
                       lockProfThresholdBuf,
                       "-Xlockprofthreshold:");