Define step-0 for vintf finalization

Define `vintf` state that have completed vintf finalization only.
Only if FINAL_STATE is 'unfinalized' run the vintf finalization
process to finalize vintf.
The new step-0 only runs the vintf finalization.

Ignore-AOSP-First: trunk-stable changes (b/304316873)

Bug: 318883690
Test: build-step-0.sh && build/soong/soong_ui.bash \
    --make-mode TARGET_PRODUCT=cf_x86_64_phone TARGET_RELEASE=fina_0 \
    TARGET_BUILD_VARIANT=userdebug droid dist
Change-Id: If3525f38204fa546744b9ccf8dc9e63711823abd
diff --git a/tools/finalization/step-0.sh b/tools/finalization/step-0.sh
new file mode 100755
index 0000000..e61c644
--- /dev/null
+++ b/tools/finalization/step-0.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Copyright 2024 Google Inc. All rights reserved.
+
+# Script to perform a 0th step of Android Finalization: VINTF finalization, create CLs and upload to Gerrit.
+
+set -ex
+
+function commit_step_0_changes() {
+    set +e
+    repo forall -c '\
+        if [[ $(git status --short) ]]; then
+            repo start "VINTF-$FINAL_BOARD_API_LEVEL-Finalization" ;
+            git add -A . ;
+            git commit -m "Vendor API level $FINAL_BOARD_API_LEVEL is now frozen" \
+                       -m "Ignore-AOSP-First: VINTF $FINAL_BOARD_API_LEVEL Finalization
+Bug: $FINAL_BUG_ID
+Test: build";
+            repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+        fi'
+}
+
+function finalize_step_0_main() {
+    local top="$(dirname "$0")"/../../../..
+    source $top/build/make/tools/finalization/environment.sh
+
+    local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+
+    source $top/build/make/tools/finalization/finalize-vintf-resources.sh
+
+    # move all changes to finalization branch/topic and upload to gerrit
+    commit_step_0_changes
+
+    # build to confirm everything is OK
+    AIDL_FROZEN_REL=true $m
+}
+
+finalize_step_0_main