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

Commit d141a903 authored by Ying Wang's avatar Ying Wang Committed by Gerrit Code Review
Browse files

Merge "Move preloaded-classes out of framework.jar."

parents 52e2b6f7 d0c45355
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -400,9 +400,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)

+66 −62
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;
@@ -91,9 +93,9 @@ public class ZygoteInit {
    private static Resources mResources;

    /**
     * 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;
@@ -278,11 +280,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();

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

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