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

Commit e65bff57 authored by Jiakai Zhang's avatar Jiakai Zhang Committed by Automerger Merge Worker
Browse files

Merge "Allow createOatDir for partial installation." into udc-dev am: 76c7fbbe am: 80698bef

parents 842b111e 80698bef
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -821,8 +821,10 @@ public class Installer extends SystemService {
     * Creates an oat dir for given package and instruction set.
     */
    public void createOatDir(String packageName, String oatDir, String dexInstructionSet)
            throws InstallerException, LegacyDexoptDisabledException {
        checkLegacyDexoptDisabled();
            throws InstallerException {
        // This method should be allowed even if ART Service is enabled, because it's used for
        // creating oat dirs before creating hard links for partial installation.
        // TODO(b/274658735): Add an ART Service API to support hard linking.
        if (!checkBeforeRemote()) return;
        try {
            mInstalld.createOatDir(packageName, oatDir, dexInstructionSet);
+4 −12
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ import static com.android.internal.util.XmlUtils.writeBooleanAttribute;
import static com.android.internal.util.XmlUtils.writeByteArrayAttribute;
import static com.android.internal.util.XmlUtils.writeStringAttribute;
import static com.android.internal.util.XmlUtils.writeUriAttribute;
import static com.android.server.pm.DexOptHelper.useArtService;
import static com.android.server.pm.PackageInstallerService.prepareStageDir;
import static com.android.server.pm.PackageManagerService.APP_METADATA_FILE_NAME;

@@ -173,7 +172,6 @@ import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
import com.android.server.LocalServices;
import com.android.server.pm.Installer.InstallerException;
import com.android.server.pm.Installer.LegacyDexoptDisabledException;
import com.android.server.pm.dex.DexManager;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.PackageStateInternal;
@@ -2565,15 +2563,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                }

                if (isLinkPossible(fromFiles, toDir)) {
                    if (!useArtService()) { // ART Service creates oat dirs on demand instead.
                    if (!mResolvedInstructionSets.isEmpty()) {
                        final File oatDir = new File(toDir, "oat");
                            try {
                        createOatDirs(tempPackageName, mResolvedInstructionSets, oatDir);
                            } catch (LegacyDexoptDisabledException e) {
                                throw new RuntimeException(e);
                            }
                        }
                    }
                    // pre-create lib dirs for linking if necessary
                    if (!mResolvedNativeLibPaths.isEmpty()) {
@@ -3829,7 +3821,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
    }

    private void createOatDirs(String packageName, List<String> instructionSets, File fromDir)
            throws PackageManagerException, LegacyDexoptDisabledException {
            throws PackageManagerException {
        for (String instructionSet : instructionSets) {
            try {
                mInstaller.createOatDir(packageName, fromDir.getAbsolutePath(), instructionSet);