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

Commit 8d7084ce authored by Narayan Kamath's avatar Narayan Kamath Committed by Android Git Automerger
Browse files

am 2e06258c: Merge "Do not create oat directory for an app in ASEC container"

* commit '2e06258c':
  Do not create oat directory for an app in ASEC container
parents 95e31ac8 2e06258c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -916,6 +916,11 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
    }

    /** @hide */
    public boolean isInternal() {
        return (flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0;
    }

    /**
     * @hide
     */
+2 −1
Original line number Diff line number Diff line
@@ -199,7 +199,8 @@ final class PackageDexOptimizer {
    @Nullable
    private String createOatDirIfSupported(PackageParser.Package pkg, String dexInstructionSet)
            throws IOException {
        if (pkg.isSystemApp() && !pkg.isUpdatedSystemApp()) {
        if ((pkg.isSystemApp() && !pkg.isUpdatedSystemApp()) || pkg.isForwardLocked()
                || (!pkg.applicationInfo.isInternal())) {
            return null;
        }
        File codePath = new File(pkg.codePath);
+16 −12
Original line number Diff line number Diff line
@@ -10254,7 +10254,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        boolean forwardLocked = ((installFlags & PackageManager.INSTALL_FORWARD_LOCK) != 0);
        boolean onSd = ((installFlags & PackageManager.INSTALL_EXTERNAL) != 0);
        boolean replace = false;
        final int scanFlags = SCAN_NEW_INSTALL | SCAN_FORCE_DEX | SCAN_UPDATE_SIGNATURE;
        int scanFlags = SCAN_NEW_INSTALL | SCAN_FORCE_DEX | SCAN_UPDATE_SIGNATURE;
        // Result object to be returned
        res.returnCode = PackageManager.INSTALL_SUCCEEDED;
@@ -10421,7 +10421,11 @@ public class PackageManagerService extends IPackageManager.Stub {
            return;
        }
        // Run dexopt before old package gets removed, to minimize time when app is not available
        // If app directory is not writable, dexopt will be called after the rename
        if (!forwardLocked && pkg.applicationInfo.isInternal()) {
            // Enable SCAN_NO_DEX flag to skip dexopt at a later stage
            scanFlags |= SCAN_NO_DEX;
            // Run dexopt before old package gets removed, to minimize time when app is unavailable
            int result = mPackageDexOptimizer
                    .performDexOpt(pkg, null /* instruction sets */, true /* forceDex */,
                            false /* defer */, false /* inclDependencies */);
@@ -10429,19 +10433,19 @@ public class PackageManagerService extends IPackageManager.Stub {
                res.setError(INSTALL_FAILED_DEXOPT, "Dexopt failed for " + pkg.codePath);
                return;
            }
        }
        if (!args.doRename(res.returnCode, pkg, oldCodePath)) {
            res.setError(INSTALL_FAILED_INSUFFICIENT_STORAGE, "Failed rename");
            return;
        }
        // Call with SCAN_NO_DEX, since dexopt has already been made
        if (replace) {
            replacePackageLI(pkg, parseFlags, scanFlags | SCAN_REPLACING | SCAN_NO_DEX, args.user,
            replacePackageLI(pkg, parseFlags, scanFlags | SCAN_REPLACING, args.user,
                    installerPackageName, res);
        } else {
            installNewPackageLI(pkg, parseFlags, scanFlags | SCAN_DELETE_DATA_ON_FAILURES
                            | SCAN_NO_DEX, args.user, installerPackageName, res);
            installNewPackageLI(pkg, parseFlags, scanFlags | SCAN_DELETE_DATA_ON_FAILURES,
                    args.user, installerPackageName, res);
        }
        synchronized (mPackages) {
            final PackageSetting ps = mSettings.mPackages.get(pkgName);