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
diff --git a/Android.bp b/Android.bp
index 87bee79..ea670fa 100644
--- a/Android.bp
+++ b/Android.bp
@@ -13,47 +13,27 @@
// limitations under the License.
subdirs = [
- "test",
- "manager/1.0"
+ "base", // libhidlbase
+ "transport", // libhidl
]
-cc_library_shared {
- name: "libhidl",
+cc_test {
+ name: "libhidl_test",
+ gtest: false,
+ srcs: ["test_main.cpp"],
+
shared_libs: [
"libbase",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
"liblog",
"libutils",
- "libhwbinder",
- "libcutils",
],
- export_shared_lib_headers: [
- "libbase",
- "libutils",
+ static_libs: ["libgtest"],
+
+ cflags: [
+ "-O0",
+ "-g",
],
- local_include_dirs: ["include"],
- export_include_dirs: ["include"],
-
- clang: true,
- sanitize: {
- misc_undefined: ["integer"],
- },
-
- 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"],
-
- srcs: [
- "HidlSupport.cpp",
- "HidlBinderSupport.cpp",
- "ServiceManagement.cpp",
- "Static.cpp",
- "Status.cpp",
- "TaskRunner.cpp",
- ],
-
- product_variables: {
- debuggable: {
- cflags: ["-DLIBHIDL_TARGET_DEBUGGABLE"],
- },
- },
}
diff --git a/base/Android.bp b/base/Android.bp
new file mode 100644
index 0000000..d990140
--- /dev/null
+++ b/base/Android.bp
@@ -0,0 +1,46 @@
+// 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.
+
+cc_library_shared {
+ name: "libhidlbase",
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libbase",
+ "libutils",
+ ],
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+
+ clang: true,
+ sanitize: {
+ misc_undefined: ["integer"],
+ },
+
+ srcs: [
+ "HidlSupport.cpp",
+ "Status.cpp",
+ "TaskRunner.cpp",
+ ],
+
+ product_variables: {
+ debuggable: {
+ cflags: ["-DLIBHIDL_TARGET_DEBUGGABLE"],
+ },
+ },
+}
diff --git a/HidlSupport.cpp b/base/HidlSupport.cpp
similarity index 100%
rename from HidlSupport.cpp
rename to base/HidlSupport.cpp
diff --git a/Status.cpp b/base/Status.cpp
similarity index 100%
rename from Status.cpp
rename to base/Status.cpp
diff --git a/TaskRunner.cpp b/base/TaskRunner.cpp
similarity index 100%
rename from TaskRunner.cpp
rename to base/TaskRunner.cpp
diff --git a/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
similarity index 100%
rename from include/hidl/HidlSupport.h
rename to base/include/hidl/HidlSupport.h
diff --git a/include/hidl/MQDescriptor.h b/base/include/hidl/MQDescriptor.h
similarity index 100%
rename from include/hidl/MQDescriptor.h
rename to base/include/hidl/MQDescriptor.h
diff --git a/include/hidl/Status.h b/base/include/hidl/Status.h
similarity index 100%
rename from include/hidl/Status.h
rename to base/include/hidl/Status.h
diff --git a/include/hidl/SynchronizedQueue.h b/base/include/hidl/SynchronizedQueue.h
similarity index 100%
rename from include/hidl/SynchronizedQueue.h
rename to base/include/hidl/SynchronizedQueue.h
diff --git a/include/hidl/TaskRunner.h b/base/include/hidl/TaskRunner.h
similarity index 100%
rename from include/hidl/TaskRunner.h
rename to base/include/hidl/TaskRunner.h
diff --git a/manager/1.0/update-makefiles.sh b/manager/1.0/update-makefiles.sh
deleted file mode 100755
index f054795..0000000
--- a/manager/1.0/update-makefiles.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-if [ ! -d system/libhidl ] ; then
- echo "Where is system/libhidl?";
- exit 1;
-fi
-
-hidl-gen -Lmakefile -r android.hidl:system/libhidl android.hidl.manager@1.0
-hidl-gen -Landroidbp -r android.hidl:system/libhidl android.hidl.manager@1.0
\ No newline at end of file
diff --git a/test/Android.bp b/test/Android.bp
deleted file mode 100644
index 2508f65..0000000
--- a/test/Android.bp
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.
-
-cc_test {
- name: "libhidl_test",
- gtest: false,
- srcs: ["main.cpp"],
-
- shared_libs: [
- "libbase",
- "libhidl",
- "libhwbinder",
- "liblog",
- "libutils",
- ],
- static_libs: ["libgtest"],
-
- cflags: [
- "-O0",
- "-g",
- ],
-}
diff --git a/test/main.cpp b/test_main.cpp
similarity index 100%
rename from test/main.cpp
rename to test_main.cpp
diff --git a/transport/Android.bp b/transport/Android.bp
new file mode 100644
index 0000000..032381a
--- /dev/null
+++ b/transport/Android.bp
@@ -0,0 +1,52 @@
+// 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.
+
+subdirs = [
+ "manager/1.0"
+]
+
+cc_library_shared {
+ name: "libhidltransport",
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libutils",
+ "libhidlbase",
+ "libhwbinder",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libbase",
+ "libutils",
+ "libhidlbase",
+ ],
+
+ export_include_dirs: ["include"],
+
+ 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"],
+
+ srcs: [
+ "HidlBinderSupport.cpp",
+ "ServiceManagement.cpp",
+ "Static.cpp"
+ ],
+
+ product_variables: {
+ debuggable: {
+ cflags: ["-DLIBHIDL_TARGET_DEBUGGABLE"],
+ },
+ },
+}
diff --git a/HidlBinderSupport.cpp b/transport/HidlBinderSupport.cpp
similarity index 100%
rename from HidlBinderSupport.cpp
rename to transport/HidlBinderSupport.cpp
diff --git a/ServiceManagement.cpp b/transport/ServiceManagement.cpp
similarity index 100%
rename from ServiceManagement.cpp
rename to transport/ServiceManagement.cpp
diff --git a/Static.cpp b/transport/Static.cpp
similarity index 100%
rename from Static.cpp
rename to transport/Static.cpp
diff --git a/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
similarity index 100%
rename from include/hidl/HidlBinderSupport.h
rename to transport/include/hidl/HidlBinderSupport.h
diff --git a/include/hidl/HidlTransportSupport.h b/transport/include/hidl/HidlTransportSupport.h
similarity index 100%
rename from include/hidl/HidlTransportSupport.h
rename to transport/include/hidl/HidlTransportSupport.h
diff --git a/include/hidl/LegacySupport.h b/transport/include/hidl/LegacySupport.h
similarity index 100%
rename from include/hidl/LegacySupport.h
rename to transport/include/hidl/LegacySupport.h
diff --git a/include/hidl/ServiceManagement.h b/transport/include/hidl/ServiceManagement.h
similarity index 100%
rename from include/hidl/ServiceManagement.h
rename to transport/include/hidl/ServiceManagement.h
diff --git a/include/hidl/Static.h b/transport/include/hidl/Static.h
similarity index 100%
rename from include/hidl/Static.h
rename to transport/include/hidl/Static.h
diff --git a/manager/1.0/Android.bp b/transport/manager/1.0/Android.bp
similarity index 88%
rename from manager/1.0/Android.bp
rename to transport/manager/1.0/Android.bp
index a41df82..9cea8aa 100644
--- a/manager/1.0/Android.bp
+++ b/transport/manager/1.0/Android.bp
@@ -3,7 +3,7 @@
genrule {
name: "android.hidl.manager@1.0_genc++",
tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl android.hidl.manager@1.0",
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl/transport android.hidl.manager@1.0",
srcs: [
"IServiceManager.hal",
"IServiceNotification.hal",
@@ -17,7 +17,7 @@
genrule {
name: "android.hidl.manager@1.0_genc++_headers",
tools: ["hidl-gen"],
- cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl android.hidl.manager@1.0",
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl/transport android.hidl.manager@1.0",
srcs: [
"IServiceManager.hal",
"IServiceNotification.hal",
@@ -42,13 +42,15 @@
generated_headers: ["android.hidl.manager@1.0_genc++_headers"],
export_generated_headers: ["android.hidl.manager@1.0_genc++_headers"],
shared_libs: [
- "libhidl",
+ "libhidlbase",
+ "libhidltransport",
"libhwbinder",
"libutils",
"libcutils",
],
export_shared_lib_headers: [
- "libhidl",
+ "libhidlbase",
+ "libhidltransport",
"libhwbinder",
"libutils",
],
diff --git a/manager/1.0/Android.mk b/transport/manager/1.0/Android.mk
similarity index 92%
rename from manager/1.0/Android.mk
rename to transport/manager/1.0/Android.mk
index 588e556..9721993 100644
--- a/manager/1.0/Android.mk
+++ b/transport/manager/1.0/Android.mk
@@ -24,7 +24,7 @@
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava -randroid.hidl:system/libhidl \
+ -Ljava -randroid.hidl:system/libhidl/transport \
android.hidl.manager@1.0::IServiceManager
$(GEN): $(LOCAL_PATH)/IServiceManager.hal
@@ -41,7 +41,7 @@
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava -randroid.hidl:system/libhidl \
+ -Ljava -randroid.hidl:system/libhidl/transport \
android.hidl.manager@1.0::IServiceNotification
$(GEN): $(LOCAL_PATH)/IServiceNotification.hal
@@ -72,7 +72,7 @@
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava -randroid.hidl:system/libhidl \
+ -Ljava -randroid.hidl:system/libhidl/transport \
android.hidl.manager@1.0::IServiceManager
$(GEN): $(LOCAL_PATH)/IServiceManager.hal
@@ -89,7 +89,7 @@
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
- -Ljava -randroid.hidl:system/libhidl \
+ -Ljava -randroid.hidl:system/libhidl/transport \
android.hidl.manager@1.0::IServiceNotification
$(GEN): $(LOCAL_PATH)/IServiceNotification.hal
diff --git a/manager/1.0/IServiceManager.hal b/transport/manager/1.0/IServiceManager.hal
similarity index 100%
rename from manager/1.0/IServiceManager.hal
rename to transport/manager/1.0/IServiceManager.hal
diff --git a/manager/1.0/IServiceNotification.hal b/transport/manager/1.0/IServiceNotification.hal
similarity index 100%
rename from manager/1.0/IServiceNotification.hal
rename to transport/manager/1.0/IServiceNotification.hal
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