hwcomposer3 in Android.bp

Bug: 205619241
Test: build CF; launch; hwcomposer runs ok
Merged-In: Idb6005af8e4704a3859048ae952707216377840d
Change-Id: Idb6005af8e4704a3859048ae952707216377840d
diff --git a/Android.mk b/Android.mk
index b8a3d24..6ab1d7d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -144,7 +144,6 @@
 endif
 
 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 28 -o $(IS_AT_LEAST_QPR1) = true && echo isApi29OrHigher),isApi29OrHigher)
-    include $(GOLDFISH_OPENGL_PATH)/system/hwc3/Android.mk
     # hardware codecs enabled after P
     include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/common/Android.mk
     include $(GOLDFISH_OPENGL_PATH)/system/codecs/omx/plugin/Android.mk
diff --git a/system/hwc3/Android.bp b/system/hwc3/Android.bp
new file mode 100644
index 0000000..9243706
--- /dev/null
+++ b/system/hwc3/Android.bp
@@ -0,0 +1,93 @@
+//
+// Copyright 2022 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 {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "device_generic_goldfish-opengl_license",
+    ],
+}
+
+cc_binary {
+    name: "android.hardware.graphics.composer3-service.ranchu",
+
+    relative_install_path: "hw",
+    vendor: true,
+
+    shared_libs: [
+        "android.hardware.graphics.composer@2.1-resources",
+        "android.hardware.graphics.composer@2.2-resources",
+        "android.hardware.graphics.composer3-V2-ndk",
+        "libbase",
+        "libbinder_ndk",
+        "libcutils",
+        "libcuttlefish_device_config",
+        "libcuttlefish_device_config_proto",
+        "libdrm",
+        "libgralloctypes",
+        "libhidlbase",
+        "libjsoncpp",
+        "liblog",
+        "libsync",
+        "libui",
+        "libutils",
+        "libOpenglSystemCommon",
+        "libui",
+    ],
+
+    static_libs: [
+        "libaidlcommonsupport",
+        "libyuv_static",
+    ],
+
+    header_libs: [
+        "libminigbm_gralloc_headers",
+    ],
+
+    srcs: [
+        "ClientFrameComposer.cpp",
+        "Common.cpp",
+        "Composer.cpp",
+        "ComposerClient.cpp",
+        "ComposerResources.cpp",
+        "Device.cpp",
+        "Display.cpp",
+        "DisplayConfig.cpp",
+        "DisplayFinder.cpp",
+        "Drm.cpp",
+        "DrmSwapchain.cpp",
+        "DrmAtomicRequest.cpp",
+        "DrmBuffer.cpp",
+        "DrmClient.cpp",
+        "DrmConnector.cpp",
+        "DrmCrtc.cpp",
+        "DrmDisplay.cpp",
+        "DrmEventListener.cpp",
+        "DrmMode.cpp",
+        "DrmPlane.cpp",
+        "Gralloc.cpp",
+        "GuestFrameComposer.cpp",
+        "HostFrameComposer.cpp",
+        "HostUtils.cpp",
+        "Layer.cpp",
+        "Main.cpp",
+        "NoOpFrameComposer.cpp",
+        "VsyncThread.cpp",
+    ],
+
+    vintf_fragments: ["hwc3.xml"],
+    init_rc: ["hwc3.rc"],
+}
diff --git a/system/hwc3/Android.mk b/system/hwc3/Android.mk
deleted file mode 100644
index 96e0941..0000000
--- a/system/hwc3/Android.mk
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# Copyright 2022 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 := android.hardware.graphics.composer3-service.ranchu
-
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_VENDOR_MODULE := true
-
-LOCAL_SHARED_LIBRARIES := \
-    android.hardware.graphics.composer@2.1-resources \
-    android.hardware.graphics.composer@2.2-resources \
-    android.hardware.graphics.composer3-V2-ndk \
-    libbase \
-    libbinder_ndk \
-    libEGL \
-    libcutils \
-    libcuttlefish_device_config \
-    libcuttlefish_device_config_proto \
-    libcuttlefish_utils \
-    libcuttlefish_fs \
-    libdrm \
-    libgralloctypes \
-    libhardware \
-    libhidlbase \
-    libjsoncpp \
-    libjpeg \
-    liblog \
-    libsync \
-    libui \
-    libutils \
-    libutils \
-    libOpenglSystemCommon \
-    lib_renderControl_enc \
-    libui
-
-LOCAL_STATIC_LIBRARIES := \
-    libaidlcommonsupport \
-    libyuv_static
-
-LOCAL_C_INCLUDES := \
-    external/libdrm \
-    external/minigbm/cros_gralloc \
-    hardware/google/gfxstream/guest/android-emu \
-    hardware/google/gfxstream/guest/include \
-    hardware/google/gfxstream/guest/iostream/include/libOpenglRender \
-    hardware/google/gfxstream/guest/OpenglCodecCommon \
-    hardware/google/gfxstream/guest/OpenglSystemCommon \
-    hardware/google/gfxstream/guest/platform/include \
-    hardware/google/gfxstream/guest/renderControl_enc \
-    system/core/libsync \
-    system/core/libsync/include \
-
-LOCAL_SRC_FILES := \
-    ClientFrameComposer.cpp \
-    Common.cpp \
-    Composer.cpp \
-    ComposerClient.cpp \
-    ComposerResources.cpp \
-    Device.cpp \
-    Display.cpp \
-    DisplayConfig.cpp \
-    DisplayFinder.cpp \
-    Drm.cpp \
-    DrmSwapchain.cpp \
-    DrmAtomicRequest.cpp \
-    DrmBuffer.cpp \
-    DrmClient.cpp \
-    DrmConnector.cpp \
-    DrmCrtc.cpp \
-    DrmDisplay.cpp \
-    DrmEventListener.cpp \
-    DrmMode.cpp \
-    DrmPlane.cpp \
-    Gralloc.cpp \
-    GuestFrameComposer.cpp \
-    HostFrameComposer.cpp \
-    HostUtils.cpp \
-    Layer.cpp \
-    Main.cpp \
-    NoOpFrameComposer.cpp \
-    VsyncThread.cpp \
-
-LOCAL_VINTF_FRAGMENTS := hwc3.xml
-LOCAL_INIT_RC := hwc3.rc
-
-include $(BUILD_EXECUTABLE)
-