| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 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 |  | 
| Yifan Hong | 9096550 | 2020-02-19 15:22:47 -0800 | [diff] [blame] | 19 | #include <memory> | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 20 | #include <string> | 
|  | 21 |  | 
|  | 22 | #include <base/logging.h> | 
| Kelvin Zhang | 3461852 | 2020-09-28 09:21:02 -0400 | [diff] [blame] | 23 | #include <libsnapshot/cow_writer.h> | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 24 |  | 
|  | 25 | #include "update_engine/common/dynamic_partition_control_stub.h" | 
|  | 26 |  | 
|  | 27 | namespace chromeos_update_engine { | 
|  | 28 |  | 
|  | 29 | FeatureFlag DynamicPartitionControlStub::GetDynamicPartitionsFeatureFlag() { | 
|  | 30 | return FeatureFlag(FeatureFlag::Value::NONE); | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | FeatureFlag DynamicPartitionControlStub::GetVirtualAbFeatureFlag() { | 
|  | 34 | return FeatureFlag(FeatureFlag::Value::NONE); | 
|  | 35 | } | 
|  | 36 |  | 
| Kelvin Zhang | da1b314 | 2020-09-24 17:09:02 -0400 | [diff] [blame] | 37 | FeatureFlag DynamicPartitionControlStub::GetVirtualAbCompressionFeatureFlag() { | 
|  | 38 | return FeatureFlag(FeatureFlag::Value::NONE); | 
|  | 39 | } | 
|  | 40 |  | 
| Daniel Zheng | 0c1648c | 2023-04-12 10:57:44 -0700 | [diff] [blame] | 41 | FeatureFlag | 
|  | 42 | DynamicPartitionControlStub::GetVirtualAbCompressionXorFeatureFlag() { | 
| Kelvin Zhang | 1c4b981 | 2022-04-06 17:29:00 -0700 | [diff] [blame] | 43 | return FeatureFlag(FeatureFlag::Value::NONE); | 
|  | 44 | } | 
|  | 45 |  | 
| David Anderson | e35b438 | 2022-03-08 23:18:29 -0800 | [diff] [blame] | 46 | FeatureFlag | 
|  | 47 | DynamicPartitionControlStub::GetVirtualAbUserspaceSnapshotsFeatureFlag() { | 
|  | 48 | return FeatureFlag(FeatureFlag::Value::NONE); | 
|  | 49 | } | 
|  | 50 |  | 
| Yifan Hong | f526156 | 2020-03-10 10:28:10 -0700 | [diff] [blame] | 51 | bool DynamicPartitionControlStub::OptimizeOperation( | 
|  | 52 | const std::string& partition_name, | 
|  | 53 | const InstallOperation& operation, | 
|  | 54 | InstallOperation* optimized) { | 
| Alessio Balsini | 14980e2 | 2019-11-26 11:46:06 +0000 | [diff] [blame] | 55 | return false; | 
|  | 56 | } | 
|  | 57 |  | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 58 | void DynamicPartitionControlStub::Cleanup() {} | 
|  | 59 |  | 
|  | 60 | bool DynamicPartitionControlStub::PreparePartitionsForUpdate( | 
|  | 61 | uint32_t source_slot, | 
|  | 62 | uint32_t target_slot, | 
|  | 63 | const DeltaArchiveManifest& manifest, | 
| Yifan Hong | f033ecb | 2020-01-07 18:13:56 -0800 | [diff] [blame] | 64 | bool update, | 
| Daniel Zheng | eede4c8 | 2023-06-13 11:21:06 -0700 | [diff] [blame] | 65 | uint64_t* required_size, | 
|  | 66 | ErrorCode* error) { | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 67 | return true; | 
|  | 68 | } | 
|  | 69 |  | 
| Yifan Hong | 7b3910a | 2020-03-24 17:47:32 -0700 | [diff] [blame] | 70 | bool DynamicPartitionControlStub::FinishUpdate(bool powerwash_required) { | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 71 | return true; | 
|  | 72 | } | 
|  | 73 |  | 
| Yifan Hong | 9096550 | 2020-02-19 15:22:47 -0800 | [diff] [blame] | 74 | std::unique_ptr<AbstractAction> | 
|  | 75 | DynamicPartitionControlStub::GetCleanupPreviousUpdateAction( | 
|  | 76 | BootControlInterface* boot_control, | 
|  | 77 | PrefsInterface* prefs, | 
|  | 78 | CleanupPreviousUpdateActionDelegateInterface* delegate) { | 
|  | 79 | return std::make_unique<NoOpAction>(); | 
|  | 80 | } | 
|  | 81 |  | 
| Yifan Hong | 6a6d0f1 | 2020-03-11 13:20:52 -0700 | [diff] [blame] | 82 | bool DynamicPartitionControlStub::ResetUpdate(PrefsInterface* prefs) { | 
|  | 83 | return false; | 
|  | 84 | } | 
|  | 85 |  | 
| Tianjie | 99d570d | 2020-06-04 14:57:19 -0700 | [diff] [blame] | 86 | bool DynamicPartitionControlStub::ListDynamicPartitionsForSlot( | 
| Tianjie | 3a55fc2 | 2021-02-13 16:02:22 -0800 | [diff] [blame] | 87 | uint32_t slot, | 
|  | 88 | uint32_t current_slot, | 
|  | 89 | std::vector<std::string>* partitions) { | 
| Tianjie | 99d570d | 2020-06-04 14:57:19 -0700 | [diff] [blame] | 90 | return true; | 
|  | 91 | } | 
|  | 92 |  | 
|  | 93 | bool DynamicPartitionControlStub::GetDeviceDir(std::string* path) { | 
|  | 94 | return true; | 
|  | 95 | } | 
|  | 96 |  | 
| Tianjie | 24f9609 | 2020-06-30 12:26:25 -0700 | [diff] [blame] | 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 |  | 
| David Anderson | a4b7ba6 | 2023-05-10 21:41:37 -0700 | [diff] [blame] | 104 | std::unique_ptr<android::snapshot::ICowWriter> | 
| Kelvin Zhang | 3461852 | 2020-09-28 09:21:02 -0400 | [diff] [blame] | 105 | DynamicPartitionControlStub::OpenCowWriter( | 
|  | 106 | const std::string& /*unsuffixed_partition_name*/, | 
|  | 107 | const std::optional<std::string>& /*source_path*/, | 
| David Anderson | a4b7ba6 | 2023-05-10 21:41:37 -0700 | [diff] [blame] | 108 | std::optional<uint64_t>) { | 
| Kelvin Zhang | 3461852 | 2020-09-28 09:21:02 -0400 | [diff] [blame] | 109 | return nullptr; | 
|  | 110 | } | 
|  | 111 |  | 
| Kelvin Zhang | 9d87d6d | 2020-10-23 17:03:59 -0400 | [diff] [blame] | 112 | bool DynamicPartitionControlStub::MapAllPartitions() { | 
|  | 113 | return false; | 
|  | 114 | } | 
|  | 115 |  | 
|  | 116 | bool DynamicPartitionControlStub::UnmapAllPartitions() { | 
|  | 117 | return false; | 
|  | 118 | } | 
|  | 119 |  | 
| Kelvin Zhang | eb9de16 | 2020-11-16 15:47:28 -0500 | [diff] [blame] | 120 | bool DynamicPartitionControlStub::IsDynamicPartition( | 
| Kelvin Zhang | ebd115e | 2021-03-08 16:10:25 -0500 | [diff] [blame] | 121 | const std::string& part_name, uint32_t slot) { | 
| Kelvin Zhang | eb9de16 | 2020-11-16 15:47:28 -0500 | [diff] [blame] | 122 | return false; | 
|  | 123 | } | 
|  | 124 |  | 
| Yifan Hong | b0cbd39 | 2021-02-04 11:11:45 -0800 | [diff] [blame] | 125 | bool DynamicPartitionControlStub::UpdateUsesSnapshotCompression() { | 
|  | 126 | return false; | 
|  | 127 | } | 
|  | 128 |  | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 129 | }  // namespace chromeos_update_engine |