RM6785: Patch libMtkOmxVdecEx to use libui-v32

 * Fixes OMX crash https://gist.githubusercontent.com/SamarV-121/efbeed785308c09655c354362b0f007c/raw

Change-Id: Id7f221f109e27a4d5544aa81ec73c60db0c0dc33
diff --git a/device.mk b/device.mk
index d361a4f..424d441 100644
--- a/device.mk
+++ b/device.mk
@@ -102,6 +102,9 @@
 PRODUCT_PACKAGES += \
     android.hardware.graphics.composer@2.1-service
 
+PRODUCT_PACKAGES += \
+    libui-v32
+
 # Health
 PRODUCT_PACKAGES += \
     android.hardware.health-service.RM6785 \
diff --git a/extract-files.sh b/extract-files.sh
index 544c6a0..8d64ee2 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -68,6 +68,9 @@
         vendor/lib64/libwifi-hal-mtk.so)
             "$PATCHELF" --set-soname "libwifi-hal-mtk.so" "$2"
             ;;
+        vendor/lib/libMtkOmxVdecEx.so)
+            "$PATCHELF" --replace-needed "libui.so" "libui-v32.so" "$2"
+            ;;
     esac
 }
 
diff --git a/vndk/Android.mk b/vndk/Android.mk
index ea2a6c0..47c9940 100644
--- a/vndk/Android.mk
+++ b/vndk/Android.mk
@@ -32,3 +32,23 @@
 LOCAL_CHECK_ELF_FILES := false
 LOCAL_VENDOR_MODULE := true
 include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libui-v32
+LOCAL_SRC_FILES := v32/arm64/arch-arm-armv8-a/shared/vndk-core/libui.so
+LOCAL_MODULE_SUFFIX := .so
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_TARGET_ARCH := arm
+LOCAL_MODULE_TAGS := optional
+LOCAL_CHECK_ELF_FILES := false
+LOCAL_VENDOR_MODULE := true
+LOCAL_REQUIRED_MODULES := android.hardware.graphics.common-V2-ndk_platform
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.graphics.common-V2-ndk_platform
+LOCAL_SHARED_LIBRARIES := android.hardware.graphics.common-V2-ndk
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_TAGS := optional
+LOCAL_VENDOR_MODULE := true
+include $(BUILD_SHARED_LIBRARY)