1 /*
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 
19 namespace aidl {
20 namespace android {
21 namespace hardware {
22 namespace oemlock {
23 
24 // Methods from ::android::hardware::oemlock::IOemLock follow.
25 
getName(std::string * out_name)26 ::ndk::ScopedAStatus OemLock::getName(std::string *out_name) {
27     *out_name = "SomeCoolName";
28     return ::ndk::ScopedAStatus::ok();
29 }
30 
setOemUnlockAllowedByCarrier(bool in_allowed,const std::vector<uint8_t> & in_signature,OemLockSecureStatus * _aidl_return)31 ::ndk::ScopedAStatus OemLock::setOemUnlockAllowedByCarrier(bool in_allowed, const std::vector<uint8_t> &in_signature, OemLockSecureStatus *_aidl_return) {
32     // Default impl doesn't care about a valid vendor signature
33     (void)in_signature;
34 
35     mAllowedByCarrier = in_allowed;
36     *_aidl_return = OemLockSecureStatus::OK;
37     return ::ndk::ScopedAStatus::ok();
38 }
39 
isOemUnlockAllowedByCarrier(bool * out_allowed)40 ::ndk::ScopedAStatus OemLock::isOemUnlockAllowedByCarrier(bool *out_allowed) {
41     *out_allowed = mAllowedByCarrier;
42     return ::ndk::ScopedAStatus::ok();
43 }
44 
setOemUnlockAllowedByDevice(bool in_allowed)45 ::ndk::ScopedAStatus OemLock::setOemUnlockAllowedByDevice(bool in_allowed) {
46     mAllowedByDevice = in_allowed;
47     return ::ndk::ScopedAStatus::ok();
48 }
49 
isOemUnlockAllowedByDevice(bool * out_allowed)50 ::ndk::ScopedAStatus OemLock::isOemUnlockAllowedByDevice(bool *out_allowed) {
51     *out_allowed = mAllowedByDevice;
52     return ::ndk::ScopedAStatus::ok();
53 }
54 
55 } // namespace oemlock
56 } // namespace hardware
57 } // namespace android
58 } // aidl
59