Finalization script, step 1.

- cleanup
- revert previous commits
- vndk + resources + sdk finalization + test
- create cls
- send to Gerrit
- (tbd) submit

Bug: 243966946
Test: run scripts locally

Change-Id: Icd4f07c64c2ef93831dc5fc7de2d5e832604e88d
diff --git a/finalize_branch_for_release.sh b/finalize_branch_for_release.sh
index ce90ac0..c5114fe 100755
--- a/finalize_branch_for_release.sh
+++ b/finalize_branch_for_release.sh
@@ -27,9 +27,25 @@
     $m check-vndk-list || \
         { cp $top/out/soong/vndk/vndk.libraries.txt $top/build/make/target/product/gsi/current.txt; }
 
+    # Finalize resources
+    "$top/frameworks/base/tools/aapt2/tools/finalize_res.py" \
+           "$top/frameworks/base/core/res/res/values/public-staging.xml" \
+           "$top/frameworks/base/core/res/res/values/public-final.xml"
+
+    # SDK finalization
+    local sdk_codename='public static final int UPSIDE_DOWN_CAKE = CUR_DEVELOPMENT;'
+    local sdk_version='public static final int UPSIDE_DOWN_CAKE = 34;'
+    local sdk_build="$top/frameworks/base/core/java/android/os/Build.java"
+
+    sed -i "s%$sdk_codename%$sdk_version%g" $sdk_build
+
+    # Update the current.txt
+    $m update-api
+
     # This command tests:
     #   The release state for AIDL.
     #   ABI difference between user and userdebug builds.
+    #   Resource/SDK finalization.
     # In the future, we would want to actually turn the branch into the REL
     # state and test with that.
     AIDL_FROZEN_REL=true $m droidcore
@@ -40,3 +56,4 @@
 }
 
 finalize_main
+