Do not enforce VNDK on GSI if VNDK version is not set

If ro.vndk.version is not defined, use the namespace configuration
file that does not enforce VNDK restriction.
This is only for GSI.

Bug: 70704112
Test: Flash sailfish with PI and test with PI GSI image
Change-Id: Ic2b41357905ef47a3483b2eff635e8ae239e28aa
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index 2377188..7ff5acb 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -81,3 +81,9 @@
 $(error BOARD_AVB_ENABLE cannot be set for Treble GSI)
 endif
 BOARD_BUILD_DISABLED_VBMETAIMAGE := true
+
+#GSI support for the devices that disable VNDK enforcing
+PRODUCT_COPY_FILES += \
+    system/core/rootdir/etc/ld.config.txt:system/etc/ld.config.noenforce.txt \
+    build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc \
+    build/make/target/product/vndk/init.noenforce.rc:system/etc/init/gsi/init.noenforce.rc
diff --git a/target/product/vndk/init.gsi.rc b/target/product/vndk/init.gsi.rc
new file mode 100644
index 0000000..3e6b1fb
--- /dev/null
+++ b/target/product/vndk/init.gsi.rc
@@ -0,0 +1,2 @@
+# If ro.vndk.version is not defined, import init.noenforce.rc
+import /system/etc/init/gsi/init.${ro.vndk.version:-noenforce}.rc
diff --git a/target/product/vndk/init.noenforce.rc b/target/product/vndk/init.noenforce.rc
new file mode 100644
index 0000000..9371cc8
--- /dev/null
+++ b/target/product/vndk/init.noenforce.rc
@@ -0,0 +1,3 @@
+on early-init
+    # If ro.vndk.version is not set, use ld.config.nonenforce.txt
+    export LD_CONFIG_FILE /system/etc/ld.config.noenforce.txt