Split APEX ABI dumps from implementation ABI dumps

This commit adds a rule that builds APEX ABI dumps separately from the
implementation libraries' ABI dumps. The rule takes the
export_include_dirs and the symbol_file of the stubs as parameters.
The dump paths are tagged with "APEX" in lsdump_paths.txt. The script
updating the prebuilt reference dumps can differentiate the APEX dumps
from the opt-in dumps tagged with "PLATFORM".

This commit also adds an ABI diff rule. Soong compares the APEX ABI
dumps with the reference dumps in version 35. It compares the
implementation dumps with the reference dumps in old versions.

Bug: 333532038
Test: make
Change-Id: I76902a8e3b7d0e96a5ad756f493924371cd7ad3c
diff --git a/cc/sabi.go b/cc/sabi.go
index ef43c8d..cd9bf63 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -29,6 +29,7 @@
 type lsdumpTag string
 
 const (
+	apexLsdumpTag     lsdumpTag = "APEX"
 	llndkLsdumpTag    lsdumpTag = "LLNDK"
 	ndkLsdumpTag      lsdumpTag = "NDK"
 	platformLsdumpTag lsdumpTag = "PLATFORM"
@@ -39,6 +40,8 @@
 // Return the prebuilt ABI dump directory for a tag; an empty string for an opt-in dump.
 func (tag *lsdumpTag) dirName() string {
 	switch *tag {
+	case apexLsdumpTag:
+		return "platform"
 	case ndkLsdumpTag:
 		return "ndk"
 	case llndkLsdumpTag:
@@ -134,11 +137,13 @@
 		if m.isImplementationForLLNDKPublic() {
 			result = append(result, llndkLsdumpTag)
 		}
-		// Return NDK if the library is both NDK and APEX.
-		// TODO(b/309880485): Split NDK and APEX ABI.
 		if m.IsNdk(ctx.Config()) {
 			result = append(result, ndkLsdumpTag)
-		} else if m.library.hasStubsVariants() || headerAbiChecker.enabled() {
+		}
+		// APEX and opt-in platform dumps are placed in the same directory.
+		if m.library.hasStubsVariants() {
+			result = append(result, apexLsdumpTag)
+		} else if headerAbiChecker.enabled() {
 			result = append(result, platformLsdumpTag)
 		}
 	} else if headerAbiChecker.enabled() {