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
diff --git a/aosp/apex_handler_android.h b/aosp/apex_handler_android.h
index 00f3a80..767f561 100644
--- a/aosp/apex_handler_android.h
+++ b/aosp/apex_handler_android.h
@@ -17,6 +17,7 @@
#ifndef SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_
#define SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_
+#include <memory>
#include <string>
#include <vector>
@@ -28,6 +29,8 @@
namespace chromeos_update_engine {
+std::unique_ptr<ApexHandlerInterface> CreateApexHandler();
+
class ApexHandlerAndroid : virtual public ApexHandlerInterface {
public:
android::base::Result<uint64_t> CalculateSize(
@@ -38,6 +41,13 @@
android::sp<android::apex::IApexService> GetApexService() const;
};
+class FlattenedApexHandlerAndroid : virtual public ApexHandlerInterface {
+ public:
+ android::base::Result<uint64_t> CalculateSize(
+ const std::vector<ApexInfo>& apex_infos) const;
+ bool AllocateSpace(const std::vector<ApexInfo>& apex_infos) const;
+};
+
} // namespace chromeos_update_engine
#endif // SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_