From daf12d944042180398acd45e9ccc684d5288c0f5 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 7 Dec 2022 00:43:46 +0000 Subject: [PATCH] Update weaver AIDL default to use V2 Test: VtsHalWeaverTargetTest Bug: 259556049 Change-Id: Id6aa9316a20541bf2c9a7cc53345a5010a188d00 --- .../compatibility_matrix.current.xml | 2 +- weaver/aidl/default/Android.bp | 2 +- weaver/aidl/default/Weaver.cpp | 11 ++++++----- .../android.hardware.weaver-service.example.xml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d0e844dd4b..3c7d893c19 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -693,7 +693,7 @@ android.hardware.weaver - 1 + 2 IWeaver default diff --git a/weaver/aidl/default/Android.bp b/weaver/aidl/default/Android.bp index 70d91718de..494cb1bf4a 100644 --- a/weaver/aidl/default/Android.bp +++ b/weaver/aidl/default/Android.bp @@ -34,7 +34,7 @@ cc_binary { "Weaver.cpp", ], shared_libs: [ - "android.hardware.weaver-V1-ndk", + "android.hardware.weaver-V2-ndk", "libbase", "libbinder_ndk", ], diff --git a/weaver/aidl/default/Weaver.cpp b/weaver/aidl/default/Weaver.cpp index 6b77924be7..c9ffe85594 100644 --- a/weaver/aidl/default/Weaver.cpp +++ b/weaver/aidl/default/Weaver.cpp @@ -37,18 +37,19 @@ std::array slot_array; } ::ndk::ScopedAStatus Weaver::read(int32_t in_slotId, const std::vector& 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(); } diff --git a/weaver/aidl/default/android.hardware.weaver-service.example.xml b/weaver/aidl/default/android.hardware.weaver-service.example.xml index ed291cdf60..bfe43966ab 100644 --- a/weaver/aidl/default/android.hardware.weaver-service.example.xml +++ b/weaver/aidl/default/android.hardware.weaver-service.example.xml @@ -1,7 +1,7 @@ android.hardware.weaver - 1 + 2 IWeaver default