Add extra dependency from apex to bootclasspath fragments to modules

An extra dependency from apex modules to their bootclasspath fragments
and from bootclasspath fragments to their contents is necessary, as the
existing one with bcpfTag return false from ReplaceSourceWithPrebuilt
to never rewrite the dependency to the prebuilt fragment, and we'll
need a dependency to the prebuilt fragment in the next CL.

Bug: 372543712
Test: all soong tests pass
Change-Id: I87ff3afa0d5c90936664dd493654f1d64230b8a9
diff --git a/android/apex.go b/android/apex.go
index a5ccd52..4917149 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -891,3 +891,21 @@
 	// to generate the mainline module prebuilt.
 	Prebuilt_info_file_path string `json:",omitempty"`
 }
+
+// FragmentInApexTag is embedded into a dependency tag to allow apex modules to annotate
+// their fragments in a way that allows the java bootclasspath modules to traverse from
+// the apex to the fragment.
+type FragmentInApexTag struct{}
+
+func (FragmentInApexTag) isFragmentInApexTag() {}
+
+type isFragmentInApexTagIntf interface {
+	isFragmentInApexTag()
+}
+
+// IsFragmentInApexTag returns true if the dependency tag embeds FragmentInApexTag,
+// signifying that it is a dependency from an apex module to its fragment.
+func IsFragmentInApexTag(tag blueprint.DependencyTag) bool {
+	_, ok := tag.(isFragmentInApexTagIntf)
+	return ok
+}