| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 1 | // | 
|  | 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 |  | 
| Nikita Ioffe | aedfef3 | 2021-04-28 13:54:14 +0100 | [diff] [blame] | 20 | #include <memory> | 
| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 21 | #include <string> | 
|  | 22 | #include <vector> | 
|  | 23 |  | 
|  | 24 | #include <android/apex/IApexService.h> | 
|  | 25 | #include <binder/IServiceManager.h> | 
|  | 26 |  | 
|  | 27 | #include "update_engine/aosp/apex_handler_interface.h" | 
|  | 28 | #include "update_engine/update_metadata.pb.h" | 
|  | 29 |  | 
|  | 30 | namespace chromeos_update_engine { | 
|  | 31 |  | 
| Nikita Ioffe | aedfef3 | 2021-04-28 13:54:14 +0100 | [diff] [blame] | 32 | std::unique_ptr<ApexHandlerInterface> CreateApexHandler(); | 
|  | 33 |  | 
| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 34 | class ApexHandlerAndroid : virtual public ApexHandlerInterface { | 
|  | 35 | public: | 
| Mohammad Samiul Islam | b0ab865 | 2021-02-26 14:04:17 +0000 | [diff] [blame] | 36 | android::base::Result<uint64_t> CalculateSize( | 
|  | 37 | const std::vector<ApexInfo>& apex_infos) const; | 
|  | 38 | bool AllocateSpace(const std::vector<ApexInfo>& apex_infos) const; | 
| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 39 |  | 
|  | 40 | private: | 
| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 41 | android::sp<android::apex::IApexService> GetApexService() const; | 
| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 42 | }; | 
|  | 43 |  | 
| Nikita Ioffe | aedfef3 | 2021-04-28 13:54:14 +0100 | [diff] [blame] | 44 | class FlattenedApexHandlerAndroid : virtual public ApexHandlerInterface { | 
|  | 45 | public: | 
|  | 46 | android::base::Result<uint64_t> CalculateSize( | 
|  | 47 | const std::vector<ApexInfo>& apex_infos) const; | 
|  | 48 | bool AllocateSpace(const std::vector<ApexInfo>& apex_infos) const; | 
|  | 49 | }; | 
|  | 50 |  | 
| Mohammad Samiul Islam | 24a8279 | 2021-02-12 16:52:36 +0000 | [diff] [blame] | 51 | }  // namespace chromeos_update_engine | 
|  | 52 |  | 
|  | 53 | #endif  // SYSTEM_UPDATE_ENGINE_AOSP_APEX_HANDLER_ANDROID_H_ |