Split finalization scripts between vFRC and sFRC.

This splits out the AIDL/VNDK/sepolicy stuff from the SDK
finalization. However, in CI, we still do the vFRC step
as part of the first step.

We'll probably want to do some of the following:
- (maybe) add CI for the first step - a 'fina-0' branch
- add a way to do SDK finalizatoin without VINTF finalization
  because after VINTF finalization is submitted, people will
  develop in-progress interfaces that aren't done yet
- a lot of VINTF finalization is still not automated, so things
  like sepolicy and LL-NDK need to be added here.

Ignore-AOSP-First: b/304316873#comment10

Bug: 314010935
Test: N/A
Change-Id: I4831a14f5c5c3d757bd1d10a775d8cf4940d9a4a
diff --git a/tools/finalization/finalize-vintf-resources.sh b/tools/finalization/finalize-vintf-resources.sh
new file mode 100755
index 0000000..d150db3
--- /dev/null
+++ b/tools/finalization/finalize-vintf-resources.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -ex
+
+function finalize_vintf_resources() {
+    local top="$(dirname "$0")"/../../../..
+    source $top/build/make/tools/finalization/environment.sh
+
+    # TODO(b/314010764): finalize LL_NDK
+    # TODO(b/314010177): finalize SELinux
+
+    # pre-finalization build target (trunk)
+    local aidl_m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=trunk TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist"
+    AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api
+
+    # build/make
+    sed -i -e "s/sepolicy_major_vers := .*/sepolicy_major_vers := ${FINAL_PLATFORM_SDK_VERSION}/g" "$top/build/make/core/config.mk"
+    cp "$top/build/make/target/product/gsi/current.txt" "$top/build/make/target/product/gsi/$FINAL_PLATFORM_SDK_VERSION.txt"
+}
+
+finalize_vintf_resources
+