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

Commit 688bb1e2 authored by Yifan Hong's avatar Yifan Hong
Browse files

Add test for null native_handle_t*.

Test: hidl_test

Bug: 30814137
Change-Id: Ic52a4c588e2fde3859a0ae8c098e5cb60a87efe8
parent b7307d5c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.tests.bar@1.0;

import android.hardware.tests.foo@1.0::IFoo;
import android.hardware.tests.foo@1.0::Abc;
import android.hardware.tests.foo@1.0::Unrelated;

interface IBar extends android.hardware.tests.foo@1.0::IFoo {
@@ -29,4 +30,5 @@ interface IBar extends android.hardware.tests.foo@1.0::IFoo {
    };

    thisIsNew();
    expectNullHandle(handle h, Abc xyz) generates (bool hIsNull, bool xyzHasNull);
};
+6 −0
Original line number Diff line number Diff line
@@ -153,6 +153,12 @@ Return<void> Bar::thisIsNew() {
    return Void();
}

Return<void> Bar::expectNullHandle(const native_handle_t* h, const Abc& xyz, expectNullHandle_cb _hidl_cb) {
    ALOGI("SERVER(Bar) h = %p, xyz.z = %p", h, xyz.z);
    _hidl_cb(h == nullptr, xyz.z == nullptr);
    return Void();
}

IBar* HIDL_FETCH_IBar(const char* /* name */) {
    return new Bar();
}
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ struct Bar : public IBar {

    // Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
    Return<void> thisIsNew()  override;
    Return<void> expectNullHandle(const native_handle_t* h, const Abc& xyz, expectNullHandle_cb _hidl_cb)  override;

private:
    sp<IFoo> mFoo;