mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
add test for binder inheritance.
Test: hidl_test Test: `make hidl_test_java` compiles Change-Id: Ie9217b79e369f2a1e7a7c9ed02524b17e3fc8b7f
This commit is contained in:
@@ -7,6 +7,8 @@ subdirs = [
|
||||
"foo/1.0",
|
||||
"foo/1.0/default",
|
||||
"foo/1.0/default/lib",
|
||||
"inheritance/1.0",
|
||||
"inheritance/1.0/default",
|
||||
"libhwbinder/1.0",
|
||||
"libhwbinder/1.0/default",
|
||||
"msgq/1.0",
|
||||
|
||||
71
tests/inheritance/1.0/Android.bp
Normal file
71
tests/inheritance/1.0/Android.bp
Normal file
@@ -0,0 +1,71 @@
|
||||
// This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.tests.inheritance@1.0_genc++",
|
||||
tool: "hidl-gen",
|
||||
cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
|
||||
srcs: [
|
||||
"IChild.hal",
|
||||
"IFetcher.hal",
|
||||
"IGrandparent.hal",
|
||||
"IParent.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/tests/inheritance/1.0/ChildAll.cpp",
|
||||
"android/hardware/tests/inheritance/1.0/FetcherAll.cpp",
|
||||
"android/hardware/tests/inheritance/1.0/GrandparentAll.cpp",
|
||||
"android/hardware/tests/inheritance/1.0/ParentAll.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "android.hardware.tests.inheritance@1.0_genc++_headers",
|
||||
tool: "hidl-gen",
|
||||
cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
|
||||
srcs: [
|
||||
"IChild.hal",
|
||||
"IFetcher.hal",
|
||||
"IGrandparent.hal",
|
||||
"IParent.hal",
|
||||
],
|
||||
out: [
|
||||
"android/hardware/tests/inheritance/1.0/IChild.h",
|
||||
"android/hardware/tests/inheritance/1.0/IHwChild.h",
|
||||
"android/hardware/tests/inheritance/1.0/BnChild.h",
|
||||
"android/hardware/tests/inheritance/1.0/BpChild.h",
|
||||
"android/hardware/tests/inheritance/1.0/BsChild.h",
|
||||
"android/hardware/tests/inheritance/1.0/IFetcher.h",
|
||||
"android/hardware/tests/inheritance/1.0/IHwFetcher.h",
|
||||
"android/hardware/tests/inheritance/1.0/BnFetcher.h",
|
||||
"android/hardware/tests/inheritance/1.0/BpFetcher.h",
|
||||
"android/hardware/tests/inheritance/1.0/BsFetcher.h",
|
||||
"android/hardware/tests/inheritance/1.0/IGrandparent.h",
|
||||
"android/hardware/tests/inheritance/1.0/IHwGrandparent.h",
|
||||
"android/hardware/tests/inheritance/1.0/BnGrandparent.h",
|
||||
"android/hardware/tests/inheritance/1.0/BpGrandparent.h",
|
||||
"android/hardware/tests/inheritance/1.0/BsGrandparent.h",
|
||||
"android/hardware/tests/inheritance/1.0/IParent.h",
|
||||
"android/hardware/tests/inheritance/1.0/IHwParent.h",
|
||||
"android/hardware/tests/inheritance/1.0/BnParent.h",
|
||||
"android/hardware/tests/inheritance/1.0/BpParent.h",
|
||||
"android/hardware/tests/inheritance/1.0/BsParent.h",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.tests.inheritance@1.0",
|
||||
generated_sources: ["android.hardware.tests.inheritance@1.0_genc++"],
|
||||
generated_headers: ["android.hardware.tests.inheritance@1.0_genc++_headers"],
|
||||
export_generated_headers: ["android.hardware.tests.inheritance@1.0_genc++_headers"],
|
||||
shared_libs: [
|
||||
"libhidl",
|
||||
"libhwbinder",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
],
|
||||
export_shared_lib_headers: [
|
||||
"libhidl",
|
||||
"libhwbinder",
|
||||
"libutils",
|
||||
],
|
||||
}
|
||||
186
tests/inheritance/1.0/Android.mk
Normal file
186
tests/inheritance/1.0/Android.mk
Normal file
@@ -0,0 +1,186 @@
|
||||
# This file is autogenerated by hidl-gen. Do not edit manually.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
################################################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.tests.inheritance@1.0-java
|
||||
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
||||
|
||||
intermediates := $(local-generated-sources-dir)
|
||||
|
||||
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
|
||||
|
||||
#
|
||||
# Build IChild.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IChild.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IChild.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IChild
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IChild.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IFetcher.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IFetcher.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFetcher.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IChild.hal
|
||||
$(GEN): $(LOCAL_PATH)/IChild.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IFetcher
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IFetcher.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IGrandparent.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IGrandparent.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IGrandparent
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IParent.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IParent.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IParent
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IParent.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := android.hardware.tests.inheritance@1.0-java-static
|
||||
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
||||
|
||||
intermediates := $(local-generated-sources-dir)
|
||||
|
||||
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
|
||||
|
||||
#
|
||||
# Build IChild.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IChild.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IChild.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IChild
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IChild.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IFetcher.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IFetcher.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFetcher.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IChild.hal
|
||||
$(GEN): $(LOCAL_PATH)/IChild.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IFetcher
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IFetcher.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IGrandparent.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IGrandparent.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IGrandparent
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
#
|
||||
# Build IParent.hal
|
||||
#
|
||||
GEN := $(intermediates)/android/hardware/tests/inheritance/1.0/IParent.java
|
||||
$(GEN): $(HIDL)
|
||||
$(GEN): PRIVATE_HIDL := $(HIDL)
|
||||
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IParent.hal
|
||||
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): $(LOCAL_PATH)/IGrandparent.hal
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
|
||||
-Ljava -randroid.hardware:hardware/interfaces \
|
||||
android.hardware.tests.inheritance@1.0::IParent
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/IParent.hal
|
||||
$(transform-generated-source)
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
include $(BUILD_STATIC_JAVA_LIBRARY)
|
||||
|
||||
|
||||
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
22
tests/inheritance/1.0/IChild.hal
Normal file
22
tests/inheritance/1.0/IChild.hal
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tests.inheritance@1.0;
|
||||
import IParent;
|
||||
|
||||
interface IChild extends IParent {
|
||||
doChild();
|
||||
};
|
||||
28
tests/inheritance/1.0/IFetcher.hal
Normal file
28
tests/inheritance/1.0/IFetcher.hal
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tests.inheritance@1.0;
|
||||
|
||||
import IGrandparent;
|
||||
import IParent;
|
||||
import IChild;
|
||||
|
||||
interface IFetcher {
|
||||
|
||||
getGrandparent(bool sendRemote) generates (IGrandparent parent);
|
||||
getParent(bool sendRemote) generates (IParent parent);
|
||||
getChild(bool sendRemote) generates (IChild child);
|
||||
};
|
||||
21
tests/inheritance/1.0/IGrandparent.hal
Normal file
21
tests/inheritance/1.0/IGrandparent.hal
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tests.inheritance@1.0;
|
||||
|
||||
interface IGrandparent {
|
||||
doGrandparent();
|
||||
};
|
||||
23
tests/inheritance/1.0/IParent.hal
Normal file
23
tests/inheritance/1.0/IParent.hal
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tests.inheritance@1.0;
|
||||
|
||||
import IGrandparent;
|
||||
|
||||
interface IParent extends IGrandparent {
|
||||
doParent();
|
||||
};
|
||||
21
tests/inheritance/1.0/default/Android.bp
Normal file
21
tests/inheritance/1.0/default/Android.bp
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.tests.inheritance@1.0-impl",
|
||||
relative_install_path: "hw",
|
||||
srcs: [
|
||||
"Fetcher.cpp",
|
||||
"Parent.cpp",
|
||||
"Child.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libhidl",
|
||||
"libhwbinder",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.tests.inheritance@1.0",
|
||||
],
|
||||
|
||||
}
|
||||
42
tests/inheritance/1.0/default/Child.cpp
Normal file
42
tests/inheritance/1.0/default/Child.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#define LOG_TAG "hidl_test"
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "Child.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
|
||||
Return<void> Child::doGrandparent() {
|
||||
ALOGI("SERVER(Bar) Child::doGrandparent");
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
|
||||
Return<void> Child::doParent() {
|
||||
ALOGI("SERVER(Bar) Child::doParent");
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IChild follow.
|
||||
Return<void> Child::doChild() {
|
||||
ALOGI("SERVER(Bar) Child::doChild");
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
||||
IChild* HIDL_FETCH_IChild(const char* /* name */) {
|
||||
return new Child();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
44
tests/inheritance/1.0/default/Child.h
Normal file
44
tests/inheritance/1.0/default/Child.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
|
||||
#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
|
||||
|
||||
#include <android/hardware/tests/inheritance/1.0/IChild.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::tests::inheritance::V1_0::IParent;
|
||||
using ::android::hardware::tests::inheritance::V1_0::IChild;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
struct Child : public IChild {
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
|
||||
Return<void> doGrandparent() override;
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
|
||||
Return<void> doParent() override;
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IChild follow.
|
||||
Return<void> doChild() override;
|
||||
|
||||
};
|
||||
|
||||
extern "C" IChild* HIDL_FETCH_IChild(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
|
||||
58
tests/inheritance/1.0/default/Fetcher.cpp
Normal file
58
tests/inheritance/1.0/default/Fetcher.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
#define LOG_TAG "hidl_test"
|
||||
|
||||
#include "Fetcher.h"
|
||||
#include <android-base/logging.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
Fetcher::Fetcher() {
|
||||
mPrecious = IChild::getService("local child", true);
|
||||
CHECK(!mPrecious->isRemote());
|
||||
}
|
||||
|
||||
template <typename CB>
|
||||
Return<void> selectService(bool sendRemote, CB &_hidl_cb, sp<IChild> &local) {
|
||||
sp<IChild> toSend;
|
||||
if (sendRemote) {
|
||||
toSend = IChild::getService("child");
|
||||
if (!toSend->isRemote()) {
|
||||
return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
|
||||
}
|
||||
} else {
|
||||
toSend = local;
|
||||
}
|
||||
ALOGI("SERVER(Fetcher) selectService returning %p", toSend.get());
|
||||
_hidl_cb(toSend);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// 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<void> Fetcher::getParent(bool sendRemote, getParent_cb _hidl_cb) {
|
||||
return selectService(sendRemote, _hidl_cb, mPrecious);
|
||||
}
|
||||
|
||||
Return<void> Fetcher::getChild(bool sendRemote, getChild_cb _hidl_cb) {
|
||||
return selectService(sendRemote, _hidl_cb, mPrecious);
|
||||
}
|
||||
|
||||
IFetcher* HIDL_FETCH_IFetcher(const char* /* name */) {
|
||||
return new Fetcher();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
45
tests/inheritance/1.0/default/Fetcher.h
Normal file
45
tests/inheritance/1.0/default/Fetcher.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
|
||||
#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
|
||||
|
||||
#include "Child.h"
|
||||
#include <android/hardware/tests/inheritance/1.0/IFetcher.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::tests::inheritance::V1_0::IFetcher;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
sp<IChild> mPrecious;
|
||||
};
|
||||
|
||||
extern "C" IFetcher* HIDL_FETCH_IFetcher(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
|
||||
29
tests/inheritance/1.0/default/Grandparent.cpp
Normal file
29
tests/inheritance/1.0/default/Grandparent.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#define LOG_TAG "hidl_test"
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "Grandparent.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
|
||||
Return<void> Grandparent::doGrandparent() {
|
||||
ALOGI("SERVER(Bar) Grandparent::doGrandparent");
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
||||
IGrandparent* HIDL_FETCH_IGrandparent(const char* /* name */) {
|
||||
return new Grandparent();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
37
tests/inheritance/1.0/default/Grandparent.h
Normal file
37
tests/inheritance/1.0/default/Grandparent.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
|
||||
#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
|
||||
|
||||
#include <android/hardware/tests/inheritance/1.0/IGrandparent.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::tests::inheritance::V1_0::IGrandparent;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
struct Grandparent : public IGrandparent {
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
|
||||
Return<void> doGrandparent() override;
|
||||
|
||||
};
|
||||
|
||||
extern "C" IGrandparent* HIDL_FETCH_IGrandparent(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
|
||||
35
tests/inheritance/1.0/default/Parent.cpp
Normal file
35
tests/inheritance/1.0/default/Parent.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#define LOG_TAG "hidl_test"
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include "Parent.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
|
||||
Return<void> Parent::doGrandparent() {
|
||||
ALOGI("SERVER(Bar) Parent::doGrandparent");
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
|
||||
Return<void> Parent::doParent() {
|
||||
ALOGI("SERVER(Bar) Parent::doParent");
|
||||
return Void();
|
||||
}
|
||||
|
||||
|
||||
IParent* HIDL_FETCH_IParent(const char* /* name */) {
|
||||
return new Parent();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
40
tests/inheritance/1.0/default/Parent.h
Normal file
40
tests/inheritance/1.0/default/Parent.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
|
||||
#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
|
||||
|
||||
#include <android/hardware/tests/inheritance/1.0/IParent.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tests {
|
||||
namespace inheritance {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::tests::inheritance::V1_0::IParent;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
struct Parent : public IParent {
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IGrandparent follow.
|
||||
Return<void> doGrandparent() override;
|
||||
|
||||
// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
|
||||
Return<void> doParent() override;
|
||||
|
||||
};
|
||||
|
||||
extern "C" IParent* HIDL_FETCH_IParent(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace inheritance
|
||||
} // namespace tests
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
|
||||
Reference in New Issue
Block a user