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

Commit b7307d5c authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Add method to IFoo for testing NULL interfaces.

Bug: 32410513
Test: mma, hidl_test
Change-Id: I791c3a95e670a859e5e494ead987d2a93f5047a5
parent 0d4bc821
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -142,6 +142,10 @@ Return<void> Bar::closeHandles() {
    return mFoo->closeHandles();
}

Return<void> Bar::echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) {
    return mFoo->echoNullInterface(cb, _hidl_cb);
}

// Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
Return<void> Bar::thisIsNew()  {
    ALOGI("SERVER(Bar) thisIsNew");
+2 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ struct Bar : public IBar {
            const hidl_vec<sp<android::hardware::IBinder> > &in,
            haveAVectorOfGenericInterfaces_cb _hidl_cb) override;

    Return<void> echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) override;

    // Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
    Return<void> thisIsNew()  override;

+3 −0
Original line number Diff line number Diff line
@@ -117,6 +117,9 @@ interface IFoo {

    haveAVectorOfGenericInterfaces(vec<interface> in)
        generates (vec<interface> out);

    echoNullInterface(IFooCallback cb) generates (bool receivedNull, IFooCallback cb);

    createMyHandle() generates (MyHandle h);
    createHandles(uint32_t size) generates (vec<handle> handles);
    closeHandles();
+6 −0
Original line number Diff line number Diff line
@@ -328,6 +328,12 @@ Return<void> Foo::closeHandles() {
    return Void();
}

Return<void> Foo::echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) {
    _hidl_cb(cb == nullptr, cb);

    return Void();
}

IFoo* HIDL_FETCH_IFoo(const char* /* name */) {
    return new Foo();
}
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ struct Foo : public IFoo {
    Return<void> haveAVectorOfGenericInterfaces(
            const hidl_vec<sp<android::hardware::IBinder> > &in,
            haveAVectorOfGenericInterfaces_cb _hidl_cb) override;

    Return<void> echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) override;
private:
    std::vector<::native_handle_t *> mHandles;
};