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

Commit a81d1e69 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixes testRequiredSplitRemoved failed in SplitTests"

parents be41f05d 19a092cb
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -2544,6 +2544,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,
                        "Full install must include a base package");
            }
            if (baseApk.isSplitRequired && stagedSplits.size() <= 1) {
                throw new PackageManagerException(INSTALL_FAILED_MISSING_SPLIT,
                        "Missing split for " + mPackageName);
            }
        } else {
            final ApplicationInfo appInfo = pkgInfo.applicationInfo;
            ParseResult<PackageLite> pkgLiteResult = ApkLiteParseUtils.parsePackageLite(
@@ -2654,6 +2658,17 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                    mResolvedInheritedFiles.addAll(libFilesToInherit);
                }
            }
            // For the case of split required, failed if no splits existed
            if (baseApk.isSplitRequired) {
                final int existingSplits = ArrayUtils.size(existing.splitNames);
                final boolean allSplitsRemoved = (existingSplits == removeSplitList.size());
                final boolean onlyBaseFileStaged = (stagedSplits.size() == 1
                        && stagedSplits.contains(null));
                if (allSplitsRemoved && (stagedSplits.isEmpty() || onlyBaseFileStaged)) {
                    throw new PackageManagerException(INSTALL_FAILED_MISSING_SPLIT,
                            "Missing split for " + mPackageName);
                }
            }
        }
        if (baseApk.useEmbeddedDex) {
            for (File file : mResolvedStagedFiles) {
@@ -2665,10 +2680,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                }
            }
        }
        if (baseApk.isSplitRequired && stagedSplits.size() <= 1) {
            throw new PackageManagerException(INSTALL_FAILED_MISSING_SPLIT,
                    "Missing split for " + mPackageName);
        }

        final boolean isInstallerShell = (mInstallerUid == Process.SHELL_UID);
        if (isInstallerShell && isIncrementalInstallation() && mIncrementalFileStorages != null) {