From aedfef3c2f2834645654833bae6fd1daf6ca1040 Mon Sep 17 00:00:00 2001 From: Nikita Ioffe Date: Wed, 28 Apr 2021 13:54:14 +0100 Subject: Don't call into apexservice if device uses flattened apexes If device doesn't support updatable apexes (a.k.a. uses flattened apexes), then it won't have compressed apexes, so there is no need calling into apexd. Test: atest update_engine_unittests:ApexHandlerAndroidTest Test: build and flash aosp_cf_x86_phone_noapex-userdebug Test: m dist Test: python3 system/update_engine/scripts/update_device.py --file out/target/product/vsoc_x86_noapex/aosp_cf_x86_phone_noapex-ota-eng.ioffe.zip Test: checked OTA was successfully staged Bug: 185862111 Change-Id: Ibf9db757f3af37d23fb8248108b2b6d22c95dec7 --- aosp/apex_handler_android.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'aosp/apex_handler_android.cc') diff --git a/aosp/apex_handler_android.cc b/aosp/apex_handler_android.cc index 38ec410b..8beef966 100644 --- a/aosp/apex_handler_android.cc +++ b/aosp/apex_handler_android.cc @@ -14,10 +14,13 @@ // limitations under the License. // +#include #include #include +#include + #include "update_engine/aosp/apex_handler_android.h" #include "update_engine/common/utils.h" @@ -44,6 +47,14 @@ android::apex::CompressedApexInfoList CreateCompressedApexInfoList( } // namespace +std::unique_ptr CreateApexHandler() { + if (android::sysprop::ApexProperties::updatable().value_or(false)) { + return std::make_unique(); + } else { + return std::make_unique(); + } +} + android::base::Result ApexHandlerAndroid::CalculateSize( const std::vector& apex_infos) const { // We might not need to decompress every APEX. Communicate with apexd to get @@ -86,4 +97,14 @@ android::sp ApexHandlerAndroid::GetApexService() return android::interface_cast(binder); } +android::base::Result FlattenedApexHandlerAndroid::CalculateSize( + const std::vector& apex_infos) const { + return 0; +} + +bool FlattenedApexHandlerAndroid::AllocateSpace( + const std::vector& apex_infos) const { + return true; +} + } // namespace chromeos_update_engine -- cgit v1.2.3