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