Finalization bugfixes.

- keep previous platform versions in platform_releases.txt,
- fix for the build version test,
- after discussion with Yuri, keep non-REL resource sdk_int the same.

Bug: 323940469
Test: local run
Ignore-AOSP-First: release configs present in internal repo only
Change-Id: I6637e109191480ded615ef35c9185d927ddaec40
This commit is contained in:
Alex Buynytskyy
2024-03-11 18:14:52 +00:00
parent f85c0c6433
commit 4fb99d85e6
6 changed files with 16 additions and 76 deletions

View File

@@ -8,12 +8,6 @@ function revert_droidstubs_hack() {
fi fi
} }
function revert_resources_sdk_int_fix() {
if grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then
patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.revert_resource_sdk_int.diff
fi
}
function apply_prerelease_sdk_hack() { function apply_prerelease_sdk_hack() {
if ! grep -q 'STOPSHIP: hack for the pre-release SDK' "$top/frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java" ; then if ! grep -q 'STOPSHIP: hack for the pre-release SDK' "$top/frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java" ; then
patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.apply_hack.diff patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.apply_hack.diff
@@ -30,9 +24,6 @@ function finalize_sdk_rel() {
# let the apps built with pre-release SDK parse # let the apps built with pre-release SDK parse
apply_prerelease_sdk_hack apply_prerelease_sdk_hack
# in REL mode, resources would correctly set the resources_sdk_int, no fix required
revert_resources_sdk_int_fix
# cts # cts
echo "$FINAL_PLATFORM_VERSION" > "$top/cts/tests/tests/os/assets/platform_versions.txt" echo "$FINAL_PLATFORM_VERSION" > "$top/cts/tests/tests/os/assets/platform_versions.txt"
if [ "$FINAL_PLATFORM_CODENAME" != "$CURRENT_PLATFORM_CODENAME" ]; then if [ "$FINAL_PLATFORM_CODENAME" != "$CURRENT_PLATFORM_CODENAME" ]; then

View File

@@ -9,13 +9,6 @@ function apply_droidstubs_hack() {
fi fi
} }
function apply_resources_sdk_int_fix() {
if ! grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then
local base_git_root="$(readlink -f $top/frameworks/base)"
patch --strip=1 --no-backup-if-mismatch --directory="$base_git_root" --input=../../build/make/tools/finalization/frameworks_base.apply_resource_sdk_int.diff
fi
}
function finalize_bionic_ndk() { function finalize_bionic_ndk() {
# Adding __ANDROID_API_<>__. # Adding __ANDROID_API_<>__.
# If this hasn't done then it's not used and not really needed. Still, let's check and add this. # If this hasn't done then it's not used and not really needed. Still, let's check and add this.
@@ -129,8 +122,12 @@ function finalize_sdk_resources() {
fi fi
# cts # cts
echo ${FINAL_PLATFORM_VERSION} > "$top/cts/tests/tests/os/assets/platform_releases.txt" if ! grep -q "${FINAL_PLATFORM_VERSION}" "$top/cts/tests/tests/os/assets/platform_releases.txt" ; then
sed -i -e "s/EXPECTED_SDK = $((${FINAL_PLATFORM_SDK_VERSION}-1))/EXPECTED_SDK = ${FINAL_PLATFORM_SDK_VERSION}/g" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java" echo ${FINAL_PLATFORM_VERSION} >> "$top/cts/tests/tests/os/assets/platform_releases.txt"
fi
if ! grep -q "$((${FINAL_PLATFORM_SDK_VERSION}-1)), ${FINAL_PLATFORM_VERSION}" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java" ; then
sed -i -e "s/.*EXPECTED_SDKS = List.of(.*$((${FINAL_PLATFORM_SDK_VERSION}-1))/&, $FINAL_PLATFORM_SDK_VERSION/" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java"
fi
# libcore # libcore
sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/libcore/dalvik/src/main/java/dalvik/annotation/compat/VersionCodes.java" sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/libcore/dalvik/src/main/java/dalvik/annotation/compat/VersionCodes.java"
@@ -153,7 +150,6 @@ function finalize_sdk_resources() {
# frameworks/base # frameworks/base
sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/frameworks/base/core/java/android/os/Build.java" sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/frameworks/base/core/java/android/os/Build.java"
apply_resources_sdk_int_fix
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt/SdkConstants.h" sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt/SdkConstants.h"
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt2/SdkConstants.h" sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt2/SdkConstants.h"

View File

@@ -1,24 +0,0 @@
From cdb47fc90b8d6860ec1dc5efada1f9ccd471618b Mon Sep 17 00:00:00 2001
From: Alex Buynytskyy <alexbuy@google.com>
Date: Tue, 11 Apr 2023 22:12:44 +0000
Subject: [PATCH] Don't force +1 for resource resolution.
Bug: 277674088
Fixes: 277674088
Test: boots, no crashes
Change-Id: I17e743a0f1cf6f98fddd40c358dea5a8b9cc7723
---
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index eb47170..4d3e92b 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -493,7 +493,7 @@
* @hide
*/
@TestApi
- public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
+ public static final int RESOURCES_SDK_INT = SDK_INT;
/**
* The current lowest supported value of app target SDK. Applications targeting

View File

@@ -1,27 +0,0 @@
From c7e460bb19071d867cd7ca04282ce42694f4f358 Mon Sep 17 00:00:00 2001
From: Alex Buynytskyy <alexbuy@google.com>
Date: Wed, 12 Apr 2023 01:06:26 +0000
Subject: [PATCH] Revert "Don't force +1 for resource resolution."
It's not required for master.
This reverts commit f1cb683988f81579a76ddbf9993848a4a06dd28c.
Bug: 277674088
Test: boots, no crashes
Change-Id: Ia1692548f26496fdc6f1e4f0557213c7996d6823
---
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 4d3e92b..eb47170 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -493,7 +493,7 @@
* @hide
*/
@TestApi
- public static final int RESOURCES_SDK_INT = SDK_INT;
+ public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
/**
* The current lowest supported value of app target SDK. Applications targeting

View File

@@ -21,15 +21,17 @@ function finalize_step_1_main() {
local top="$(dirname "$0")"/../../../.. local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh 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-sdk-resources.sh source $top/build/make/tools/finalization/finalize-sdk-resources.sh
# move all changes to finalization branch/topic and upload to gerrit # move all changes to finalization branch/topic and upload to gerrit
commit_step_1_changes commit_step_1_changes
# build to confirm everything is OK # build to confirm everything is OK
AIDL_FROZEN_REL=true $m local m_next="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
AIDL_FROZEN_REL=true $m_next
local m_fina="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=fina_1 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
AIDL_FROZEN_REL=true $m_fina
} }
finalize_step_1_main finalize_step_1_main

View File

@@ -19,8 +19,6 @@ function finalize_step_2_main() {
local top="$(dirname "$0")"/../../../.. local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh 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"
# prebuilts etc # prebuilts etc
source $top/build/make/tools/finalization/finalize-sdk-rel.sh source $top/build/make/tools/finalization/finalize-sdk-rel.sh
@@ -28,7 +26,11 @@ function finalize_step_2_main() {
commit_step_2_changes commit_step_2_changes
# build to confirm everything is OK # build to confirm everything is OK
AIDL_FROZEN_REL=true $m local m_next="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
AIDL_FROZEN_REL=true $m_next
local m_fina="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=fina_2 TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
AIDL_FROZEN_REL=true $m_fina
} }
finalize_step_2_main finalize_step_2_main