Move frameworks/base off the SRC_API_DIR variable.

This directory is going away. Migrate to the new paths, and replace the
long list of "since" arguments with a loop in the makefile. Also fix the
soong buildfile to use the new path and the 28 prebuilts.

This removes the need to update it every time an API is finalized (in make,
I don't know how to make loops in soong).

Bug: 77525052
Test: Verified variable is the same before & after, except for path change
Change-Id: I1d4e87e7840e979b83779a2aefe176e7c1ed1527
diff --git a/Android.bp b/Android.bp
index a6290f1..add6117 100644
--- a/Android.bp
+++ b/Android.bp
@@ -944,34 +944,34 @@
      "-hidePackage com.android.okhttp " +
      "-hidePackage com.android.org.conscrypt " +
      "-hidePackage com.android.server " +
-     "-since $(location api/1.xml) 1 " +
-     "-since $(location api/2.xml) 2 " +
-     "-since $(location api/3.xml) 3 " +
-     "-since $(location api/4.xml) 4 " +
-     "-since $(location api/5.xml) 5 " +
-     "-since $(location api/6.xml) 6 " +
-     "-since $(location api/7.xml) 7 " +
-     "-since $(location api/8.xml) 8 " +
-     "-since $(location api/9.xml) 9 " +
-     "-since $(location api/10.xml) 10 " +
-     "-since $(location api/11.xml) 11 " +
-     "-since $(location api/12.xml) 12 " +
-     "-since $(location api/13.xml) 13 " +
-     "-since $(location api/14.txt) 14 " +
-     "-since $(location api/15.txt) 15 " +
-     "-since $(location api/16.txt) 16 " +
-     "-since $(location api/17.txt) 17 " +
-     "-since $(location api/18.txt) 18 " +
-     "-since $(location api/19.txt) 19 " +
-     "-since $(location api/20.txt) 20 " +
-     "-since $(location api/21.txt) 21 " +
-     "-since $(location api/22.txt) 22 " +
-     "-since $(location api/23.txt) 23 " +
-     "-since $(location api/24.txt) 24 " +
-     "-since $(location api/25.txt) 25 " +
-     "-since $(location api/26.txt) 26 " +
-     "-since $(location api/27.txt) 27 " +
-     "-since $(location api/current.txt) P " +
+     "-since $(location 1/public/api/android.xml) 1 " +
+     "-since $(location 2/public/api/android.xml) 2 " +
+     "-since $(location 3/public/api/android.xml) 3 " +
+     "-since $(location 4/public/api/android.xml) 4 " +
+     "-since $(location 5/public/api/android.xml) 5 " +
+     "-since $(location 6/public/api/android.xml) 6 " +
+     "-since $(location 7/public/api/android.xml) 7 " +
+     "-since $(location 8/public/api/android.xml) 8 " +
+     "-since $(location 9/public/api/android.xml) 9 " +
+     "-since $(location 10/public/api/android.xml) 10 " +
+     "-since $(location 11/public/api/android.xml) 11 " +
+     "-since $(location 12/public/api/android.xml) 12 " +
+     "-since $(location 13/public/api/android.xml) 13 " +
+     "-since $(location 14/public/api/android.txt) 14 " +
+     "-since $(location 15/public/api/android.txt) 15 " +
+     "-since $(location 16/public/api/android.txt) 16 " +
+     "-since $(location 17/public/api/android.txt) 17 " +
+     "-since $(location 18/public/api/android.txt) 18 " +
+     "-since $(location 19/public/api/android.txt) 19 " +
+     "-since $(location 20/public/api/android.txt) 20 " +
+     "-since $(location 21/public/api/android.txt) 21 " +
+     "-since $(location 22/public/api/android.txt) 22 " +
+     "-since $(location 23/public/api/android.txt) 23 " +
+     "-since $(location 24/public/api/android.txt) 24 " +
+     "-since $(location 25/public/api/android.txt) 25 " +
+     "-since $(location 26/public/api/android.txt) 26 " +
+     "-since $(location 27/public/api/android.txt) 27 " +
+     "-since $(location 28/public/api/android.txt) 28 " +
      "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
      "-overview $(location core/java/overview.html) " +
      // Federate Support Library references against local API file.
diff --git a/Android.mk b/Android.mk
index 11fc52e..5a2e79d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -168,37 +168,25 @@
     -hidePackage com.android.internal.util \
     -hidePackage com.android.okhttp \
     -hidePackage com.android.org.conscrypt \
-    -hidePackage com.android.server \
-    -since $(SRC_API_DIR)/1.xml 1 \
-    -since $(SRC_API_DIR)/2.xml 2 \
-    -since $(SRC_API_DIR)/3.xml 3 \
-    -since $(SRC_API_DIR)/4.xml 4 \
-    -since $(SRC_API_DIR)/5.xml 5 \
-    -since $(SRC_API_DIR)/6.xml 6 \
-    -since $(SRC_API_DIR)/7.xml 7 \
-    -since $(SRC_API_DIR)/8.xml 8 \
-    -since $(SRC_API_DIR)/9.xml 9 \
-    -since $(SRC_API_DIR)/10.xml 10 \
-    -since $(SRC_API_DIR)/11.xml 11 \
-    -since $(SRC_API_DIR)/12.xml 12 \
-    -since $(SRC_API_DIR)/13.xml 13 \
-    -since $(SRC_API_DIR)/14.txt 14 \
-    -since $(SRC_API_DIR)/15.txt 15 \
-    -since $(SRC_API_DIR)/16.txt 16 \
-    -since $(SRC_API_DIR)/17.txt 17 \
-    -since $(SRC_API_DIR)/18.txt 18 \
-    -since $(SRC_API_DIR)/19.txt 19 \
-    -since $(SRC_API_DIR)/20.txt 20 \
-    -since $(SRC_API_DIR)/21.txt 21 \
-    -since $(SRC_API_DIR)/22.txt 22 \
-    -since $(SRC_API_DIR)/23.txt 23 \
-    -since $(SRC_API_DIR)/24.txt 24 \
-    -since $(SRC_API_DIR)/25.txt 25 \
-    -since $(SRC_API_DIR)/26.txt 26 \
-    -since $(SRC_API_DIR)/27.txt 27 \
-    -since $(SRC_API_DIR)/28.txt 28 \
+    -hidePackage com.android.server
+
+# Convert an sdk level to a "since" argument.
+since-arg = -since $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(1)/public/api/android.*) $(1)
+
+finalized_sdks := $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/public/api/android.xml,%,\
+    $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/public/api/android.xml))
+finalized_sdks += $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/public/api/android.txt,%,\
+    $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/public/api/android.txt))
+finalized_sdks := $(call numerically_sort,$(finalized_sdks))
+
+framework_docs_LOCAL_DROIDDOC_OPTIONS += $(foreach sdk,$(finalized_sdks),$(call since-arg,$(sdk)))
+ifneq ($(PLATFORM_VERSION_CODENAME),REL)
+  framework_docs_LOCAL_DROIDDOC_OPTIONS += \
+      -since ./frameworks/base/api/current.txt $(PLATFORM_VERSION_CODENAME)
+endif
+framework_docs_LOCAL_DROIDDOC_OPTIONS += \
     -werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 \
-    -overview $(LOCAL_PATH)/core/java/overview.html \
+    -overview $(LOCAL_PATH)/core/java/overview.html
 
 framework_docs_LOCAL_API_CHECK_ADDITIONAL_JAVA_DIR:= \
 	$(call intermediates-dir-for,JAVA_LIBRARIES,framework,,COMMON)