1 /* 2 * Copyright 2023 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 18 #pragma once 19 20 #include <fruit/fruit.h> 21 22 #include "host/commands/secure_env/oemlock.h" 23 24 namespace cuttlefish { 25 namespace oemlock { 26 27 class SoftOemLock : public OemLock { 28 public: INJECT(SoftOemLock ())29 INJECT(SoftOemLock()) : is_allowed_by_carrier_(true), is_allowed_by_device_(false) {} 30 IsOemUnlockAllowedByCarrier()31 bool IsOemUnlockAllowedByCarrier() const override { 32 return is_allowed_by_carrier_; 33 } 34 IsOemUnlockAllowedByDevice()35 bool IsOemUnlockAllowedByDevice() const override { 36 return is_allowed_by_device_; 37 } 38 SetOemUnlockAllowedByCarrier(bool allowed)39 void SetOemUnlockAllowedByCarrier(bool allowed) override { 40 is_allowed_by_carrier_ = allowed; 41 } 42 SetOemUnlockAllowedByDevice(bool allowed)43 void SetOemUnlockAllowedByDevice(bool allowed) override { 44 is_allowed_by_device_ = allowed; 45 } 46 47 private: 48 bool is_allowed_by_carrier_; 49 bool is_allowed_by_device_; 50 }; 51 52 } // namespace oemlock 53 } // namespace cuttlefish