Modify Soong to utilize from-text android.jar in build

Context
- from-text android.jar files are built using Metalava, and these can be
  utilized in `decodeSdkDep` so that any modules that depends on APIs
  can be compiled using from-text android.jars
- This change removes dependency on source java files when compiling
  stub android.jar files

Implementation
- Modify java_api_library module to create system modules using the
  generated android.jar
- Replace modules in decodeSdkDep to link against java_api_library
  modules
- Add --build-from-text-stub flag to hide the feature behind a flag

Test: m --build-from-text-stub
Bug: 271154441
Change-Id: I104df595edc65c0006820d5ae5b15f1fb167e190
diff --git a/java/androidmk.go b/java/androidmk.go
index a4dac80..148d7c2 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -733,3 +733,22 @@
 		},
 	}
 }
+
+func (al *ApiLibrary) AndroidMkEntries() []android.AndroidMkEntries {
+	var entriesList []android.AndroidMkEntries
+
+	entriesList = append(entriesList, android.AndroidMkEntries{
+		Class:      "JAVA_LIBRARIES",
+		OutputFile: android.OptionalPathForPath(al.stubsJar),
+		Include:    "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
+		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+			func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
+				entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
+				entries.SetPath("LOCAL_SOONG_CLASSES_JAR", al.stubsJar)
+				entries.SetPath("LOCAL_SOONG_HEADER_JAR", al.stubsJar)
+			},
+		},
+	})
+
+	return entriesList
+}