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

Commit 45e503ae authored by android-build SharedAccount's avatar android-build SharedAccount
Browse files

resolved conflicts for merge of 802527c6 to master skipping preloaded-classes as pre Bob

parents 4547962a 802527c6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -310,6 +310,15 @@ public class ZygoteInit {
                        } else {
                            missingClasses += " " + line;
                        }
                    } catch (Throwable t) {
                        Log.e(TAG, "Error preloading " + line + ".", t);
                        if (t instanceof Error) {
                            throw (Error) t;
                        }
                        if (t instanceof RuntimeException) {
                            throw (RuntimeException) t;
                        }
                        throw new RuntimeException(t);
                    }
                }

+15 MiB

File added.

No diff preview for this file type.

+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class ClassRank implements Comparator<Operation> {
     * Increase this number to add more weight to classes which were loaded
     * earlier.
     */
    static final int SEQUENCE_WEIGHT = 500; // 5 ms
    static final int SEQUENCE_WEIGHT = 500; // 0.5ms

    static final int BUCKET_SIZE = 5;

+15 −25
Original line number Diff line number Diff line
@@ -15,10 +15,7 @@
 */

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.*;

/**
 * A loaded class.
@@ -54,7 +51,7 @@ class LoadedClass implements Serializable, Comparable<LoadedClass> {
    }

    void measureMemoryUsage() {
        this.memoryUsage = MemoryUsage.forClass(name);        
//        this.memoryUsage = MemoryUsage.forClass(name);
    }

    int mlt = -1;
@@ -102,31 +99,20 @@ class LoadedClass implements Serializable, Comparable<LoadedClass> {
        }
    }

    /**
     * Counts loads by apps.
     */
    int appLoads() {
        return operationsByApps(loads);
    }

    /**
     * Counts inits by apps.
     */
    int appInits() {
        return operationsByApps(initializations);
    /** Returns names of apps that loaded this class. */
    Set<String> applicationNames() {
        Set<String> appNames = new HashSet<String>();
        addProcessNames(loads, appNames);
        addProcessNames(initializations, appNames);
        return appNames;
    }

    /**
     * Counts number of app operations in the given list.
     */
    private static int operationsByApps(List<Operation> operations) {
        int byApps = 0;
        for (Operation operation : operations) {
    private void addProcessNames(List<Operation> ops, Set<String> appNames) {
        for (Operation operation : ops) {
            if (operation.process.isApplication()) {
                byApps++;
                appNames.add(operation.process.name);
            }
        }
        return byApps;
    }

    public int compareTo(LoadedClass o) {
@@ -160,4 +146,8 @@ class LoadedClass implements Serializable, Comparable<LoadedClass> {

        return false;
    }

    public boolean isPreloadable() {
        return systemClass && Policy.isPreloadableClass(name);
    }
}
+14 −42
Original line number Diff line number Diff line
@@ -24,47 +24,32 @@ import java.util.Set;
public class Policy {
    
    /**
     * This location (in the build system) of the preloaded-classes file.
     */
    private static final String PRELOADED_CLASS_FILE = "frameworks/base/preloaded-classes";
    
    /**
     * The internal process name of the system process.  Note, this also shows up as
     * "system_process", e.g. in ddms.
     * No constructor - use static methods only
     */
    private static final String SYSTEM_SERVER_PROCESS_NAME = "system_server";
    private Policy() {}

    /**
     * Names of non-application processes - these will not be checked for preloaded classes.
     * 
     * TODO: Replace this hardcoded list with a walk up the parent chain looking for zygote.
     * This location (in the build system) of the preloaded-classes file.
     */
    private static final Set<String> NOT_FROM_ZYGOTE = new HashSet<String>(Arrays.asList(
            "zygote",
            "dexopt",
            "unknown",
            SYSTEM_SERVER_PROCESS_NAME,
            "com.android.development",
            "app_process" // am & other shell commands
    ));
    private static final String PRELOADED_CLASS_FILE
            = "frameworks/base/preloaded-classes";

    /**
     * Long running services.  These are restricted in their contribution to the preloader
     * because their launch time is less critical.
     * Long running services. These are restricted in their contribution to the 
     * preloader because their launch time is less critical.
     */
    private static final Set<String> SERVICES = new HashSet<String>(Arrays.asList(
            SYSTEM_SERVER_PROCESS_NAME,
            "com.android.acore",
         // Commented out to make sure DefaultTimeZones gets preloaded.
         // "com.android.phone",
            "system_server",
            "com.google.process.content",
            "android.process.media"
            "android.process.media",
            "com.google.process.gapps"
    ));

    /**
     * Classes which we shouldn't load from the Zygote.
     */
    private static final Set<String> EXCLUDED_CLASSES = new HashSet<String>(Arrays.asList(
    private static final Set<String> EXCLUDED_CLASSES
            = new HashSet<String>(Arrays.asList(
        // Binders
        "android.app.AlarmManager",
        "android.app.SearchManager",
@@ -75,14 +60,8 @@ public class Policy {
        "android.os.AsyncTask",
        "android.pim.ContactsAsyncHelper",
        "java.lang.ProcessManager"
        
    ));

    /**
     * No constructor - use static methods only
     */
    private Policy() {}
    
    /**
     * Returns the path/file name of the preloaded classes file that will be written 
     * by WritePreloadedClassFile.
@@ -91,13 +70,6 @@ public class Policy {
        return PRELOADED_CLASS_FILE;
    }
    
    /**
     * Reports if a given process name was created from zygote
     */
    public static boolean isFromZygote(String processName) {
        return !NOT_FROM_ZYGOTE.contains(processName);
    }
    
    /**
     * Reports if the given process name is a "long running" process or service
     */
Loading