Merge "Update weaver AIDL default to use V2"

This commit is contained in:
Chengyou Ho 2022-12-08 20:43:42 +00:00 committed by Android (Google) Code Review
commit a9edb59c9f
4 changed files with 9 additions and 8 deletions

View file

@ -693,7 +693,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.weaver</name>
<version>1</version>
<version>2</version>
<interface>
<name>IWeaver</name>
<instance>default</instance>

View file

@ -34,7 +34,7 @@ cc_binary {
"Weaver.cpp",
],
shared_libs: [
"android.hardware.weaver-V1-ndk",
"android.hardware.weaver-V2-ndk",
"libbase",
"libbinder_ndk",
],

View file

@ -37,18 +37,19 @@ std::array<struct Slotinfo, 16> slot_array;
}
::ndk::ScopedAStatus Weaver::read(int32_t in_slotId, const std::vector<uint8_t>& in_key, WeaverReadResponse* out_response) {
using ::aidl::android::hardware::weaver::WeaverReadStatus;
if (in_slotId > 15 || in_key.size() > 16) {
*out_response = {0, {}};
return ndk::ScopedAStatus(AStatus_fromServiceSpecificError(Weaver::STATUS_FAILED));
*out_response = {0, {}, WeaverReadStatus::FAILED};
return ndk::ScopedAStatus::ok();
}
if (slot_array[in_slotId].key != in_key) {
*out_response = {0, {}};
return ndk::ScopedAStatus(AStatus_fromServiceSpecificError(Weaver::STATUS_INCORRECT_KEY));
*out_response = {0, {}, WeaverReadStatus::INCORRECT_KEY};
return ndk::ScopedAStatus::ok();
}
*out_response = {0, slot_array[in_slotId].value};
*out_response = {0, slot_array[in_slotId].value, WeaverReadStatus::OK};
return ::ndk::ScopedAStatus::ok();
}

View file

@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.weaver</name>
<version>1</version>
<version>2</version>
<interface>
<name>IWeaver</name>
<instance>default</instance>