summaryrefslogtreecommitdiff
path: root/aosp/apex_handler_android.cc
diff options
context:
space:
mode:
authorBrian Orr <brianorr@google.com>2021-05-10 11:39:59 -0700
committerBrian Orr <brianorr@google.com>2021-05-10 11:39:59 -0700
commitf79cb91b4218a68642c94a01defc0594e742b3f4 (patch)
tree01ec931931503ed80f181b2d85efb5df0079e4ba /aosp/apex_handler_android.cc
parentd650df1d306a5a828e7b13a8cc954196fea44992 (diff)
parent3d4e6e0d7ed2b609e0fe2b4d0fcb250808f97476 (diff)
Merge SP1A.210510.001
Change-Id: If7498b293041f2ae00fd93563417d60a0c13e7c9
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