aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-14 00:24:34 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-14 00:24:34 +0000
commit68ff0d62cd3c226418e15d3903cf7ea97fd658c1 (patch)
treec2b82b0895a9823ba3ed4ced0cc0164d669d4a68
parent267ae5741c42ead3cd4fbb72dfbc4f113a26e721 (diff)
parent1a2734574332d691a8d16ec6e7c423cc3941af7b (diff)
downloadupdate_engine-android14-qpr2-s1-release.tar.gz
Change-Id: I0f5a8ec808acc86ef481500acbfdc1b44ccffddd
-rw-r--r--aosp/update_attempter_android.cc7
-rw-r--r--payload_consumer/delta_performer.cc2
-rw-r--r--payload_consumer/delta_performer_unittest.cc2
-rw-r--r--payload_consumer/install_plan.h2
-rwxr-xr-xscripts/update_device.py10
5 files changed, 13 insertions, 10 deletions
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 0f4b2e4b..1adaabc3 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -23,6 +23,7 @@
#include <utility>
#include <vector>
+#include <android-base/parsebool.h>
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <base/bind.h>
@@ -391,7 +392,11 @@ bool UpdateAttempterAndroid::ApplyPayload(
install_plan_.vabc_none = true;
}
if (!headers[kPayloadEnableThreading].empty()) {
- install_plan_.enable_threading = true;
+ const auto res = android::base::ParseBool(headers[kPayloadEnableThreading]);
+ if (res != android::base::ParseBoolResult::kError) {
+ install_plan_.enable_threading =
+ res == android::base::ParseBoolResult::kTrue;
+ }
}
if (!headers[kPayloadBatchedWrites].empty()) {
install_plan_.batched_writes = true;
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 8350825a..8a820f96 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -530,7 +530,7 @@ bool DeltaPerformer::Write(const void* bytes, size_t count, ErrorCode* error) {
if (install_plan_->enable_threading) {
manifest_.mutable_dynamic_partition_metadata()
->mutable_vabc_feature_set()
- ->set_threaded(true);
+ ->set_threaded(install_plan_->enable_threading.value());
LOG(INFO) << "Attempting to enable multi-threaded compression for VABC";
}
if (install_plan_->batched_writes) {
diff --git a/payload_consumer/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc
index 0f48da15..e90bb7c2 100644
--- a/payload_consumer/delta_performer_unittest.cc
+++ b/payload_consumer/delta_performer_unittest.cc
@@ -17,7 +17,6 @@
#include "update_engine/payload_consumer/delta_performer.h"
#include <endian.h>
-#include <inttypes.h>
#include <time.h>
#include <algorithm>
@@ -43,7 +42,6 @@
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/fake_prefs.h"
-#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/mock_download_action.h"
#include "update_engine/common/test_utils.h"
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index bad34a0e..dbbe4b25 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -204,7 +204,7 @@ struct InstallPlan {
bool batched_writes = false;
// Whether to enable multi-threaded compression on COW writes
- bool enable_threading = false;
+ std::optional<bool> enable_threading;
};
class InstallPlanAction;
diff --git a/scripts/update_device.py b/scripts/update_device.py
index f5151403..26e6e1cb 100755
--- a/scripts/update_device.py
+++ b/scripts/update_device.py
@@ -22,7 +22,6 @@ from __future__ import absolute_import
import argparse
import binascii
-import hashlib
import logging
import os
import re
@@ -33,7 +32,6 @@ import struct
import tempfile
import time
import threading
-import xml.etree.ElementTree
import zipfile
import shutil
@@ -338,9 +336,7 @@ def PushMetadata(dut, otafile, metadata_path):
assert magic == b"CrAU", "Invalid magic {}, expected CrAU".format(magic)
assert major_version == 2, "Invalid major version {}, only version 2 is supported".format(major_version)
output_fp.write(header)
-
- shutil.copyfileobj(payload_fp, output_fp, manifest_size + metadata_signature_size)
-
+ output_fp.write(payload_fp.read(manifest_size + metadata_signature_size))
return dut.adb([
"push",
@@ -412,6 +408,8 @@ def main():
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('--disable-threading', action='store_true',
+ help='Enable multi-threaded compression for VABC')
parser.add_argument('--batched-writes', action='store_true',
help='Enable batched writes for VABC')
parser.add_argument('--speed-limit', type=str,
@@ -481,6 +479,8 @@ def main():
args.extra_headers += "\nDISABLE_VABC=1"
if args.enable_threading:
args.extra_headers += "\nENABLE_THREADING=1"
+ elif args.disable_threading:
+ args.extra_headers += "\nENABLE_THREADING=0"
if args.batched_writes:
args.extra_headers += "\nBATCHED_WRITES=1"