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

Commit b6e7f8aa authored by Calin Juravle's avatar Calin Juravle Committed by Automerger Merge Worker
Browse files

Merge "Register the DexLoadReporter before creating the main class loader" am:...

Merge "Register the DexLoadReporter before creating the main class loader" am: 6fe0c8ea am: 0bd0d7e0

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1735263

Change-Id: I4d42d5b4721354a8f98ba0e24f69a72be0066290
parents 864c99c7 0bd0d7e0
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -932,6 +932,21 @@ public final class LoadedApk {

        boolean registerAppInfoToArt = false;
        if (mDefaultClassLoader == null) {
            // Setup the dex reporter to notify package manager
            // of any relevant dex loads. The idle maintenance job will use the information
            // reported to optimize the loaded dex files.
            // Note that we only need one global reporter per app.
            // Make sure we do this before creating the main app classloader for the first time
            // so that we can capture the complete application startup.
            //
            // We should not do this in a zygote context (where mActivityThread will be null),
            // thus we'll guard against it.
            // Also, the system server reporter (SystemServerDexLoadReporter) is already registered
            // when system server starts, so we don't need to do it here again.
            if (mActivityThread != null && !ActivityThread.isSystem()) {
                BaseDexClassLoader.setReporter(DexLoadReporter.getInstance());
            }

            // Temporarily disable logging of disk reads on the Looper thread
            // as this is early and necessary.
            StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads();
@@ -1047,14 +1062,6 @@ public final class LoadedApk {
    }

    private void registerAppInfoToArt() {
        // Setup the dex reporter to notify package manager
        // of any relevant dex loads. The idle maintenance job will use the information
        // reported to optimize the loaded dex files.
        // Note that we only need one global reporter per app.
        // Make sure we do this before invoking app code for the first time so that we
        // can capture the complete application startup.
        BaseDexClassLoader.setReporter(DexLoadReporter.getInstance());

        // Only set up profile support if the loaded apk has the same uid as the
        // current process.
        // Currently, we do not support profiling across different apps.