blob: aac1cd9cc856432afd6a4b6daed734e9887cd31d [file] [log] [blame]
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +00001//
2// Copyright (C) 2021 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#ifndef SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_
18#define SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_
19
20#include <string>
21#include <vector>
22
23#include <android/apex/IApexService.h>
24#include <binder/IServiceManager.h>
25
26#include "update_engine/aosp/apex_handler_interface.h"
27#include "update_engine/update_metadata.pb.h"
28
29namespace chromeos_update_engine {
30
31class ApexHandlerAndroid : virtual public ApexHandlerInterface {
32 public:
33 uint64_t CalculateSize(const std::vector<ApexInfo>& apex_infos) const;
34 bool AllocateSpace(const uint64_t size_required) const;
35
36 private:
37 friend class ApexHandlerAndroidTest;
38 android::sp<android::apex::IApexService> GetApexService() const;
39 uint64_t CalculateSize(
40 const std::vector<ApexInfo>& apex_infos,
41 android::sp<android::apex::IApexService> apex_service) const;
42 bool AllocateSpace(const uint64_t size_required,
43 const std::string& dir_path) const;
44};
45
46} // namespace chromeos_update_engine
47
48#endif // SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_