mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Callback elision for HIDL interfaces.
am: e8b0161713
Change-Id: I8620dc8913c3a184657a22fa0bb931e20d31a99f
This commit is contained in:
@@ -165,10 +165,8 @@ Return<void> Bar::takeAMask(BitField bf, uint8_t first, const MyMask& second, ui
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Bar::haveAInterface(const sp<ISimple> &in,
|
||||
haveAInterface_cb _hidl_cb) {
|
||||
_hidl_cb(in);
|
||||
return Void();
|
||||
Return<sp<ISimple>> Bar::haveAInterface(const sp<ISimple> &in) {
|
||||
return in;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,8 +71,7 @@ struct Bar : public IBar {
|
||||
|
||||
Return<void> takeAMask(BitField bf, uint8_t first, const MyMask& second, uint8_t third,
|
||||
takeAMask_cb _hidl_cb) override;
|
||||
Return<void> haveAInterface(const sp<ISimple> &in,
|
||||
haveAInterface_cb _hidl_cb) override;
|
||||
Return<sp<ISimple>> haveAInterface(const sp<ISimple> &in);
|
||||
|
||||
private:
|
||||
sp<IFoo> mFoo;
|
||||
|
||||
@@ -17,8 +17,7 @@ Fetcher::Fetcher() {
|
||||
CHECK(!mPrecious->isRemote());
|
||||
}
|
||||
|
||||
template <typename CB>
|
||||
Return<void> selectService(bool sendRemote, CB &_hidl_cb, sp<IChild> &local) {
|
||||
sp<IChild> selectService(bool sendRemote, sp<IChild> &local) {
|
||||
sp<IChild> toSend;
|
||||
if (sendRemote) {
|
||||
toSend = IChild::getService("child");
|
||||
@@ -29,21 +28,20 @@ Return<void> selectService(bool sendRemote, CB &_hidl_cb, sp<IChild> &local) {
|
||||
toSend = local;
|
||||
}
|
||||
LOG(INFO) << "SERVER(Fetcher) selectService returning " << toSend.get();
|
||||
_hidl_cb(toSend);
|
||||
return Void();
|
||||
return toSend;
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IFetcher follow.
|
||||
Return<void> Fetcher::getGrandparent(bool sendRemote, getGrandparent_cb _hidl_cb) {
|
||||
return selectService(sendRemote, _hidl_cb, mPrecious);
|
||||
Return<sp<IGrandparent>> Fetcher::getGrandparent(bool sendRemote) {
|
||||
return selectService(sendRemote, mPrecious);
|
||||
}
|
||||
|
||||
Return<void> Fetcher::getParent(bool sendRemote, getParent_cb _hidl_cb) {
|
||||
return selectService(sendRemote, _hidl_cb, mPrecious);
|
||||
Return<sp<IParent>> Fetcher::getParent(bool sendRemote) {
|
||||
return selectService(sendRemote, mPrecious);
|
||||
}
|
||||
|
||||
Return<void> Fetcher::getChild(bool sendRemote, getChild_cb _hidl_cb) {
|
||||
return selectService(sendRemote, _hidl_cb, mPrecious);
|
||||
Return<sp<IChild>> Fetcher::getChild(bool sendRemote) {
|
||||
return selectService(sendRemote, mPrecious);
|
||||
}
|
||||
|
||||
IFetcher* HIDL_FETCH_IFetcher(const char* /* name */) {
|
||||
|
||||
@@ -25,9 +25,9 @@ struct Fetcher : public IFetcher {
|
||||
Fetcher();
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IFetcher follow.
|
||||
Return<void> getGrandparent(bool sendRemote, getGrandparent_cb _hidl_cb) override;
|
||||
Return<void> getParent(bool sendRemote, getParent_cb _hidl_cb) override;
|
||||
Return<void> getChild(bool sendRemote, getChild_cb _hidl_cb) override;
|
||||
Return<sp<IGrandparent>> getGrandparent(bool sendRemote) override;
|
||||
Return<sp<IParent>> getParent(bool sendRemote) override;
|
||||
Return<sp<IChild>> getChild(bool sendRemote) override;
|
||||
|
||||
private:
|
||||
sp<IChild> mPrecious;
|
||||
|
||||
Reference in New Issue
Block a user