Move sysMapFile and sysReleaseMap into MemMapping class.
Test: recovery_component_test
Test: recovery_unit_test
Test: Apply an OTA on angler.
Change-Id: I7170f03e4ce1fe06184ca1d7bcce0a695f33ac4d
diff --git a/install.cpp b/install.cpp
index d86f46c..689f4a0 100644
--- a/install.cpp
+++ b/install.cpp
@@ -569,7 +569,7 @@
}
MemMapping map;
- if (sysMapFile(path.c_str(), &map) != 0) {
+ if (!map.MapFile(path)) {
LOG(ERROR) << "failed to map file";
return INSTALL_CORRUPT;
}
@@ -577,7 +577,6 @@
// Verify package.
if (!verify_package(map.addr, map.length)) {
log_buffer->push_back(android::base::StringPrintf("error: %d", kZipVerificationFailure));
- sysReleaseMap(&map);
return INSTALL_CORRUPT;
}
@@ -588,7 +587,6 @@
LOG(ERROR) << "Can't open " << path << " : " << ErrorCodeString(err);
log_buffer->push_back(android::base::StringPrintf("error: %d", kZipOpenFailure));
- sysReleaseMap(&map);
CloseArchive(zip);
return INSTALL_CORRUPT;
}
@@ -596,7 +594,6 @@
// Additionally verify the compatibility of the package.
if (!verify_package_compatibility(zip)) {
log_buffer->push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure));
- sysReleaseMap(&map);
CloseArchive(zip);
return INSTALL_CORRUPT;
}
@@ -611,7 +608,6 @@
ui->SetEnableReboot(true);
ui->Print("\n");
- sysReleaseMap(&map);
CloseArchive(zip);
return result;
}