Revert "Add scripts to generate java APIs used by Mainline modules."

This reverts commit c92380f001ce938cf329509491fc3c757ee58a53.

Reason for revert:
DroidMonitor:

DroidMonitor-triggered revert due to breakage
https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=mainline_modules_arm64-userdebug&lkgb=7898389&lkbb=7900541&fkbb=7898474,
bug 205746850

Change-Id: Ibd84dfe68dfe150b7e05b4287364d1946375bf72
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 17b2849..94b8116 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -446,18 +446,23 @@
 					fmt.Fprintf(w, dist)
 				}
 
-				distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisUsedByModuleFile.String())
-				distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisBackedByModuleFile.String())
-				distCoverageFiles(w, "java_apis_used_by_apex", a.javaApisUsedByModuleFile.String())
+				if a.apisUsedByModuleFile.String() != "" {
+					goal := "apps_only"
+					distFile := a.apisUsedByModuleFile.String()
+					fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
+						" $(call dist-for-goals,%s,%s:ndk_apis_usedby_apex/$(notdir %s))\n"+
+						"endif\n",
+						goal, distFile, distFile)
+				}
+
+				if a.apisBackedByModuleFile.String() != "" {
+					goal := "apps_only"
+					distFile := a.apisBackedByModuleFile.String()
+					fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
+						" $(call dist-for-goals,%s,%s:ndk_apis_backedby_apex/$(notdir %s))\n"+
+						"endif\n",
+						goal, distFile, distFile)
+				}
 			}
 		}}
 }
-
-func distCoverageFiles(w io.Writer, dir string, distfile string) {
-	if distfile != "" {
-		goal := "apps_only"
-		fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
-			" $(call dist-for-goals,%s,%s:%s/$(notdir %s))\n"+
-			"endif\n", goal, distfile, dir, distfile)
-	}
-}
diff --git a/apex/apex.go b/apex/apex.go
index 20660d3..33188cb 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -424,9 +424,8 @@
 	isCompressed bool
 
 	// Path of API coverage generate file
-	nativeApisUsedByModuleFile   android.ModuleOutPath
-	nativeApisBackedByModuleFile android.ModuleOutPath
-	javaApisUsedByModuleFile     android.ModuleOutPath
+	apisUsedByModuleFile   android.ModuleOutPath
+	apisBackedByModuleFile android.ModuleOutPath
 
 	// Collect the module directory for IDE info in java/jdeps.go.
 	modulePaths []string
diff --git a/apex/builder.go b/apex/builder.go
index 2e21ddf..e22d694 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -67,7 +67,6 @@
 	pctx.HostBinToolVariable("sload_f2fs", "sload_f2fs")
 	pctx.HostBinToolVariable("make_erofs", "make_erofs")
 	pctx.HostBinToolVariable("apex_compression_tool", "apex_compression_tool")
-	pctx.HostBinToolVariable("dexdeps", "dexdeps")
 	pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
 }
 
@@ -708,12 +707,12 @@
 				"readelf":   "${config.ClangBin}/llvm-readelf",
 			},
 		})
-		a.nativeApisUsedByModuleFile = apisUsedbyOutputFile
+		a.apisUsedByModuleFile = apisUsedbyOutputFile
 
-		var nativeLibNames []string
+		var libNames []string
 		for _, f := range a.filesInfo {
 			if f.class == nativeSharedLib {
-				nativeLibNames = append(nativeLibNames, f.stem())
+				libNames = append(libNames, f.stem())
 			}
 		}
 		apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
@@ -721,25 +720,9 @@
 		rule.Command().
 			Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
 			Output(apisBackedbyOutputFile).
-			Flags(nativeLibNames)
+			Flags(libNames)
 		rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
-		a.nativeApisBackedByModuleFile = apisBackedbyOutputFile
-
-		var javaLibOrApkPath []android.Path
-		for _, f := range a.filesInfo {
-			if f.class == javaSharedLib || f.class == app {
-				javaLibOrApkPath = append(javaLibOrApkPath, f.builtFile)
-			}
-		}
-		javaApiUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.xml")
-		javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
-		javaUsedByRule.Command().
-			Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
-			BuiltTool("dexdeps").
-			Output(javaApiUsedbyOutputFile).
-			Inputs(javaLibOrApkPath)
-		javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
-		a.javaApisUsedByModuleFile = javaApiUsedbyOutputFile
+		a.apisBackedByModuleFile = apisBackedbyOutputFile
 
 		bundleConfig := a.buildBundleConfig(ctx)
 
diff --git a/apex/testing.go b/apex/testing.go
index 337c862..69bd73e 100644
--- a/apex/testing.go
+++ b/apex/testing.go
@@ -24,7 +24,6 @@
 	android.MockFS{
 		// Needed by apex.
 		"system/core/rootdir/etc/public.libraries.android.txt": nil,
-		"build/soong/scripts/gen_java_usedby_apex.sh":          nil,
 		"build/soong/scripts/gen_ndk_backedby_apex.sh":         nil,
 		// Needed by prebuilt_apex.
 		"build/soong/scripts/unpack-prebuilt-apex.sh": nil,