Split libdvr_headers from libdvr: Step 1
Converts libdvr's Android file into Android.bp as now we have no Java
deps anymore. Then we added header only library libdvr_headers for all
headers.
Next step is to figure out how to split out public headers and make them
easy to be copied into Google3.
Bug: 37578558
Test: dvr_api-test
Change-Id: Idf15cfd5aa61cd7d6f5cc15c4db7cce485b3b293
diff --git a/libs/vr/libdvr/Android.bp b/libs/vr/libdvr/Android.bp
new file mode 100644
index 0000000..3876745
--- /dev/null
+++ b/libs/vr/libdvr/Android.bp
@@ -0,0 +1,67 @@
+// 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.
+
+
+cc_library_headers {
+ name: "libdvr_headers",
+ owner: "google",
+ export_include_dirs: ["include"],
+}
+
+cc_library_static {
+ name: "libdvr",
+ owner: "google",
+
+ cflags: [
+ "-fvisibility=hidden",
+ "-DLOG_TAG=\"libdvr\"",
+ "-DDVR_EXPORT=__attribute__((visibility(\"default\")))",
+ ],
+
+ header_libs: ["libdvr_headers"],
+ export_header_lib_headers: ["libdvr_headers"],
+
+ srcs: [
+ "dvr_api.cpp",
+ "dvr_buffer.cpp",
+ "dvr_buffer_queue.cpp",
+ "dvr_display_manager.cpp",
+ "dvr_hardware_composer_client.cpp",
+ "dvr_surface.cpp",
+ "dvr_vsync.cpp",
+ ],
+
+ static_libs: [
+ "libbufferhub",
+ "libbufferhubqueue",
+ "libdisplay",
+ "libvrsensor",
+ "libvirtualtouchpadclient",
+ "libvr_hwc-impl",
+ "libvr_hwc-binder",
+ "libgrallocusage",
+ ],
+
+ shared_libs: [
+ "android.hardware.graphics.bufferqueue@1.0",
+ "android.hidl.token@1.0-utils",
+ "libbase",
+ "libnativewindow",
+ ],
+
+}
+
+subdirs = [
+ "tests",
+]
diff --git a/libs/vr/libdvr/Android.mk b/libs/vr/libdvr/Android.mk
deleted file mode 100644
index 2375b5a..0000000
--- a/libs/vr/libdvr/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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.
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libdvr
-LOCAL_MODULE_OWNER := google
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_CFLAGS += \
- -fvisibility=hidden \
- -DLOG_TAG=\"libdvr\" \
- -D DVR_EXPORT='__attribute__ ((visibility ("default")))'
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
- $(LOCAL_PATH)/include \
-
-LOCAL_SRC_FILES := \
- dvr_api.cpp \
- dvr_buffer.cpp \
- dvr_buffer_queue.cpp \
- dvr_display_manager.cpp \
- dvr_hardware_composer_client.cpp \
- dvr_surface.cpp \
- dvr_vsync.cpp \
-
-LOCAL_STATIC_LIBRARIES := \
- libbufferhub \
- libbufferhubqueue \
- libdisplay \
- libvrsensor \
- libvirtualtouchpadclient \
- libvr_hwc-impl \
- libvr_hwc-binder \
- libgrallocusage \
-
-LOCAL_SHARED_LIBRARIES := \
- android.hardware.graphics.bufferqueue@1.0 \
- android.hidl.token@1.0-utils \
- libbase \
- libnativewindow \
-
-include $(BUILD_STATIC_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/libs/vr/libdvr/include/dvr/dvr_api.h b/libs/vr/libdvr/include/dvr/dvr_api.h
index bb9d8d8..8a203e0 100644
--- a/libs/vr/libdvr/include/dvr/dvr_api.h
+++ b/libs/vr/libdvr/include/dvr/dvr_api.h
@@ -262,13 +262,10 @@
// The buffer metadata that an Android Surface (a.k.a. ANativeWindow)
// will populate. A DvrWriteBufferQueue must be created with this metadata iff
-// ANativeWindow access is needed. Note that this struct must stay in sync with
-// BufferHubQueueCore::NativeBufferMetadata. Please do not remove, modify, or
-// reorder existing data members. If new fields need to be added, please take
-// extra care to make sure that new data field is padded properly the size of
-// the struct stays same.
-// TODO(b/37578558) Move |dvr_api.h| into a header library so that this
-// structure won't be copied between |dvr_api.h| and |buffer_hub_qeue_core.h|.
+// ANativeWindow access is needed. Please do not remove, modify, or reorder
+// existing data members. If new fields need to be added, please take extra care
+// to make sure that new data field is padded properly the size of the struct
+// stays same.
struct DvrNativeBufferMetadata {
// Timestamp of the frame.
int64_t timestamp;
diff --git a/libs/vr/libdvr/tests/Android.bp b/libs/vr/libdvr/tests/Android.bp
new file mode 100644
index 0000000..af202b4
--- /dev/null
+++ b/libs/vr/libdvr/tests/Android.bp
@@ -0,0 +1,53 @@
+// 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.
+
+shared_libraries = [
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "libgui",
+ "liblog",
+ "libhardware",
+ "libui",
+ "libutils",
+ "libnativewindow",
+]
+
+static_libraries = [
+ "libdvr",
+ "libbufferhubqueue",
+ "libbufferhub",
+ "libchrome",
+ "libdvrcommon",
+ "libdisplay",
+ "libpdx_default_transport",
+]
+
+cc_test {
+ srcs: [
+ "dvr_buffer_queue-test.cpp",
+ "dvr_display_manager-test.cpp",
+ "dvr_named_buffer-test.cpp",
+ ],
+
+ static_libs: static_libraries,
+ shared_libs: shared_libraries,
+ cflags: [
+ "-DLOG_TAG=\"dvr_api-test\"",
+ "-DTRACE=0",
+ "-O0",
+ "-g",
+ ],
+ name: "dvr_api-test",
+}
diff --git a/libs/vr/libdvr/tests/Android.mk b/libs/vr/libdvr/tests/Android.mk
deleted file mode 100644
index d6ce99b..0000000
--- a/libs/vr/libdvr/tests/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-shared_libraries := \
- libbase \
- libbinder \
- libcutils \
- libgui \
- liblog \
- libhardware \
- libui \
- libutils \
- libnativewindow \
-
-static_libraries := \
- libdvr \
- libbufferhubqueue \
- libbufferhub \
- libchrome \
- libdvrcommon \
- libdisplay \
- libpdx_default_transport \
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
- dvr_buffer_queue-test.cpp \
- dvr_display_manager-test.cpp \
- dvr_named_buffer-test.cpp \
-
-LOCAL_STATIC_LIBRARIES := $(static_libraries)
-LOCAL_SHARED_LIBRARIES := $(shared_libraries)
-LOCAL_EXPORT_C_INCLUDE_DIRS := ${LOCAL_C_INCLUDES}
-LOCAL_CFLAGS := -DLOG_TAG=\"dvr_api-test\" -DTRACE=0 -O0 -g
-LOCAL_MODULE := dvr_api-test
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_NATIVE_TEST)