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

Commit c72b6cf7 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Fix tests for using IBase instead of IBinder. am: 1d747311

am: 77d0a60f

Change-Id: I8c5b72e5dd9059554e9fe766115b1aee929e9d22
parents 9b928c64 77d0a60f
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -122,10 +122,36 @@ Return<void> Bar::haveAVectorOfInterfaces(
    return Void();
}

// TODO: remove after b/33173166 is fixed.
struct Simple : public ISimple {
    Simple(int32_t cookie)
        : mCookie(cookie) {
    }

    Return<int32_t> getCookie() override {
        return mCookie;
    }

private:
    int32_t mCookie;
};

// TODO: use _hidl_cb(in) after b/33173166 is fixed.
Return<void> Bar::haveAVectorOfGenericInterfaces(
        const hidl_vec<sp<android::hidl::base::V1_0::IBase> > &in,
        haveAVectorOfGenericInterfaces_cb _hidl_cb) {
    _hidl_cb(in);
    // _hidl_cb(in);
    hidl_vec<sp<android::hidl::base::V1_0::IBase> > out;
    out.resize(in.size());
    for (size_t i = 0; i < in.size(); ++i) {
        sp<ISimple> s = ISimple::castFrom(in[i]);
        if (s.get() == nullptr) {
            out[i] = new Simple(-1);
        } else {
            out[i] = new Simple(s->getCookie());
        }
    }
    _hidl_cb(out);

    return Void();
}