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

Commit bed38b9f authored by Calin Juravle's avatar Calin Juravle Committed by Android (Google) Code Review
Browse files

Merge "Read "dalvik.vm.usejitprofiles" for package compile command" into nyc-dev

parents ba85193b 8bc758b4
Loading
Loading
Loading
Loading
+33 −15
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ShellCommand;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.PrintWriterPrinter;
@@ -249,12 +250,13 @@ class PackageManagerShellCommand extends ShellCommand {

    private int runCompile() throws RemoteException {
        final PrintWriter pw = getOutPrintWriter();
        boolean useJitProfiles = false;
        boolean checkProfiles = SystemProperties.getBoolean("dalvik.vm.usejitprofiles", false);
        boolean forceCompilation = false;
        boolean allPackages = false;
        boolean clearProfileData = false;
        String compilerFilter = null;
        String compilationReason = null;
        String checkProfilesRaw = null;

        if (peekNextArg() == null) {
            // No arguments, show help.
@@ -263,6 +265,8 @@ class PackageManagerShellCommand extends ShellCommand {
            pw.println();
            pw.println("  -c                Clear profile data");
            pw.println("  -f                Force compilation");
            pw.println("  --check-prof val  Look at profiles when doing dexopt.");
            pw.println("                    Overrides dalvik.vm.usejitprofiles to true of false");
            pw.println("  --reset           Reset package");
            pw.println("  -m mode           Compilation mode, one of the dex2oat compiler filters");
            pw.println("                      verify-none");
@@ -301,6 +305,9 @@ class PackageManagerShellCommand extends ShellCommand {
                case "-r":
                    compilationReason = getNextArgRequired();
                    break;
                case "-check-prof":
                    checkProfilesRaw = getNextArgRequired();
                    break;
                case "--reset":
                    forceCompilation = true;
                    clearProfileData = true;
@@ -312,6 +319,17 @@ class PackageManagerShellCommand extends ShellCommand {
            }
        }

        if (checkProfilesRaw != null) {
            if ("true".equals(checkProfilesRaw)) {
                checkProfiles = true;
            } else if ("false".equals(checkProfilesRaw)) {
                checkProfiles = false;
            } else {
                pw.println("Invalid value for \"--check-prof\". Expected \"true\" or \"false\".");
                return 1;
            }
        }

        if (compilerFilter != null && compilationReason != null) {
            pw.println("Cannot use compilation filter (\"-m\") and compilation reason (\"-r\") " +
                    "at the same time");
@@ -381,7 +399,7 @@ class PackageManagerShellCommand extends ShellCommand {
            }

            boolean result = mInterface.performDexOptMode(packageName, null /* instructionSet */,
                    useJitProfiles, targetCompilerFilter, forceCompilation);
                    checkProfiles, targetCompilerFilter, forceCompilation);
            if (!result) {
                failedPackages.add(packageName);
            }