Add method to IFoo for testing NULL interfaces.

Bug: 32410513
Test: mma, hidl_test
Change-Id: I791c3a95e670a859e5e494ead987d2a93f5047a5
This commit is contained in:
Martijn Coenen
2016-10-27 11:51:46 +02:00
parent 0d4bc82111
commit b7307d5c8a
5 changed files with 17 additions and 0 deletions

View File

@@ -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");

View File

@@ -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;

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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;
};