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
41 FeatureFlag
GetVirtualAbCompressionXorFeatureFlag()42 DynamicPartitionControlStub::GetVirtualAbCompressionXorFeatureFlag() {
43 return FeatureFlag(FeatureFlag::Value::NONE);
44 }
45
46 FeatureFlag
GetVirtualAbUserspaceSnapshotsFeatureFlag()47 DynamicPartitionControlStub::GetVirtualAbUserspaceSnapshotsFeatureFlag() {
48 return FeatureFlag(FeatureFlag::Value::NONE);
49 }
50
OptimizeOperation(const std::string & partition_name,const InstallOperation & operation,InstallOperation * optimized)51 bool DynamicPartitionControlStub::OptimizeOperation(
52 const std::string& partition_name,
53 const InstallOperation& operation,
54 InstallOperation* optimized) {
55 return false;
56 }
57
Cleanup()58 void DynamicPartitionControlStub::Cleanup() {}
59
PreparePartitionsForUpdate(uint32_t source_slot,uint32_t target_slot,const DeltaArchiveManifest & manifest,bool update,uint64_t * required_size,ErrorCode * error)60 bool DynamicPartitionControlStub::PreparePartitionsForUpdate(
61 uint32_t source_slot,
62 uint32_t target_slot,
63 const DeltaArchiveManifest& manifest,
64 bool update,
65 uint64_t* required_size,
66 ErrorCode* error) {
67 return true;
68 }
69
FinishUpdate(bool powerwash_required)70 bool DynamicPartitionControlStub::FinishUpdate(bool powerwash_required) {
71 return true;
72 }
73
74 std::unique_ptr<AbstractAction>
GetCleanupPreviousUpdateAction(BootControlInterface * boot_control,PrefsInterface * prefs,CleanupPreviousUpdateActionDelegateInterface * delegate)75 DynamicPartitionControlStub::GetCleanupPreviousUpdateAction(
76 BootControlInterface* boot_control,
77 PrefsInterface* prefs,
78 CleanupPreviousUpdateActionDelegateInterface* delegate) {
79 return std::make_unique<NoOpAction>();
80 }
81
ResetUpdate(PrefsInterface * prefs)82 bool DynamicPartitionControlStub::ResetUpdate(PrefsInterface* prefs) {
83 return false;
84 }
85
ListDynamicPartitionsForSlot(uint32_t slot,uint32_t current_slot,std::vector<std::string> * partitions)86 bool DynamicPartitionControlStub::ListDynamicPartitionsForSlot(
87 uint32_t slot,
88 uint32_t current_slot,
89 std::vector<std::string>* partitions) {
90 return true;
91 }
92
GetDeviceDir(std::string * path)93 bool DynamicPartitionControlStub::GetDeviceDir(std::string* path) {
94 return true;
95 }
96
VerifyExtentsForUntouchedPartitions(uint32_t source_slot,uint32_t target_slot,const std::vector<std::string> & partitions)97 bool DynamicPartitionControlStub::VerifyExtentsForUntouchedPartitions(
98 uint32_t source_slot,
99 uint32_t target_slot,
100 const std::vector<std::string>& partitions) {
101 return true;
102 }
103
104 std::unique_ptr<android::snapshot::ICowWriter>
OpenCowWriter(const std::string &,const std::optional<std::string> &,std::optional<uint64_t>)105 DynamicPartitionControlStub::OpenCowWriter(
106 const std::string& /*unsuffixed_partition_name*/,
107 const std::optional<std::string>& /*source_path*/,
108 std::optional<uint64_t>) {
109 return nullptr;
110 }
111
MapAllPartitions()112 bool DynamicPartitionControlStub::MapAllPartitions() {
113 return false;
114 }
115
UnmapAllPartitions()116 bool DynamicPartitionControlStub::UnmapAllPartitions() {
117 return false;
118 }
119
IsDynamicPartition(const std::string & part_name,uint32_t slot)120 bool DynamicPartitionControlStub::IsDynamicPartition(
121 const std::string& part_name, uint32_t slot) {
122 return false;
123 }
124
UpdateUsesSnapshotCompression()125 bool DynamicPartitionControlStub::UpdateUsesSnapshotCompression() {
126 return false;
127 }
128
129 } // namespace chromeos_update_engine
130