blob: 234a8a9a7bc5f41ff7148cfb4781e69d1847d724 [file] [log] [blame]
ChengYou Ho109522c2020-12-01 09:46:41 +08001/*
2 * Copyright (C) 2020 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 "OemLock.h"
18
19namespace aidl {
20namespace android {
21namespace hardware {
22namespace oemlock {
23
24// Methods from ::android::hardware::oemlock::IOemLock follow.
25
26::ndk::ScopedAStatus OemLock::getName(std::string *out_name) {
Devin Moore204599a2022-11-15 17:34:44 +000027 *out_name = "SomeCoolName";
ChengYou Ho109522c2020-12-01 09:46:41 +080028 return ::ndk::ScopedAStatus::ok();
29}
30
31::ndk::ScopedAStatus OemLock::setOemUnlockAllowedByCarrier(bool in_allowed, const std::vector<uint8_t> &in_signature, OemLockSecureStatus *_aidl_return) {
Devin Moore204599a2022-11-15 17:34:44 +000032 // Default impl doesn't care about a valid vendor signature
ChengYou Ho109522c2020-12-01 09:46:41 +080033 (void)in_signature;
Devin Moore204599a2022-11-15 17:34:44 +000034
35 mAllowedByCarrier = in_allowed;
36 *_aidl_return = OemLockSecureStatus::OK;
ChengYou Ho109522c2020-12-01 09:46:41 +080037 return ::ndk::ScopedAStatus::ok();
38}
39
40::ndk::ScopedAStatus OemLock::isOemUnlockAllowedByCarrier(bool *out_allowed) {
Devin Moore204599a2022-11-15 17:34:44 +000041 *out_allowed = mAllowedByCarrier;
ChengYou Ho109522c2020-12-01 09:46:41 +080042 return ::ndk::ScopedAStatus::ok();
43}
44
45::ndk::ScopedAStatus OemLock::setOemUnlockAllowedByDevice(bool in_allowed) {
Devin Moore204599a2022-11-15 17:34:44 +000046 mAllowedByDevice = in_allowed;
ChengYou Ho109522c2020-12-01 09:46:41 +080047 return ::ndk::ScopedAStatus::ok();
48}
49
50::ndk::ScopedAStatus OemLock::isOemUnlockAllowedByDevice(bool *out_allowed) {
Devin Moore204599a2022-11-15 17:34:44 +000051 *out_allowed = mAllowedByDevice;
ChengYou Ho109522c2020-12-01 09:46:41 +080052 return ::ndk::ScopedAStatus::ok();
53}
54
55} // namespace oemlock
56} // namespace hardware
57} // namespace android
58} // aidl