Merge master@5406228 into git_qt-dev-plus-aosp.
am: c8f5bbabed

Change-Id: If7bf6ad62a4399b437b51ea7afc22fff0c93cbd3
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..2af4548
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,112 @@
+// Copyright (C) 2015 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.
+
+// =====================
+// libdrmhwc_utils.a
+// =====================
+cc_library_static {
+    name: "libdrmhwc_utils",
+
+    srcs: ["worker.cpp"],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    vendor: true,
+
+}
+
+// =====================
+// hwcomposer.drm.so
+// =====================
+cc_defaults {
+    name: "hwcomposer.drm_defaults",
+
+    shared_libs: [
+        "libcutils",
+        "libdrm",
+        "libhardware",
+        "liblog",
+        "libsync",
+        "libui",
+        "libutils",
+    ],
+
+    static_libs: ["libdrmhwc_utils"],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    cppflags: [
+        "-DHWC2_USE_CPP11",
+        "-DHWC2_INCLUDE_STRINGIFICATION",
+    ],
+
+    relative_install_path: "hw",
+    vendor: true,
+}
+cc_library_static {
+    name: "drm_hwcomposer",
+    defaults: ["hwcomposer.drm_defaults"],
+    srcs: [
+        "autolock.cpp",
+        "resourcemanager.cpp",
+        "drmdevice.cpp",
+        "drmconnector.cpp",
+        "drmcrtc.cpp",
+        "drmdisplaycomposition.cpp",
+        "drmdisplaycompositor.cpp",
+        "drmencoder.cpp",
+        "drmeventlistener.cpp",
+        "drmhwctwo.cpp",
+        "drmmode.cpp",
+        "drmplane.cpp",
+        "drmproperty.cpp",
+        "hwcutils.cpp",
+        "platform.cpp",
+        "vsyncworker.cpp",
+    ],
+}
+
+cc_library_shared {
+    name: "hwcomposer.drm",
+    defaults: ["hwcomposer.drm_defaults"],
+    whole_static_libs: ["drm_hwcomposer"],
+    srcs: ["platformdrmgeneric.cpp"],
+    cppflags: ["-DUSE_DRM_GENERIC_IMPORTER"],
+}
+
+cc_library_shared {
+    name: "hwcomposer.drm_minigbm",
+    defaults: ["hwcomposer.drm_defaults"],
+    whole_static_libs: ["drm_hwcomposer"],
+    srcs: [
+        "platformdrmgeneric.cpp",
+        "platformminigbm.cpp",
+    ],
+    include_dirs: ["external/minigbm/cros_gralloc"],
+}
+
+// Used by hwcomposer.drm_hikey and hwcomposer.drm_hikey960
+filegroup {
+    name: "drm_hwcomposer_platformhisi",
+    srcs: [
+        "platformdrmgeneric.cpp",
+        "platformhisi.cpp",
+    ],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index d5ee200..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright (C) 2015 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.
-
-ifeq ($(strip $(BOARD_USES_DRM_HWCOMPOSER)),true)
-
-DRM_HWC_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
-
-LOCAL_PATH := $(call my-dir)
-
-common_drm_hwcomposer_cflags := \
-    -Wall \
-    -Werror \
-
-# =====================
-# libdrmhwc_utils.a
-# =====================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-	worker.cpp
-
-LOCAL_CFLAGS := $(common_drm_hwcomposer_cflags)
-
-LOCAL_MODULE := libdrmhwc_utils
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_STATIC_LIBRARY)
-
-# =====================
-# hwcomposer.drm.so
-# =====================
-include $(CLEAR_VARS)
-
-LOCAL_SHARED_LIBRARIES := \
-	libcutils \
-	libdrm \
-	libhardware \
-	liblog \
-	libsync \
-	libui \
-	libutils
-
-LOCAL_STATIC_LIBRARIES := libdrmhwc_utils
-
-LOCAL_C_INCLUDES := \
-	system/core/libsync
-
-LOCAL_SRC_FILES := \
-	autolock.cpp \
-	resourcemanager.cpp \
-	drmdevice.cpp \
-	drmconnector.cpp \
-	drmcrtc.cpp \
-	drmdisplaycomposition.cpp \
-	drmdisplaycompositor.cpp \
-	drmencoder.cpp \
-	drmeventlistener.cpp \
-	drmhwctwo.cpp \
-	drmmode.cpp \
-	drmplane.cpp \
-	drmproperty.cpp \
-	hwcutils.cpp \
-	platform.cpp \
-	platformdrmgeneric.cpp \
-	vsyncworker.cpp
-
-LOCAL_CFLAGS := $(common_drm_hwcomposer_cflags)
-
-LOCAL_CPPFLAGS += \
-	-DHWC2_USE_CPP11 \
-	-DHWC2_INCLUDE_STRINGIFICATION
-
-ifneq ($(filter 2 3 4 5 6 7 8, $(DRM_HWC_ANDROID_MAJOR_VERSION)),)
-LOCAL_CPPFLAGS += -DHWC2_USE_OLD_GB_IMPORT
-endif
-
-
-ifeq ($(TARGET_PRODUCT),hikey960)
-LOCAL_CPPFLAGS += -DUSE_HISI_IMPORTER
-LOCAL_SRC_FILES += platformhisi.cpp
-LOCAL_C_INCLUDES += device/linaro/hikey/gralloc960/
-else ifeq ($(TARGET_PRODUCT),hikey)
-LOCAL_CPPFLAGS += -DUSE_HISI_IMPORTER
-LOCAL_SRC_FILES += platformhisi.cpp
-LOCAL_C_INCLUDES += device/linaro/hikey/gralloc/
-else ifeq ($(strip $(BOARD_DRM_HWCOMPOSER_BUFFER_IMPORTER)),minigbm)
-LOCAL_SRC_FILES += platformminigbm.cpp
-LOCAL_C_INCLUDES += external/minigbm/cros_gralloc/
-else
-LOCAL_CPPFLAGS += -DUSE_DRM_GENERIC_IMPORTER
-endif
-
-LOCAL_MODULE := hwcomposer.drm
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..058faa0
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,13 @@
+
+
+cc_test {
+    name: "hwc-drm-tests",
+
+    srcs: ["worker_test.cpp"],
+
+    vendor: true,
+    header_libs: ["libhardware_headers"],
+    static_libs: ["libdrmhwc_utils"],
+    shared_libs: ["hwcomposer.drm"],
+    include_dirs: ["external/drm_hwcomposer"],
+}
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index b498d62..0000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-	worker_test.cpp
-
-LOCAL_MODULE := hwc-drm-tests
-LOCAL_VENDOR_MODULE := true
-LOCAL_HEADER_LIBRARIES := libhardware_headers
-LOCAL_STATIC_LIBRARIES := libdrmhwc_utils
-LOCAL_SHARED_LIBRARIES := hwcomposer.drm
-LOCAL_C_INCLUDES := external/drm_hwcomposer
-
-include $(BUILD_NATIVE_TEST)