Disable incremental hardening on own resources

When an application is incrementally installed, and a resources
operation fails due to the resources not being fully present,
the app should crash instead of swallowing the error and
returning default values to not alter the experience of
using the application.

Disable IncFsFileMap protections on ApkAssets that are a part of the
application that is running (base and splits).

Bug: 187220960
Test: atest ResourcesHardeningTest
Change-Id: Ibc67aca688720f983c7c656f404593285a54999b
This commit is contained in:
Ryan Mitchell
2021-05-11 12:21:29 -07:00
parent bef47a3577
commit c0416698db
11 changed files with 106 additions and 32 deletions

View File

@@ -323,7 +323,7 @@ ApkResourceContainer::ApkResourceContainer(std::unique_ptr<ZipAssetsProvider> zi
Result<std::unique_ptr<ApkResourceContainer>> ApkResourceContainer::FromPath(
const std::string& path) {
auto zip_assets = ZipAssetsProvider::Create(path);
auto zip_assets = ZipAssetsProvider::Create(path, 0 /* flags */);
if (zip_assets == nullptr) {
return Error("failed to load zip assets");
}

View File

@@ -26,7 +26,7 @@
namespace android::idmap2 {
Result<XmlParser> CreateTestParser(const std::string& test_file) {
auto zip = ZipAssetsProvider::Create(GetTestDataPath() + "/target/target.apk");
auto zip = ZipAssetsProvider::Create(GetTestDataPath() + "/target/target.apk", 0 /* flags */);
if (zip == nullptr) {
return Error("Failed to open zip file");
}