| David Zeuthen | 6eddf26 | 2015-10-16 15:23:53 -0400 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2015 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 |  | 
| Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 17 | #include "update_engine/common/boot_control_stub.h" | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 18 | #include "update_engine/common/dynamic_partition_control_stub.h" | 
| David Zeuthen | 6eddf26 | 2015-10-16 15:23:53 -0400 | [diff] [blame] | 19 |  | 
|  | 20 | #include <base/logging.h> | 
|  | 21 |  | 
|  | 22 | using std::string; | 
|  | 23 |  | 
|  | 24 | namespace chromeos_update_engine { | 
|  | 25 |  | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 26 | BootControlStub::BootControlStub() | 
|  | 27 | : dynamic_partition_control_(new DynamicPartitionControlStub()) {} | 
|  | 28 |  | 
| David Zeuthen | 6eddf26 | 2015-10-16 15:23:53 -0400 | [diff] [blame] | 29 | unsigned int BootControlStub::GetNumSlots() const { | 
|  | 30 | return 0; | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | BootControlInterface::Slot BootControlStub::GetCurrentSlot() const { | 
|  | 34 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 35 | return 0; | 
|  | 36 | } | 
|  | 37 |  | 
| Tianjie | 51a5a39 | 2020-06-03 14:39:32 -0700 | [diff] [blame] | 38 | bool BootControlStub::GetPartitionDevice(const std::string& partition_name, | 
|  | 39 | BootControlInterface::Slot slot, | 
|  | 40 | bool not_in_payload, | 
|  | 41 | std::string* device, | 
|  | 42 | bool* is_dynamic) const { | 
|  | 43 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 44 | return false; | 
|  | 45 | } | 
|  | 46 |  | 
| Kelvin Zhang | 91d95fa | 2020-11-05 13:52:00 -0500 | [diff] [blame] | 47 | std::optional<PartitionDevice> BootControlStub::GetPartitionDevice( | 
|  | 48 | const std::string& partition_name, | 
|  | 49 | uint32_t slot, | 
|  | 50 | uint32_t current_slot, | 
|  | 51 | bool not_in_payload) const { | 
|  | 52 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 53 | return {}; | 
|  | 54 | } | 
|  | 55 |  | 
| David Zeuthen | 6eddf26 | 2015-10-16 15:23:53 -0400 | [diff] [blame] | 56 | bool BootControlStub::GetPartitionDevice(const string& partition_name, | 
|  | 57 | Slot slot, | 
|  | 58 | string* device) const { | 
|  | 59 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 60 | return false; | 
|  | 61 | } | 
|  | 62 |  | 
|  | 63 | bool BootControlStub::IsSlotBootable(Slot slot) const { | 
|  | 64 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 65 | return false; | 
|  | 66 | } | 
|  | 67 |  | 
|  | 68 | bool BootControlStub::MarkSlotUnbootable(Slot slot) { | 
|  | 69 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 70 | return false; | 
|  | 71 | } | 
|  | 72 |  | 
|  | 73 | bool BootControlStub::SetActiveBootSlot(Slot slot) { | 
|  | 74 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 75 | return false; | 
|  | 76 | } | 
|  | 77 |  | 
|  | 78 | bool BootControlStub::MarkBootSuccessfulAsync( | 
|  | 79 | base::Callback<void(bool)> callback) { | 
|  | 80 | // This is expected to be called on update_engine startup. | 
|  | 81 | return false; | 
|  | 82 | } | 
|  | 83 |  | 
| Yifan Hong | f141594 | 2020-02-24 18:34:49 -0800 | [diff] [blame] | 84 | bool BootControlStub::IsSlotMarkedSuccessful(Slot slot) const { | 
|  | 85 | LOG(ERROR) << __FUNCTION__ << " should never be called."; | 
|  | 86 | return false; | 
|  | 87 | } | 
|  | 88 |  | 
| Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 89 | DynamicPartitionControlInterface* | 
|  | 90 | BootControlStub::GetDynamicPartitionControl() { | 
|  | 91 | return dynamic_partition_control_.get(); | 
|  | 92 | } | 
|  | 93 |  | 
| David Zeuthen | 6eddf26 | 2015-10-16 15:23:53 -0400 | [diff] [blame] | 94 | }  // namespace chromeos_update_engine |