Use different hwcomposer HALs for hikey and hikey960

Instead of conditionally compiling hwcomposer.drm for hikey and
hikey960, compile two different modules and selectively use them
on hikey and hikey960.

Bug: 122332597
Test: none
Change-Id: Ifcb64798bc34101d9e1f851454c3fe361c478c12
diff --git a/device-common.mk b/device-common.mk
index dcf0377..525ae8d 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -93,11 +93,6 @@
     android.hardware.graphics.composer@2.1-service \
     android.hardware.graphics.mapper@2.0-impl
 
-ifeq ($(HIKEY_USE_DRM_HWCOMPOSER), true)
-  BOARD_USES_DRM_HWCOMPOSER := true
-  PRODUCT_PACKAGES += hwcomposer.drm
-endif
-
 # Memtrack
 PRODUCT_PACKAGES += memtrack.default \
     android.hardware.memtrack@1.0-service \
@@ -240,6 +235,9 @@
         device/linaro/hikey/etc/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
         frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml
 
+PRODUCT_COPY_FILES += \
+    device/linaro/hikey/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.common.rc \
+
 PRODUCT_PACKAGES += \
     android.hardware.renderscript@1.0.vndk-sp\
     android.hardware.graphics.composer@2.1.vndk-sp\
diff --git a/hikey/device-hikey.mk b/hikey/device-hikey.mk
index 99fdb50..70680e5 100644
--- a/hikey/device-hikey.mk
+++ b/hikey/device-hikey.mk
@@ -18,7 +18,7 @@
                         $(TARGET_PREBUILT_DTB):hi6220-hikey.dtb \
 			$(LOCAL_PATH)/$(TARGET_FSTAB):$(TARGET_COPY_OUT_VENDOR)/etc/fstab.hikey \
 			device/linaro/hikey/fstab.ramdisk:$(TARGET_COPY_OUT_RAMDISK)/fstab.hikey \
-			device/linaro/hikey/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.rc \
+			device/linaro/hikey/hikey/init.hikey.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.rc \
 			device/linaro/hikey/init.hikey.power.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.power.rc \
 			device/linaro/hikey/init.common.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey.usb.rc \
 			device/linaro/hikey/ueventd.common.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \
@@ -51,6 +51,10 @@
 # Sensors HAL
 PRODUCT_PACKAGES += sensors.hikey
 
+ifeq ($(HIKEY_USE_DRM_HWCOMPOSER), true)
+  PRODUCT_PACKAGES += hwcomposer.drm_hikey
+endif
+
 # Include mali blobs from ARM
 PRODUCT_PACKAGES += libGLES_mali.so END_USER_LICENCE_AGREEMENT.txt
 
diff --git a/hikey/init.hikey.rc b/hikey/init.hikey.rc
new file mode 100644
index 0000000..8046f91
--- /dev/null
+++ b/hikey/init.hikey.rc
@@ -0,0 +1,6 @@
+import init.common.rc
+
+on post-fs
+    # Set supported opengles version
+    setprop ro.hardware.hwcomposer drm_hikey
+
diff --git a/hikey960/device-hikey960.mk b/hikey960/device-hikey960.mk
index c1d697a..2695698 100644
--- a/hikey960/device-hikey960.mk
+++ b/hikey960/device-hikey960.mk
@@ -19,7 +19,7 @@
 
 PRODUCT_COPY_FILES +=	$(LOCAL_PATH)/fstab.hikey960:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.hikey960 \
 			device/linaro/hikey/fstab.ramdisk:$(TARGET_COPY_OUT_RAMDISK)/fstab.hikey960 \
-			device/linaro/hikey/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.rc \
+			device/linaro/hikey/hikey960/init.hikey960.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.rc \
 			device/linaro/hikey/init.hikey960.power.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.power.rc \
 			device/linaro/hikey/init.common.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.hikey960.usb.rc \
 			device/linaro/hikey/ueventd.common.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \
@@ -73,6 +73,10 @@
 
 PRODUCT_PACKAGES += sensors.hikey960
 
+ifeq ($(HIKEY_USE_DRM_HWCOMPOSER), true)
+  PRODUCT_PACKAGES += hwcomposer.drm_hikey960
+endif
+
 # Unfortunately inherit-product doesn't export build variables from the
 # called make file to the caller, so we have to include it directly here.
 # FIXME: Improve this the next time we update the binary package
diff --git a/hikey960/init.hikey960.rc b/hikey960/init.hikey960.rc
new file mode 100644
index 0000000..b767134
--- /dev/null
+++ b/hikey960/init.hikey960.rc
@@ -0,0 +1,6 @@
+import init.common.rc
+
+on post-fs
+    # Set supported opengles version
+    setprop ro.hardware.hwcomposer drm_hikey960
+
diff --git a/init.common.rc b/init.common.rc
index 5950f61..d802936 100644
--- a/init.common.rc
+++ b/init.common.rc
@@ -53,9 +53,6 @@
     setprop status.battery.level_raw  50
     setprop status.battery.level_scale 9
 
-# Set supported opengles version
-    setprop ro.hardware.hwcomposer drm
-
 # If an app forces screen rotation, revert it once the apps closes
     setprop persist.demo.rotationlock 1