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

Commit 3bec87c9 authored by Calin Juravle's avatar Calin Juravle Committed by Gerrit Code Review
Browse files

Merge "Pass vmSafeMode (manifest attribute) to installd."

parents 9b5112c3 e8d2ffd7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -240,11 +240,12 @@ public final class Installer {
        builder.append(" *");         // No pkgName arg present
        builder.append(' ');
        builder.append(instructionSet);
        builder.append(" 0");         // vmSafeMode=false
        return execute(builder.toString());
    }

    public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
            String instructionSet) {
            String instructionSet, boolean vmSafeMode) {
        StringBuilder builder = new StringBuilder("dexopt");
        builder.append(' ');
        builder.append(apkPath);
@@ -255,6 +256,7 @@ public final class Installer {
        builder.append(pkgName);
        builder.append(' ');
        builder.append(instructionSet);
        builder.append(vmSafeMode ? " 1" : " 0");
        return execute(builder.toString());
    }

+4 −2
Original line number Diff line number Diff line
@@ -4293,6 +4293,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            }
        }
        final boolean vmSafeMode = (pkg.applicationInfo.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0;
        boolean performed = false;
        if ((pkg.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) {
            String path = pkg.mScanPath;
@@ -4309,10 +4310,11 @@ public class PackageManagerService extends IPackageManager.Stub {
                // 2.) we are defering a needed dexopt
                // 3.) we are skipping an unneeded dexopt
                if (forceDex || (!defer && isDexOptNeededInternal == DexFile.DEXOPT_NEEDED)) {
                    Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName);
                    Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName
                            + " vmSafeMode=" + vmSafeMode);
                    final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
                    int ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg),
                                                pkg.packageName, dexCodeInstructionSet);
                                                pkg.packageName, dexCodeInstructionSet, vmSafeMode);
                    // Note that we ran dexopt, since rerunning will
                    // probably just result in an error again.
                    pkg.mDexOptNeeded = false;