summaryrefslogtreecommitdiff
path: root/aosp/apex_handler_android.cc
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2021-06-09 05:18:08 -0700
committerLinux Build Service Account <lnxbuild@localhost>2021-06-09 05:18:08 -0700
commitf476d74eefab00e5b40d54513a2621e664c70ddf (patch)
tree01ec931931503ed80f181b2d85efb5df0079e4ba /aosp/apex_handler_android.cc
parent0482fa15f58c1de5ead9e0e3e2aa1d593d18e6c2 (diff)
parentac7fc8e1debff1f57afe79f144d8d16a1a0ec470 (diff)
Merge ac7fc8e1debff1f57afe79f144d8d16a1a0ec470 on remote branch
Change-Id: I2cd41cefedfd492f9e20617ad9929ebf1cdde79e
Diffstat (limited to 'aosp/apex_handler_android.cc')
-rw-r--r--aosp/apex_handler_android.cc21
1 files changed, 21 insertions, 0 deletions
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 <memory>
#include <utility>
#include <base/files/file_util.h>
+#include <ApexProperties.sysprop.h>
+
#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<ApexHandlerInterface> CreateApexHandler() {
+ if (android::sysprop::ApexProperties::updatable().value_or(false)) {
+ return std::make_unique<ApexHandlerAndroid>();
+ } else {
+ return std::make_unique<FlattenedApexHandlerAndroid>();
+ }
+}
+
android::base::Result<uint64_t> ApexHandlerAndroid::CalculateSize(
const std::vector<ApexInfo>& apex_infos) const {
// We might not need to decompress every APEX. Communicate with apexd to get
@@ -86,4 +97,14 @@ android::sp<android::apex::IApexService> ApexHandlerAndroid::GetApexService()
return android::interface_cast<android::apex::IApexService>(binder);
}
+android::base::Result<uint64_t> FlattenedApexHandlerAndroid::CalculateSize(
+ const std::vector<ApexInfo>& apex_infos) const {
+ return 0;
+}
+
+bool FlattenedApexHandlerAndroid::AllocateSpace(
+ const std::vector<ApexInfo>& apex_infos) const {
+ return true;
+}
+
} // namespace chromeos_update_engine