diff --git a/tests/Android.bp b/tests/Android.bp index 4467994967..7276a0b86c 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -8,6 +8,8 @@ subdirs = [ "foo/1.0", "foo/1.0/default", "foo/1.0/default/lib", + "hash/1.0", + "hash/1.0/default", "inheritance/1.0", "inheritance/1.0/default", "libhwbinder/1.0", diff --git a/tests/hash/1.0/Android.bp b/tests/hash/1.0/Android.bp new file mode 100644 index 0000000000..c217e5c953 --- /dev/null +++ b/tests/hash/1.0/Android.bp @@ -0,0 +1,59 @@ +// This file is autogenerated by hidl-gen. Do not edit manually. + +filegroup { + name: "android.hardware.tests.hash@1.0_hal", + srcs: [ + "IHash.hal", + ], +} + +genrule { + name: "android.hardware.tests.hash@1.0_genc++", + tools: ["hidl-gen"], + cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.hash@1.0", + srcs: [ + ":android.hardware.tests.hash@1.0_hal", + ], + out: [ + "android/hardware/tests/hash/1.0/HashAll.cpp", + ], +} + +genrule { + name: "android.hardware.tests.hash@1.0_genc++_headers", + tools: ["hidl-gen"], + cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.hash@1.0", + srcs: [ + ":android.hardware.tests.hash@1.0_hal", + ], + out: [ + "android/hardware/tests/hash/1.0/IHash.h", + "android/hardware/tests/hash/1.0/IHwHash.h", + "android/hardware/tests/hash/1.0/BnHwHash.h", + "android/hardware/tests/hash/1.0/BpHwHash.h", + "android/hardware/tests/hash/1.0/BsHash.h", + ], +} + +cc_library_shared { + name: "android.hardware.tests.hash@1.0", + generated_sources: ["android.hardware.tests.hash@1.0_genc++"], + generated_headers: ["android.hardware.tests.hash@1.0_genc++_headers"], + export_generated_headers: ["android.hardware.tests.hash@1.0_genc++_headers"], + shared_libs: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "liblog", + "libutils", + "libcutils", + "android.hidl.base@1.0", + ], + export_shared_lib_headers: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "libutils", + "android.hidl.base@1.0", + ], +} diff --git a/tests/hash/1.0/Android.mk b/tests/hash/1.0/Android.mk new file mode 100644 index 0000000000..15428b427d --- /dev/null +++ b/tests/hash/1.0/Android.mk @@ -0,0 +1,76 @@ +# This file is autogenerated by hidl-gen. Do not edit manually. + +LOCAL_PATH := $(call my-dir) + +################################################################################ + +include $(CLEAR_VARS) +LOCAL_MODULE := android.hardware.tests.hash@1.0-java +LOCAL_MODULE_CLASS := JAVA_LIBRARIES + +intermediates := $(call local-generated-sources-dir, COMMON) + +HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) + +LOCAL_JAVA_LIBRARIES := \ + android.hidl.base@1.0-java \ + + +# +# Build IHash.hal +# +GEN := $(intermediates)/android/hardware/tests/hash/V1_0/IHash.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHash.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.tests.hash@1.0::IHash + +$(GEN): $(LOCAL_PATH)/IHash.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) +include $(BUILD_JAVA_LIBRARY) + + +################################################################################ + +include $(CLEAR_VARS) +LOCAL_MODULE := android.hardware.tests.hash@1.0-java-static +LOCAL_MODULE_CLASS := JAVA_LIBRARIES + +intermediates := $(call local-generated-sources-dir, COMMON) + +HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) + +LOCAL_STATIC_JAVA_LIBRARIES := \ + android.hidl.base@1.0-java-static \ + + +# +# Build IHash.hal +# +GEN := $(intermediates)/android/hardware/tests/hash/V1_0/IHash.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHash.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.tests.hash@1.0::IHash + +$(GEN): $(LOCAL_PATH)/IHash.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) +include $(BUILD_STATIC_JAVA_LIBRARY) + + + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tests/hash/1.0/IHash.hal b/tests/hash/1.0/IHash.hal new file mode 100644 index 0000000000..ba48384f6c --- /dev/null +++ b/tests/hash/1.0/IHash.hal @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 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.hash@1.0; + +/** + * Test interface for hashing HAL files. + * This file is FREEZED to ensure its hash doesn't change. + */ +interface IHash { + /** + * Dummy. + */ + dummy(); + /** + * Dummy. + */ + functions(); +}; diff --git a/tests/hash/1.0/default/Android.bp b/tests/hash/1.0/default/Android.bp new file mode 100644 index 0000000000..e798a664c3 --- /dev/null +++ b/tests/hash/1.0/default/Android.bp @@ -0,0 +1,15 @@ +cc_library_shared { + name: "android.hardware.tests.hash@1.0-impl", + relative_install_path: "hw", + proprietary: true, + srcs: [ + "Hash.cpp", + ], + shared_libs: [ + "libhidlbase", + "libhidltransport", + "libutils", + "android.hardware.tests.hash@1.0", + "android.hidl.base@1.0", + ], +} diff --git a/tests/hash/1.0/default/Hash.cpp b/tests/hash/1.0/default/Hash.cpp new file mode 100644 index 0000000000..caed721655 --- /dev/null +++ b/tests/hash/1.0/default/Hash.cpp @@ -0,0 +1,30 @@ +#include "Hash.h" + +namespace android { +namespace hardware { +namespace tests { +namespace hash { +namespace V1_0 { +namespace implementation { + +// Methods from ::android::hardware::tests::hash::V1_0::IHash follow. +Return Hash::dummy() { + return Void(); +} + +Return Hash::functions() { + return Void(); +} + +// Methods from ::android::hidl::base::V1_0::IBase follow. + +IHash* HIDL_FETCH_IHash(const char* /* name */) { + return new Hash(); +} + +} // namespace implementation +} // namespace V1_0 +} // namespace hash +} // namespace tests +} // namespace hardware +} // namespace android diff --git a/tests/hash/1.0/default/Hash.h b/tests/hash/1.0/default/Hash.h new file mode 100644 index 0000000000..dd1678f762 --- /dev/null +++ b/tests/hash/1.0/default/Hash.h @@ -0,0 +1,43 @@ +#ifndef ANDROID_HARDWARE_TESTS_HASH_V1_0_HASH_H +#define ANDROID_HARDWARE_TESTS_HASH_V1_0_HASH_H + +#include +#include +#include + +namespace android { +namespace hardware { +namespace tests { +namespace hash { +namespace V1_0 { +namespace implementation { + +using ::android::hardware::tests::hash::V1_0::IHash; +using ::android::hidl::base::V1_0::DebugInfo; +using ::android::hidl::base::V1_0::IBase; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct Hash : public IHash { + // Methods from ::android::hardware::tests::hash::V1_0::IHash follow. + Return dummy() override; + Return functions() override; + + // Methods from ::android::hidl::base::V1_0::IBase follow. +}; + +extern "C" IHash* HIDL_FETCH_IHash(const char* name); + +} // namespace implementation +} // namespace V1_0 +} // namespace hash +} // namespace tests +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TESTS_HASH_V1_0_HASH_H