aboutsummaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authoraleasto <ales.astone@gmail.com>2021-01-17 20:31:22 +0100
committerMichael Bestas <mkbestas@lineageos.org>2022-08-29 23:07:49 +0300
commit41d0154c5cb8a9b7722eb7e1d528d316cbf13b1e (patch)
treebd89e8c82dc7d89c560852b1858c1e7ef88d7e29 /install
parenta4e197e7c5637fadeb535697d25378f6e831c436 (diff)
recovery: Support writing to Virtual A/B partitions
Change-Id: Ice74e460242a58140fe31240b9fc464848b3aeea
Diffstat (limited to 'install')
-rw-r--r--install/install.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/install/install.cpp b/install/install.cpp
index b515ad19..7175f31a 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -46,6 +46,7 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
+#include "install/snapshot_utils.h"
#include "install/spl_check.h"
#include "install/wipe_data.h"
#include "otautil/error_code.h"
@@ -374,6 +375,7 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
bool device_supports_ab = android::base::GetBoolProperty("ro.build.ab_update", false);
bool ab_device_supports_nonab = true;
bool device_only_supports_ab = device_supports_ab && !ab_device_supports_nonab;
+ bool device_supports_virtual_ab = android::base::GetBoolProperty("ro.virtual_ab.enabled", false);
const auto current_spl = android::base::GetProperty("ro.build.version.security_patch", "");
if (ViolatesSPLDowngrade(zip, current_spl)) {
@@ -396,6 +398,15 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache,
}
}
+ if (!package_is_ab && !logical_partitions_mapped()) {
+ CreateSnapshotPartitions();
+ map_logical_partitions();
+ } else if (package_is_ab && device_supports_virtual_ab && logical_partitions_mapped()) {
+ LOG(ERROR) << "Logical partitions are mapped. "
+ << "Please reboot recovery before installing an OTA update.";
+ return INSTALL_ERROR;
+ }
+
ReadSourceTargetBuild(metadata, log_buffer);
// The updater in child process writes to the pipe to communicate with recovery.