Update vendor_api_levels.go with the vintf finalization

vendor_api_levels.go provides corresponding SDK version for vendor
API levels. After the finalization, we will have the next vendor API
level for the trunk_staging build.
We may change the map file when the version is changed later, but
must provide an SDK version for the next vendor API level for the
trunk_staging build.

Ignore-AOSP-First: finalization script is an exception
Bug: 331696132
Test: build/make/tools/finalization/build-step-0.sh
Change-Id: I6788add9e2177cc9d2fc63f54e032f5fc3ecf9b9
diff --git a/tools/finalization/finalize-vintf-resources.sh b/tools/finalization/finalize-vintf-resources.sh
index 6f1a6f6..45efc10 100755
--- a/tools/finalization/finalize-vintf-resources.sh
+++ b/tools/finalization/finalize-vintf-resources.sh
@@ -16,6 +16,13 @@
     export TARGET_RELEASE=fina_0
     export TARGET_PRODUCT=aosp_arm64
 
+    # build/soong
+    local vendor_api_level_map="case ${FINAL_NEXT_BOARD_API_LEVEL}:"
+    if ! grep -q "$vendor_api_level_map" "$top/build/soong/android/vendor_api_levels.go" ; then
+        sed -i -e "/case ${FINAL_BOARD_API_LEVEL}:/{N;a \\\t$vendor_api_level_map\n\t\tsdkVersion = ${FINAL_NEXT_CORRESPONDING_SDK_VERSION}
+        }" "$top/build/soong/android/vendor_api_levels.go"
+    fi
+
     # system/sepolicy
     "$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL"