Added mock interfaces

Change-Id: I227bb450e714e392a3959c0d314842b9879f8b99
This commit is contained in:
Steven Moreland 2016-08-11 12:52:43 -07:00
parent 7fd352e7b3
commit 61651882cd
6 changed files with 175 additions and 0 deletions

34
tests/bar/1.0/Android.mk Normal file
View file

@ -0,0 +1,34 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.tests.bar@1.0
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
intermediates := $(local-generated-sources-dir)
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
# Build IBar.hal
#
GEN := $(intermediates)/android/hardware/tests/bar/1.0/BarAll.cpp
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBar.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Lc++ -randroid.hardware:hardware/interfaces\
android.hardware.tests.bar@1.0::$(patsubst %.hal,%,$(notdir $(PRIVATE_DEPS)))
$(GEN): $(LOCAL_PATH)/IBar.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
LOCAL_SHARED_LIBRARIES := \
libhwbinder \
libutils \
android.hardware.tests.foo@1.0 \
include $(BUILD_SHARED_LIBRARY)

10
tests/bar/1.0/IBar.hal Normal file
View file

@ -0,0 +1,10 @@
package android.hardware.tests.bar@1.0;
import android.hardware.tests.foo@1.0::IFoo;
interface IBar extends android.hardware.tests.foo@1.0::IFoo {
typedef android.hardware.tests.foo@1.0::IFoo FunkyAlias;
thisIsNew();
};

67
tests/foo/1.0/Android.mk Normal file
View file

@ -0,0 +1,67 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.tests.foo@1.0
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
intermediates := $(local-generated-sources-dir)
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
# Build IFooCallback.hal
#
GEN := $(intermediates)/android/hardware/tests/foo/1.0/FooCallbackAll.cpp
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFooCallback.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Lc++ -randroid.hardware:hardware/interfaces\
android.hardware.tests.foo@1.0::$(patsubst %.hal,%,$(notdir $(PRIVATE_DEPS)))
$(GEN): $(LOCAL_PATH)/IFooCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
# Build types.hal
#
GEN := $(intermediates)/android/hardware/tests/foo/1.0/types.cpp
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Lc++ -randroid.hardware:hardware/interfaces\
android.hardware.tests.foo@1.0::$(patsubst %.hal,%,$(notdir $(PRIVATE_DEPS)))
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
# Build IFoo.hal
#
GEN := $(intermediates)/android/hardware/tests/foo/1.0/FooAll.cpp
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IFoo.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Lc++ -randroid.hardware:hardware/interfaces\
android.hardware.tests.foo@1.0::$(patsubst %.hal,%,$(notdir $(PRIVATE_DEPS)))
$(GEN): $(LOCAL_PATH)/IFoo.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
LOCAL_SHARED_LIBRARIES := \
libhwbinder \
libutils \
include $(BUILD_SHARED_LIBRARY)

52
tests/foo/1.0/IFoo.hal Normal file
View file

@ -0,0 +1,52 @@
package android.hardware.tests.foo@1.0;
import IFooCallback;
import types;
interface IFoo {
enum SomeBaseEnum : uint8_t {
bar = 66
};
enum SomeEnum : SomeBaseEnum {
quux = 33,
goober = 192,
blah = goober
};
struct Fumble {
float x;
};
typedef Fumble Gumble;
struct Goober {
int32_t q;
string name;
string address;
double[10] numbers;
Fumble fumble;
Gumble gumble;
// vec<double> lotsOfFumbles;
// handle loveHandle;
};
doThis(float param);
doThatAndReturnSomething(int64_t param) generates (int32_t result);
doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
doSomethingElse(int32_t[15] param) generates (int32_t[32] something);
doStuffAndReturnAString() generates (string something);
mapThisVector(vec<int32_t> param) generates (vec<int32_t> something);
callMe(IFooCallback cb);
useAnEnum(SomeEnum zzz) generates (SomeEnum sleepy);
haveAGooberVec(vec<Goober> param);
haveAGoober(Goober g);
haveAGooberArray(Goober[20] lots);
haveATypeFromAnotherFile(Abc def);
haveSomeStrings(string[3] array) generates (string[2] result);
haveAStringVec(vec<string> vector) generates (vec<string> result);
};

View file

@ -0,0 +1,5 @@
package android.hardware.tests.foo@1.0;
interface IFooCallback {
heyItsMe(IFooCallback cb);
};

7
tests/foo/1.0/types.hal Normal file
View file

@ -0,0 +1,7 @@
package android.hardware.tests.foo@1.0;
struct Abc {
string x;
float y;
handle z;
};