Appropriately sets all installs on *any* failure of one

During multi-package install, this change ensures that all of the
install results have their reason set to a value besides
INSTALL_SUCCEEDED to avoid post install steps treating them as if they
were successfully installed.

Test: atest com.android.tests.atomicinstall.AtomicInstallTest#testEarlyFailureFailsAll
Fixes: 133380744
Change-Id: I60b5c5376a27979d3fa4dfb67914dbd3573e280b
This commit is contained in:
Patrick Baumann
2019-05-23 14:33:46 -07:00
parent 612f71b1df
commit 64fcdf63a8

View File

@@ -17071,6 +17071,13 @@ public class PackageManagerService extends IPackageManager.Stub
cleanUpAppIdCreation(result);
}
}
// TODO(patb): create a more descriptive reason than unknown in future release
// mark all non-failure installs as UNKNOWN so we do not treat them as success
for (InstallRequest request : requests) {
if (request.installResult.returnCode == PackageManager.INSTALL_SUCCEEDED) {
request.installResult.returnCode = PackageManager.INSTALL_UNKNOWN;
}
}
}
for (PrepareResult result : prepareResults.values()) {
if (result.freezer != null) {