Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9edb59c authored by Chengyou Ho's avatar Chengyou Ho Committed by Android (Google) Code Review
Browse files

Merge "Update weaver AIDL default to use V2"

parents aea995af daf12d94
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ cc_binary {
        "Weaver.cpp",
    ],
    shared_libs: [
        "android.hardware.weaver-V1-ndk",
        "android.hardware.weaver-V2-ndk",
        "libbase",
        "libbinder_ndk",
    ],
+6 −5
Original line number Diff line number Diff line
@@ -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();
}
+1 −1
Original line number Diff line number Diff line
<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>