diff options
-rw-r--r-- | aosp/update_attempter_android.cc | 14 | ||||
-rw-r--r-- | aosp/update_attempter_android.h | 2 | ||||
-rw-r--r-- | common/constants.h | 2 | ||||
-rw-r--r-- | payload_consumer/delta_performer.cc | 3 | ||||
-rw-r--r-- | payload_consumer/install_plan.h | 1 | ||||
-rwxr-xr-x | scripts/update_device.py | 4 |
6 files changed, 26 insertions, 0 deletions
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc index 555ed333..e12678d8 100644 --- a/aosp/update_attempter_android.cc +++ b/aosp/update_attempter_android.cc @@ -281,6 +281,11 @@ bool UpdateAttempterAndroid::ApplyPayload( 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 @@ void UpdateAttempterAndroid::RemoveCleanupPreviousUpdateCallback( 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 956bd25a..c2226b20 100644 --- a/aosp/update_attempter_android.h +++ b/aosp/update_attempter_android.h @@ -234,6 +234,8 @@ class UpdateAttempterAndroid void RemoveCleanupPreviousUpdateCallback( CleanupSuccessfulUpdateCallbackInterface* callback); + bool IsProductionBuild(); + DaemonStateInterface* daemon_state_; // DaemonStateAndroid pointers. diff --git a/common/constants.h b/common/constants.h index dc45e72b..004d9d95 100644 --- a/common/constants.h +++ b/common/constants.h @@ -179,6 +179,8 @@ static constexpr const auto& kPayloadPropertyNetworkProxy = "NETWORK_PROXY"; // 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 72c9b538..3b9f2b66 100644 --- a/payload_consumer/delta_performer.cc +++ b/payload_consumer/delta_performer.cc @@ -521,6 +521,9 @@ bool DeltaPerformer::Write(const void* bytes, size_t count, ErrorCode* error) { << " 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 8fe104a3..93aebcee 100644 --- a/payload_consumer/install_plan.h +++ b/payload_consumer/install_plan.h @@ -74,6 +74,7 @@ struct InstallPlan { 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 2985c38e..f94774b1 100755 --- a/scripts/update_device.py +++ b/scripts/update_device.py @@ -483,6 +483,8 @@ def main(): 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 @@ def main(): 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: |