Revert "Revert "Early detection of mis-configuration (1/n)""

This reverts commit f42633bed3.

Reason for revert: reland the CL for b/203026561

Change-Id: I883876e7b5116c7624f993c62871bd3bbb7900d8
This commit is contained in:
JW Wang
2021-10-20 09:19:21 +00:00
parent f42633bed3
commit 38c6f6065a

View File

@@ -2406,13 +2406,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
final VerificationParams verifyingSession = prepareForVerification();
if (isMultiPackage()) {
final List<PackageInstallerSession> childSessions = getChildSessions();
// Spot check to reject a non-staged multi package install of APEXes and APKs.
if (!params.isStaged && containsApkSession()
&& sessionContains(s -> s.isApexSession())) {
throw new PackageManagerException(
PackageManager.INSTALL_FAILED_SESSION_INVALID,
"Non-staged multi package install of APEX and APK packages is not supported");
}
List<VerificationParams> verifyingChildSessions =
new ArrayList<>(childSessions.size());
boolean success = true;
@@ -4172,6 +4165,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
+ childSession.sessionId + " and session " + sessionId
+ " have inconsistent rollback settings");
}
boolean hasAPK = containsApkSession() || !childSession.isApexSession();
boolean hasAPEX = sessionContains(s -> s.isApexSession()) || childSession.isApexSession();
if (!params.isStaged && hasAPK && hasAPEX) {
throw new IllegalStateException("Mix of APK and APEX is not supported for "
+ "non-staged multi-package session");
}
try {
acquireTransactionLock();