Build: Ensuring test runtime dependencies are installed.

    After migrating the primary install location of test modules into a
    generic testcase folder. All test modules will install to
    out/target/product/<product>/testcase/<module_name>/ if they don't
    specify their LOCAL_MODULE_PATH.
    But the dependent test module should also be copied to testcase
    folder even its LOCAL_MODULE_PATH be set.

BUG: 128815093
Test: 1. vi cts/tests/signature/api-check/Android.mk
        add LOCAL_MODULE_PATH for cts-hiddenapi_flags-csv
      2. m CtsHiddenApiBlacklistDebugClassTestCases
         Then, hiddenapi_flags.csv should also be copied to testcase
	 folder.

Change-Id: Iff872447348e74b2728e0913d04e46ccbaa4e972
diff --git a/core/base_rules.mk b/core/base_rules.mk
index b2bbe46..742119f 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -477,8 +477,6 @@
 
 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
 ifneq ($(LOCAL_INSTALLED_MODULE),$(my_default_test_module))
-# Install into the testcase folder
-$(LOCAL_INSTALLED_MODULE) : $(my_default_test_module)
 $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
 $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
 	@echo "Install: $@"
@@ -622,6 +620,13 @@
 
 multi_arch :=
 
+my_default_test_module :=
+my_default_test_module := $($(my_prefix)OUT_TESTCASES)/$(LOCAL_MODULE)$(arch_dir)/$(my_installed_module_stem)
+ifneq ($(LOCAL_INSTALLED_MODULE),$(my_default_test_module))
+# Install into the testcase folder
+$(LOCAL_INSTALLED_MODULE) : $(my_default_test_module)
+endif
+
 # The module itself.
 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
   $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \