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

Commit 0de36e51 authored by Ying Wang's avatar Ying Wang Committed by Narayan Kamath
Browse files

Move preloaded-classes out of framework.jar.

Instead we install preloaded-classes as a standalone configuration file
/system/etc/preloaded-classes, so we can configure different file per product.

Bug: 18305157
Change-Id: I22f1a1dd44f90268d02532bf18405768523c0b1b
parent 4d269ba3
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -402,9 +402,6 @@ LOCAL_DX_FLAGS := --core-library --multi-dex

LOCAL_RMTYPEDEFS := true

# List of classes and interfaces which should be loaded by the Zygote.
LOCAL_JAVA_RESOURCE_FILES += $(LOCAL_PATH)/preloaded-classes

include $(BUILD_JAVA_LIBRARY)
framework_module := $(LOCAL_INSTALLED_MODULE)

+76 −72
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ import libcore.io.IoUtils;

import java.io.BufferedReader;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -97,9 +99,9 @@ public class ZygoteInit {
    static final int GC_LOOP_COUNT = 10;

    /**
     * The name of a resource file that contains classes to preload.
     * The path of a file that contains classes to preload.
     */
    private static final String PRELOADED_CLASSES = "preloaded-classes";
    private static final String PRELOADED_CLASSES = "/system/etc/preloaded-classes";

    /** Controls whether we should preload resources during zygote init. */
    private static final boolean PRELOAD_RESOURCES = true;
@@ -284,11 +286,14 @@ public class ZygoteInit {
    private static void preloadClasses() {
        final VMRuntime runtime = VMRuntime.getRuntime();

        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(
                PRELOADED_CLASSES);
        if (is == null) {
        InputStream is;
        try {
            is = new FileInputStream(PRELOADED_CLASSES);
        } catch (FileNotFoundException e) {
            Log.e(TAG, "Couldn't find " + PRELOADED_CLASSES + ".");
        } else {
            return;
        }

        Log.i(TAG, "Preloading classes...");
        long startTime = SystemClock.uptimeMillis();

@@ -369,7 +374,6 @@ public class ZygoteInit {
            setEffectiveGroup(ROOT_GID);
        }
    }
    }

    /**
     * Load in commonly used resources, so they can be shared across