summaryrefslogtreecommitdiff
path: root/transport/manager
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2016-11-16 12:35:58 -0800
committerYifan Hong <elsk@google.com>2016-11-18 09:51:13 -0800
commit00f4a391c6f9a698bbcbbd05bf3d80e213c82884 (patch)
treeb0ac48e72ab0233a0e3eb8588abbb8f645a6a019 /transport/manager
parent4ca39a01032d2ac2658335bb5e0d5196779d767b (diff)
downloadlibhidl-00f4a391c6f9a698bbcbbd05bf3d80e213c82884.tar.gz
Split libhidl into base and transport.
libhidlbase contains "pure" classes that has nothing to do with tranport level stuff. libhwbinder can now safely depend on libhidlbase. IBinder inheriting from IBase will be in a follow up CL. Bug: 32756130 Test: mma under hardware/interfaces Test: hidl_test Change-Id: Ie2bd80769df3816aab83789ba0d7fca9b5a2e52f
Diffstat (limited to 'transport/manager')
-rw-r--r--transport/manager/1.0/Android.bp57
-rw-r--r--transport/manager/1.0/Android.mk102
-rw-r--r--transport/manager/1.0/IServiceManager.hal110
-rw-r--r--transport/manager/1.0/IServiceNotification.hal34
-rwxr-xr-xtransport/manager/1.0/update-makefiles.sh9
5 files changed, 312 insertions, 0 deletions
diff --git a/transport/manager/1.0/Android.bp b/transport/manager/1.0/Android.bp
new file mode 100644
index 0000000..9cea8aa
--- /dev/null
+++ b/transport/manager/1.0/Android.bp
@@ -0,0 +1,57 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hidl.manager@1.0_genc++",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl/transport android.hidl.manager@1.0",
+ srcs: [
+ "IServiceManager.hal",
+ "IServiceNotification.hal",
+ ],
+ out: [
+ "android/hidl/manager/1.0/ServiceManagerAll.cpp",
+ "android/hidl/manager/1.0/ServiceNotificationAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hidl.manager@1.0_genc++_headers",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl/transport android.hidl.manager@1.0",
+ srcs: [
+ "IServiceManager.hal",
+ "IServiceNotification.hal",
+ ],
+ out: [
+ "android/hidl/manager/1.0/IServiceManager.h",
+ "android/hidl/manager/1.0/IHwServiceManager.h",
+ "android/hidl/manager/1.0/BnServiceManager.h",
+ "android/hidl/manager/1.0/BpServiceManager.h",
+ "android/hidl/manager/1.0/BsServiceManager.h",
+ "android/hidl/manager/1.0/IServiceNotification.h",
+ "android/hidl/manager/1.0/IHwServiceNotification.h",
+ "android/hidl/manager/1.0/BnServiceNotification.h",
+ "android/hidl/manager/1.0/BpServiceNotification.h",
+ "android/hidl/manager/1.0/BsServiceNotification.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hidl.manager@1.0",
+ generated_sources: ["android.hidl.manager@1.0_genc++"],
+ generated_headers: ["android.hidl.manager@1.0_genc++_headers"],
+ export_generated_headers: ["android.hidl.manager@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/transport/manager/1.0/Android.mk b/transport/manager/1.0/Android.mk
new file mode 100644
index 0000000..9721993
--- /dev/null
+++ b/transport/manager/1.0/Android.mk
@@ -0,0 +1,102 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hidl.manager@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build IServiceManager.hal
+#
+GEN := $(intermediates)/android/hidl/manager/1.0/IServiceManager.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IServiceManager.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IServiceNotification.hal
+$(GEN): $(LOCAL_PATH)/IServiceNotification.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hidl:system/libhidl/transport \
+ android.hidl.manager@1.0::IServiceManager
+
+$(GEN): $(LOCAL_PATH)/IServiceManager.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IServiceNotification.hal
+#
+GEN := $(intermediates)/android/hidl/manager/1.0/IServiceNotification.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IServiceNotification.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hidl:system/libhidl/transport \
+ android.hidl.manager@1.0::IServiceNotification
+
+$(GEN): $(LOCAL_PATH)/IServiceNotification.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hidl.manager@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build IServiceManager.hal
+#
+GEN := $(intermediates)/android/hidl/manager/1.0/IServiceManager.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IServiceManager.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IServiceNotification.hal
+$(GEN): $(LOCAL_PATH)/IServiceNotification.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hidl:system/libhidl/transport \
+ android.hidl.manager@1.0::IServiceManager
+
+$(GEN): $(LOCAL_PATH)/IServiceManager.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IServiceNotification.hal
+#
+GEN := $(intermediates)/android/hidl/manager/1.0/IServiceNotification.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IServiceNotification.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hidl:system/libhidl/transport \
+ android.hidl.manager@1.0::IServiceNotification
+
+$(GEN): $(LOCAL_PATH)/IServiceNotification.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/transport/manager/1.0/IServiceManager.hal b/transport/manager/1.0/IServiceManager.hal
new file mode 100644
index 0000000..0fcf7dc
--- /dev/null
+++ b/transport/manager/1.0/IServiceManager.hal
@@ -0,0 +1,110 @@
+/*
+ * 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.hidl.manager@1.0;
+
+import IServiceNotification;
+
+/**
+ * Manages all the hidl hals on a device.
+ *
+ * All examples in this file assume that there is one service registered with
+ * the service manager, "android.hidl.manager@1.0::IServiceManager/manager"
+ *
+ * Terminology:
+ * Package: "android.hidl.manager"
+ * Major version: "1"
+ * Minor version: "0"
+ * Version: "1.0"
+ * Interface name: "IServiceManager"
+ * Fully-qualified interface name: "android.hidl.manager@1.0::IServiceManager"
+ * Instance name: "manager"
+ * Fully-qualified instance name: "android.hidl.manager@1.0::IServiceManager/manager"
+ */
+interface IServiceManager {
+
+ /**
+ * Retrieve an existing service that supports the requested version.
+ *
+ * WARNING: This function is for libhidl/HwBinder use only. You are likely
+ * looking for 'IMyInterface::getService("name")' instead.
+ *
+ * @param iface Fully-qualified interface name.
+ * @param name Instance name. Same as in IServiceManager::add.
+ *
+ * @return service Handle to requested service, same as provided in
+ * IServiceManager::add. Will be nullptr if not available.
+ */
+ get(string fqName, string name) generates (interface service);
+
+ /**
+ * Register a service. The service manager must be registered as all of the
+ * services that it inherits from.
+ *
+ * WARNING: This function is for libhidl/HwBinder use only. You are likely
+ * looking for 'INTERFACE::registerAsService("name")' instead.
+ *
+ * @param interfaceChain List of fully-qualified interface names. The first
+ * must be the actual interface name. Subsequent names must
+ * follow the inheritance hierarchy of the interface.
+ * @param name Instance name. Must also be used to retrieve service.
+ * @param service Handle to registering service.
+ *
+ * @return success Whether or not the service was registered.
+ *
+ */
+ add(vec<string> interfaceChain, string name, interface service)
+ generates (bool success);
+
+ /**
+ * List all registered services.
+ *
+ * @return fqInstanceNames List of fully-qualified instance names.
+ */
+ list() generates (vec<string> fqInstanceNames);
+
+ /**
+ * List all instances of a particular service.
+ *
+ * @param fqName Fully-qualified interface name.
+ *
+ * @return instanceNames List of instance names running the particular service.
+ */
+ listByInterface(string fqName) generates (vec<string> instanceNames);
+
+ /**
+ * Register for service notifications for a particular service. Must support
+ * multiple registrations.
+ *
+ * onRegistration must be sent out for all services which support the
+ * version provided in the fqName. For instance, if a client registers for
+ * notifications from "android.hardware.foo@1.0", they must also get
+ * notifications from "android.hardware.foo@1.1". If a matching service
+ * is already registered, onRegistration must be sent out with preexisting
+ * = true.
+ *
+ * @param fqName Fully-qualified interface name.
+ * @param name Instance name. If name is empty, notifications must be
+ * sent out for all names.
+ * @param callback Client callback to recieve notifications.
+ *
+ * @return success Whether or not registration was successful.
+ */
+ registerForNotifications(string fqName,
+ string name,
+ IServiceNotification callback)
+ generates (bool success);
+}; \ No newline at end of file
diff --git a/transport/manager/1.0/IServiceNotification.hal b/transport/manager/1.0/IServiceNotification.hal
new file mode 100644
index 0000000..a6151e3
--- /dev/null
+++ b/transport/manager/1.0/IServiceNotification.hal
@@ -0,0 +1,34 @@
+/*
+ * 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.hidl.manager@1.0;
+
+interface IServiceNotification {
+
+ /**
+ * Must be called when a service is registered.
+ *
+ * @param fqInstanceName Fully-qualified instance name (see IServiceManager)
+ * @param preexisting If true, this means the registration was
+ * pre-existing at the time this IServiceNotification
+ * object is itself registered. Otherwise, this means
+ * onRegistration is triggered by a newly registered
+ * service.
+ */
+ oneway onRegistration(string fqName, string name, bool preexisting);
+
+
+}; \ No newline at end of file
diff --git a/transport/manager/1.0/update-makefiles.sh b/transport/manager/1.0/update-makefiles.sh
new file mode 100755
index 0000000..850ca7b
--- /dev/null
+++ b/transport/manager/1.0/update-makefiles.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [ ! -d system/libhidl ] ; then
+ echo "Where is system/libhidl?";
+ exit 1;
+fi
+
+hidl-gen -Lmakefile -r android.hidl:system/libhidl/transport android.hidl.manager@1.0
+hidl-gen -Landroidbp -r android.hidl:system/libhidl/transport android.hidl.manager@1.0