1 //
2 // Copyright (C) 2019 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 #include <stdint.h>
18
19 #include <memory>
20 #include <string>
21
22 #include <base/logging.h>
23 #include <libsnapshot/cow_writer.h>
24
25 #include "update_engine/common/dynamic_partition_control_stub.h"
26
27 namespace chromeos_update_engine {
28
GetDynamicPartitionsFeatureFlag()29 FeatureFlag DynamicPartitionControlStub::GetDynamicPartitionsFeatureFlag() {
30 return FeatureFlag(FeatureFlag::Value::NONE);
31 }
32
GetVirtualAbFeatureFlag()33 FeatureFlag DynamicPartitionControlStub::GetVirtualAbFeatureFlag() {
34 return FeatureFlag(FeatureFlag::Value::NONE);
35 }
36
GetVirtualAbCompressionFeatureFlag()37 FeatureFlag DynamicPartitionControlStub::GetVirtualAbCompressionFeatureFlag() {
38 return FeatureFlag(FeatureFlag::Value::NONE);
39 }
40
OptimizeOperation(const std::string & partition_name,const InstallOperation & operation,InstallOperation * optimized)41 bool DynamicPartitionControlStub::OptimizeOperation(
42 const std::string& partition_name,
43 const InstallOperation& operation,
44 InstallOperation* optimized) {
45 return false;
46 }
47
Cleanup()48 void DynamicPartitionControlStub::Cleanup() {}
49
PreparePartitionsForUpdate(uint32_t source_slot,uint32_t target_slot,const DeltaArchiveManifest & manifest,bool update,uint64_t * required_size)50 bool DynamicPartitionControlStub::PreparePartitionsForUpdate(
51 uint32_t source_slot,
52 uint32_t target_slot,
53 const DeltaArchiveManifest& manifest,
54 bool update,
55 uint64_t* required_size) {
56 return true;
57 }
58
FinishUpdate(bool powerwash_required)59 bool DynamicPartitionControlStub::FinishUpdate(bool powerwash_required) {
60 return true;
61 }
62
63 std::unique_ptr<AbstractAction>
GetCleanupPreviousUpdateAction(BootControlInterface * boot_control,PrefsInterface * prefs,CleanupPreviousUpdateActionDelegateInterface * delegate)64 DynamicPartitionControlStub::GetCleanupPreviousUpdateAction(
65 BootControlInterface* boot_control,
66 PrefsInterface* prefs,
67 CleanupPreviousUpdateActionDelegateInterface* delegate) {
68 return std::make_unique<NoOpAction>();
69 }
70
ResetUpdate(PrefsInterface * prefs)71 bool DynamicPartitionControlStub::ResetUpdate(PrefsInterface* prefs) {
72 return false;
73 }
74
ListDynamicPartitionsForSlot(uint32_t slot,uint32_t current_slot,std::vector<std::string> * partitions)75 bool DynamicPartitionControlStub::ListDynamicPartitionsForSlot(
76 uint32_t slot,
77 uint32_t current_slot,
78 std::vector<std::string>* partitions) {
79 return true;
80 }
81
GetDeviceDir(std::string * path)82 bool DynamicPartitionControlStub::GetDeviceDir(std::string* path) {
83 return true;
84 }
85
VerifyExtentsForUntouchedPartitions(uint32_t source_slot,uint32_t target_slot,const std::vector<std::string> & partitions)86 bool DynamicPartitionControlStub::VerifyExtentsForUntouchedPartitions(
87 uint32_t source_slot,
88 uint32_t target_slot,
89 const std::vector<std::string>& partitions) {
90 return true;
91 }
92
93 std::unique_ptr<android::snapshot::ISnapshotWriter>
OpenCowWriter(const std::string &,const std::optional<std::string> &,bool)94 DynamicPartitionControlStub::OpenCowWriter(
95 const std::string& /*unsuffixed_partition_name*/,
96 const std::optional<std::string>& /*source_path*/,
97 bool /*is_append*/) {
98 return nullptr;
99 }
100
MapAllPartitions()101 bool DynamicPartitionControlStub::MapAllPartitions() {
102 return false;
103 }
104
UnmapAllPartitions()105 bool DynamicPartitionControlStub::UnmapAllPartitions() {
106 return false;
107 }
108
IsDynamicPartition(const std::string & part_name,uint32_t slot)109 bool DynamicPartitionControlStub::IsDynamicPartition(
110 const std::string& part_name, uint32_t slot) {
111 return false;
112 }
113
UpdateUsesSnapshotCompression()114 bool DynamicPartitionControlStub::UpdateUsesSnapshotCompression() {
115 return false;
116 }
117
118 } // namespace chromeos_update_engine
119