Merge up to android-8.1.0_r1 and fix conflicts
Change-Id: I2dc060134d15ec9f015a606cb24ef8276f6af1fc
diff --git a/twinstall.cpp b/twinstall.cpp
index ab71529..7351e63 100644
--- a/twinstall.cpp
+++ b/twinstall.cpp
@@ -363,7 +363,11 @@
DataManager::SetProgress(0);
MemMapping map;
+#ifdef USE_MINZIP
if (sysMapFile(path, &map) != 0) {
+#else
+ if (!map.MapFile(path)) {
+#endif
gui_msg(Msg(msg::kError, "fail_sysmap=Failed to map file '{1}'")(path));
return -1;
}
@@ -377,6 +381,9 @@
if (!load_keys("/res/keys", loadedKeys)) {
LOGINFO("Failed to load keys");
gui_err("verify_zip_fail=Zip signature verification failed!");
+#ifdef USE_MINZIP
+ sysReleaseMap(&map);
+#endif
return -1;
}
ret_val = verify_file(map.addr, map.length, loadedKeys, std::bind(&DataManager::SetProgress, std::placeholders::_1));
@@ -384,7 +391,9 @@
if (ret_val != VERIFY_SUCCESS) {
LOGINFO("Zip signature verification failed: %i\n", ret_val);
gui_err("verify_zip_fail=Zip signature verification failed!");
+#ifdef USE_MINZIP
sysReleaseMap(&map);
+#endif
return -1;
} else {
gui_msg("verify_zip_done=Zip signature verified successfully.");
@@ -393,7 +402,9 @@
ZipWrap Zip;
if (!Zip.Open(path, &map)) {
gui_err("zip_corrupt=Zip file is corrupt!");
- sysReleaseMap(&map);
+#ifdef USE_MINZIP
+ sysReleaseMap(&map);
+#endif
return INSTALL_CORRUPT;
}
@@ -404,8 +415,10 @@
// Additionally verify the compatibility of the package.
if (!verify_package_compatibility(&Zip)) {
gui_err("zip_compatible_err=Zip Treble compatibility error!");
- sysReleaseMap(&map);
Zip.Close();
+#ifdef USE_MINZIP
+ sysReleaseMap(&map);
+#endif
ret_val = INSTALL_CORRUPT;
} else {
ret_val = Prepare_Update_Binary(path, &Zip, wipe_cache);
@@ -433,6 +446,8 @@
} else {
LOGINFO("Install took %i second(s).\n", total_time);
}
+#ifdef USE_MINZIP
sysReleaseMap(&map);
+#endif
return ret_val;
}