Implement oemlock AIDL default

Test: atest OemLockAidlTest
Bug: 233850220
Change-Id: Icec67b5c46e35468ad98b94017ac373b5583c1af
This commit is contained in:
Devin Moore
2022-11-15 17:34:44 +00:00
parent 14762528b0
commit 204599a398
2 changed files with 12 additions and 6 deletions

View File

@@ -24,29 +24,31 @@ namespace oemlock {
// Methods from ::android::hardware::oemlock::IOemLock follow.
::ndk::ScopedAStatus OemLock::getName(std::string *out_name) {
(void)out_name;
*out_name = "SomeCoolName";
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus OemLock::setOemUnlockAllowedByCarrier(bool in_allowed, const std::vector<uint8_t> &in_signature, OemLockSecureStatus *_aidl_return) {
(void)in_allowed;
// Default impl doesn't care about a valid vendor signature
(void)in_signature;
(void)_aidl_return;
mAllowedByCarrier = in_allowed;
*_aidl_return = OemLockSecureStatus::OK;
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus OemLock::isOemUnlockAllowedByCarrier(bool *out_allowed) {
(void)out_allowed;
*out_allowed = mAllowedByCarrier;
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus OemLock::setOemUnlockAllowedByDevice(bool in_allowed) {
(void)in_allowed;
mAllowedByDevice = in_allowed;
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus OemLock::isOemUnlockAllowedByDevice(bool *out_allowed) {
(void)out_allowed;
*out_allowed = mAllowedByDevice;
return ::ndk::ScopedAStatus::ok();
}

View File

@@ -36,6 +36,10 @@ public:
::ndk::ScopedAStatus isOemUnlockAllowedByDevice(bool* out_allowed) override;
::ndk::ScopedAStatus setOemUnlockAllowedByCarrier(bool in_allowed, const std::vector<uint8_t>& in_signature, OemLockSecureStatus* _aidl_return) override;
::ndk::ScopedAStatus setOemUnlockAllowedByDevice(bool in_allowed) override;
private:
bool mAllowedByCarrier = false;
bool mAllowedByDevice = false;
};
} // namespace oemlock