Revert "test_module_config for sh_test"

This reverts commit 45dca5c8cc538392edbde4ee1077fc86509b2e38.

Reason for revert: DroidMonitor: Potential culprit for http://b/377964351 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Idd5e4b0d04b3c04dc1cfc4541615fc5f42a85c3e
diff --git a/tradefed_modules/test_module_config.go b/tradefed_modules/test_module_config.go
index 4abaaa6..7a04c19 100644
--- a/tradefed_modules/test_module_config.go
+++ b/tradefed_modules/test_module_config.go
@@ -196,7 +196,7 @@
 	module := &testModuleConfigModule{}
 
 	module.AddProperties(&module.tradefedProperties)
-	android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+	android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
 	android.InitDefaultableModule(module)
 
 	return module
@@ -216,28 +216,13 @@
 // Implements android.AndroidMkEntriesProvider
 var _ android.AndroidMkEntriesProvider = (*testModuleConfigModule)(nil)
 
-func (m *testModuleConfigModule) nativeExtraEntries(entries *android.AndroidMkEntries) {
-	// TODO(ron) provider for suffix and STEM?
-	entries.SetString("LOCAL_MODULE_SUFFIX", "")
-	// Should the stem and path use the base name or our module name?
-	entries.SetString("LOCAL_MODULE_STEM", m.provider.OutputFile.Rel())
-	entries.SetPath("LOCAL_MODULE_PATH", m.provider.InstallDir)
-}
-
-func (m *testModuleConfigModule) javaExtraEntries(entries *android.AndroidMkEntries) {
-	// The app_prebuilt_internal.mk files try create a copy of the OutputFile as an .apk.
-	// Normally, this copies the "package.apk" from the intermediate directory here.
-	// To prevent the copy of the large apk and to prevent confusion with the real .apk we
-	// link to, we set the STEM here to a bogus name and we set OutputFile to a small file (our manifest).
-	// We do this so we don't have to add more conditionals to base_rules.mk
-	// soong_java_prebult has the same issue for .jars so use this in both module types.
-	entries.SetString("LOCAL_MODULE_STEM", fmt.Sprintf("UNUSED-%s", *m.Base))
-	entries.SetString("LOCAL_MODULE_TAGS", "tests")
-}
-
 func (m *testModuleConfigModule) AndroidMkEntries() []android.AndroidMkEntries {
-	appClass := m.provider.MkAppClass
-	include := m.provider.MkInclude
+	appClass := "APPS"
+	include := "$(BUILD_SYSTEM)/soong_app_prebuilt.mk"
+	if m.isHost {
+		appClass = "JAVA_LIBRARIES"
+		include = "$(BUILD_SYSTEM)/soong_java_prebuilt.mk"
+	}
 	return []android.AndroidMkEntries{{
 		Class:      appClass,
 		OutputFile: android.OptionalPathForPath(m.manifest),
@@ -246,6 +231,7 @@
 		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
 			func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
 				entries.SetPath("LOCAL_FULL_TEST_CONFIG", m.testConfig)
+				entries.SetString("LOCAL_MODULE_TAGS", "tests")
 				entries.SetString("LOCAL_TEST_MODULE_CONFIG_BASE", *m.Base)
 				if m.provider.LocalSdkVersion != "" {
 					entries.SetString("LOCAL_SDK_VERSION", m.provider.LocalSdkVersion)
@@ -258,11 +244,13 @@
 				entries.AddCompatibilityTestSuites(m.tradefedProperties.Test_suites...)
 				entries.AddStrings("LOCAL_HOST_REQUIRED_MODULES", m.provider.HostRequiredModuleNames...)
 
-				if m.provider.MkAppClass == "NATIVE_TESTS" {
-					m.nativeExtraEntries(entries)
-				} else {
-					m.javaExtraEntries(entries)
-				}
+				// The app_prebuilt_internal.mk files try create a copy of the OutputFile as an .apk.
+				// Normally, this copies the "package.apk" from the intermediate directory here.
+				// To prevent the copy of the large apk and to prevent confusion with the real .apk we
+				// link to, we set the STEM here to a bogus name and we set OutputFile to a small file (our manifest).
+				// We do this so we don't have to add more conditionals to base_rules.mk
+				// soong_java_prebult has the same issue for .jars so use this in both module types.
+				entries.SetString("LOCAL_MODULE_STEM", fmt.Sprintf("UNUSED-%s", *m.Base))
 
 				// In normal java/app modules, the module writes LOCAL_COMPATIBILITY_SUPPORT_FILES
 				// and then base_rules.mk ends up copying each of those dependencies from .intermediates to the install directory.
@@ -369,19 +357,16 @@
 	// FrameworksServicesTests
 	// └── x86_64
 	//    └── FrameworksServicesTests.apk
-	if m.provider.MkAppClass != "NATIVE_TESTS" {
-		symlinkName := fmt.Sprintf("%s/%s", ctx.DeviceConfig().DeviceArch(), baseApk.Base())
-		// Only android_test, not java_host_test puts the output in the DeviceArch dir.
-		if m.provider.IsHost || ctx.DeviceConfig().DeviceArch() == "" {
-			// testcases/CtsDevicePolicyManagerTestCases
-			// ├── CtsDevicePolicyManagerTestCases.jar
-			symlinkName = baseApk.Base()
-		}
-
-		target := installedBaseRelativeToHere(symlinkName, *m.tradefedProperties.Base)
-		installedApk := ctx.InstallAbsoluteSymlink(installDir, symlinkName, target)
-		m.supportFiles = append(m.supportFiles, installedApk)
+	symlinkName := fmt.Sprintf("%s/%s", ctx.DeviceConfig().DeviceArch(), baseApk.Base())
+	// Only android_test, not java_host_test puts the output in the DeviceArch dir.
+	if m.provider.IsHost || ctx.DeviceConfig().DeviceArch() == "" {
+		// testcases/CtsDevicePolicyManagerTestCases
+		// ├── CtsDevicePolicyManagerTestCases.jar
+		symlinkName = baseApk.Base()
 	}
+	target := installedBaseRelativeToHere(symlinkName, *m.tradefedProperties.Base)
+	installedApk := ctx.InstallAbsoluteSymlink(installDir, symlinkName, target)
+	m.supportFiles = append(m.supportFiles, installedApk)
 
 	// 3) Symlink for all data deps
 	// And like this for data files and required modules
@@ -389,7 +374,8 @@
 	// ├── data
 	// │   └── broken_shortcut.xml
 	// ├── JobTestApp.apk
-	for _, symlinkName := range m.provider.TestcaseRelDataFiles {
+	for _, f := range m.provider.InstalledFiles {
+		symlinkName := f.Rel()
 		target := installedBaseRelativeToHere(symlinkName, *m.tradefedProperties.Base)
 		installedPath := ctx.InstallAbsoluteSymlink(installDir, symlinkName, target)
 		m.supportFiles = append(m.supportFiles, installedPath)