Added a field to set enable_vabc
Test: tested OTA on cuttlefish
Bug: 274511687
Change-Id: I55bee646f0b075b30a1fd533f8baa44eeaaac8f9
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 555ed33..e12678d 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -281,6 +281,11 @@
install_plan_.powerwash_required =
GetHeaderAsBool(headers[kPayloadPropertyPowerwash], false);
+ if (!IsProductionBuild()) {
+ install_plan_.disable_vabc =
+ GetHeaderAsBool(headers[kPayloadDisableVABC], false);
+ }
+
install_plan_.switch_slot_on_reboot =
GetHeaderAsBool(headers[kPayloadPropertySwitchSlotOnReboot], true);
@@ -1318,4 +1323,13 @@
end_it, cleanup_previous_update_callbacks_.end());
}
+bool UpdateAttempterAndroid::IsProductionBuild() {
+ if (android::base::GetProperty("ro.build.type", "") != "userdebug" ||
+ android::base::GetProperty("ro.build.tags", "") == "release-keys" ||
+ android::base::GetProperty("ro.boot.verifiedbootstate", "") == "green") {
+ return true;
+ }
+ return false;
+}
+
} // namespace chromeos_update_engine
diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h
index 956bd25..c2226b2 100644
--- a/aosp/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -234,6 +234,8 @@
void RemoveCleanupPreviousUpdateCallback(
CleanupSuccessfulUpdateCallbackInterface* callback);
+ bool IsProductionBuild();
+
DaemonStateInterface* daemon_state_;
// DaemonStateAndroid pointers.
diff --git a/common/constants.h b/common/constants.h
index dc45e72..004d9d9 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -179,6 +179,8 @@
// Set Virtual AB Compression's compression algorithm to "none", but still use
// userspace snapshots and snapuserd for update installation.
static constexpr const auto& kPayloadVABCNone = "VABC_NONE";
+// Enable/Disable VABC, falls back on plain VAB
+static constexpr const auto& kPayloadDisableVABC = "DISABLE_VABC";
// Enable multi-threaded compression for VABC
static constexpr const auto& kPayloadEnableThreading = "ENABLE_THREADING";
// Enable batched writes for VABC
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 72c9b53..3b9f2b6 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -521,6 +521,9 @@
<< " is " << partition.estimate_cow_size();
}
}
+ if (install_plan_->disable_vabc) {
+ manifest_.mutable_dynamic_partition_metadata()->set_vabc_enabled(false);
+ }
if (install_plan_->enable_threading) {
manifest_.mutable_dynamic_partition_metadata()
->mutable_vabc_feature_set()
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index 8fe104a..93aebce 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -74,6 +74,7 @@
bool is_resume{false};
bool vabc_none{false};
+ bool disable_vabc{false};
std::string download_url; // url to download from
std::string version; // version we are installing.
diff --git a/scripts/update_device.py b/scripts/update_device.py
index 2985c38..f94774b 100755
--- a/scripts/update_device.py
+++ b/scripts/update_device.py
@@ -483,6 +483,8 @@
help='Wipe userdata after installing OTA')
parser.add_argument('--vabc-none', action='store_true',
help='Set Virtual AB Compression algorithm to none, but still use Android COW format')
+ parser.add_argument('--disable-vabc', action='store_true',
+ help='Option to enable or disable vabc. If set to false, will fall back on A/B')
parser.add_argument('--enable-threading', action='store_true',
help='Enable multi-threaded compression for VABC')
parser.add_argument('--batched-writes', action='store_true',
@@ -549,6 +551,8 @@
args.extra_headers += "\nPOWERWASH=1"
if args.vabc_none:
args.extra_headers += "\nVABC_NONE=1"
+ if args.disable_vabc:
+ args.extra_headers += "\nDISABLE_VABC=1"
if args.enable_threading:
args.extra_headers += "\nENABLE_THREADING=1"
if args.batched_writes: