vintf recovery install parity w/ init_rc

There was a relatively recent change (id
I82d0f40d6d7047e271612204391c5a027f84f52f) which avoided installing
init_rc scripts to system when a module was installed to system. This
same bug also existed in VINTF installs.

Future consideration: macrotize behavior (delaying since there are some
subtle differences in paths/variables and given bazel efforts).

Fixes: 204270700
Test: boot
Test: 'mmma hardware/interfaces/health/aidl/default' installs vintf
fragments to '/system/etc/vintf/manifest' before this change but not
after.

Change-Id: Icf505af74c95386a0ed8cb4468dcf7c1122db847
diff --git a/core/base_rules.mk b/core/base_rules.mk
index ceb69bb..23931a1 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -553,6 +553,7 @@
 ###########################################################
 
 my_vintf_installed:=
+my_vintf_path:=
 my_vintf_pairs:=
 my_init_rc_installed :=
 my_init_rc_path :=
@@ -566,8 +567,11 @@
       my_vintf_fragments := $(foreach xml,$(LOCAL_VINTF_FRAGMENTS),$(LOCAL_PATH)/$(xml))
     endif
     ifneq ($(strip $(my_vintf_fragments)),)
-
-      my_vintf_pairs := $(foreach xml,$(my_vintf_fragments),$(xml):$(TARGET_OUT$(partition_tag)_ETC)/vintf/manifest/$(notdir $(xml)))
+      # Make doesn't support recovery as an output partition, but some Soong modules installed in recovery
+      # have init.rc files that need to be installed alongside them. Manually handle the case where the
+      # output file is in the recovery partition.
+      my_vintf_path := $(if $(filter $(TARGET_RECOVERY_ROOT_OUT)/%,$(my_module_path)),$(TARGET_RECOVERY_ROOT_OUT)/system/etc,$(TARGET_OUT$(partition_tag)_ETC))
+      my_vintf_pairs := $(foreach xml,$(my_vintf_fragments),$(xml):$(my_vintf_path)/vintf/manifest/$(notdir $(xml)))
       my_vintf_installed := $(foreach xml,$(my_vintf_pairs),$(call word-colon,2,$(xml)))
 
       # Only set up copy rules once, even if another arch variant shares it