Merge "Allow installing fake vendor packages" into main
diff --git a/cogsetup.sh b/cogsetup.sh
index 02fcc8f..3005d58 100644
--- a/cogsetup.sh
+++ b/cogsetup.sh
@@ -39,22 +39,25 @@
# non-cog part of the overall filesystem. This is to workaround the problem
# described in b/289391270.
function _copy_reclient_binaries_from_cog() {
- local NONCOG_RECLIENT_BIN_DIR="${HOME}/.cog/reclient/bin"
- if [ ! -d "$NONCOG_RECLIENT_BIN_DIR" ]; then
- # Create the non cog directory if it doesn't exist.
- mkdir -p ${NONCOG_RECLIENT_BIN_DIR}
- else
- # Clear out the non cog directory if it does exist.
- rm -f ${NONCOG_RECLIENT_BIN_DIR}/*
+ if [[ "${OUT_DIR}" == "" ]]; then
+ OUT_DIR="out"
+ fi
+ local RECLIENT_VERSION=`readlink prebuilts/remoteexecution-client/live`
+
+ local NONCOG_RECLIENT_BIN_DIR_BASE="${OUT_DIR}/.reclient"
+ local NONCOG_RECLIENT_BIN_DIR="${NONCOG_RECLIENT_BIN_DIR_BASE}/${RECLIENT_VERSION}"
+
+ # Create the non cog directory and setup live symlink.
+ mkdir -p ${NONCOG_RECLIENT_BIN_DIR}
+
+ if [ `ls ${NONCOG_RECLIENT_BIN_DIR} | wc -l` -lt 8 ]; then
+ # Not all binaries exist, copy them from the Cog directory.
+ local TOP=$(gettop)
+ cp ${TOP}/prebuilts/remoteexecution-client/live/* ${NONCOG_RECLIENT_BIN_DIR}
fi
- local TOP=$(gettop)
-
- # Copy the binaries out of live.
- cp $TOP/prebuilts/remoteexecution-client/live/* $NONCOG_RECLIENT_BIN_DIR
-
- # Finally set the RBE_DIR env var to point to the out-of-cog directory.
- export RBE_DIR=$NONCOG_RECLIENT_BIN_DIR
+ ln -sfn ${RECLIENT_VERSION} ${NONCOG_RECLIENT_BIN_DIR_BASE}/live
+ export RBE_DIR="${NONCOG_RECLIENT_BIN_DIR_BASE}/live"
}
# This function sets up the build environment to be appropriate for Cog.
diff --git a/core/soong_config.mk b/core/soong_config.mk
index b172ec2..d50ba8e 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -40,7 +40,9 @@
$(call add_json_str, Platform_base_os, $(PLATFORM_BASE_OS))
$(call add_json_str, Platform_version_last_stable, $(PLATFORM_VERSION_LAST_STABLE))
$(call add_json_str, Platform_version_known_codenames, $(PLATFORM_VERSION_KNOWN_CODENAMES))
+
$(call add_json_bool, Release_aidl_use_unfrozen, $(RELEASE_AIDL_USE_UNFROZEN))
+$(call add_json_bool, Release_expose_flagged_api, $(RELEASE_EXPOSE_FLAGGED_API))
$(call add_json_str, Platform_min_supported_target_sdk_version, $(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION))
diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk
index b15df28..4ec5520 100644
--- a/core/tasks/tools/package-modules.mk
+++ b/core/tasks/tools/package-modules.mk
@@ -106,6 +106,7 @@
$(hide) $(foreach f, $(PRIVATE_PICKUP_FILES),\
cp -RfL $(f) $(PRIVATE_STAGING_DIR) && ) true
$(hide) cd $(PRIVATE_STAGING_DIR) && zip -rqX ../$(notdir $@) *
+ rm -rf $(PRIVATE_STAGING_DIR)
my_makefile :=
my_staging_dir :=
diff --git a/target/product/gsi/Android.bp b/target/product/gsi/Android.bp
index a8af9c4..45ba143 100644
--- a/target/product/gsi/Android.bp
+++ b/target/product/gsi/Android.bp
@@ -23,3 +23,26 @@
"*.txt",
],
}
+
+prebuilt_etc {
+ name: "gsi_skip_mount.cfg",
+ filename: "skip_mount.cfg",
+ src: "gsi_skip_mount.cfg",
+
+ system_ext_specific: true,
+ relative_install_path: "init/config",
+
+ required: ["gsi_skip_mount_compat_symlink"],
+}
+
+// Adds a symlink under /system/etc/init/config pointing to /system/system_ext/etc/init/config
+// because first-stage init in Android 10.0 will read the skip_mount.cfg from /system/etc/* after
+// chroot /system.
+// TODO: remove this symlink when no need to support new GSI on Android 10.
+// The actual file needs to be under /system/system_ext because it's GSI-specific and does not
+// belong to core CSI.
+install_symlink {
+ name: "gsi_skip_mount_compat_symlink",
+ installed_location: "etc/init/config",
+ symlink_target: "/system/system_ext/etc/init/config",
+}
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 563712a..70ee78d 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -240,32 +240,6 @@
include $(BUILD_PHONY_PACKAGE)
#####################################################################
-# skip_mount.cfg, read by init to skip mounting some partitions when GSI is used.
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := gsi_skip_mount.cfg
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_STEM := skip_mount.cfg
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-LOCAL_MODULE_CLASS := ETC
-LOCAL_SYSTEM_EXT_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := init/config
-
-# Adds a symlink under /system/etc/init/config pointing to /system/system_ext/etc/init/config
-# because first-stage init in Android 10.0 will read the skip_mount.cfg from /system/etc/* after
-# chroot /system.
-# TODO: remove this symlink when no need to support new GSI on Android 10.
-# The actual file needs to be under /system/system_ext because it's GSI-specific and does not
-# belong to core CSI.
-LOCAL_POST_INSTALL_CMD := \
- mkdir -p $(TARGET_OUT)/etc/init; \
- ln -sf /system/system_ext/etc/init/config $(TARGET_OUT)/etc/init/config
-
-include $(BUILD_PREBUILT)
-
-#####################################################################
# init.gsi.rc, GSI-specific init script.
include $(CLEAR_VARS)
diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk
index bd85b9f..23eb534 100644
--- a/target/product/gsi_release.mk
+++ b/target/product/gsi_release.mk
@@ -28,9 +28,8 @@
BUILDING_GSI := true
-# Exclude all files under system/product and system/system_ext,
-# and the vndk apex's compat symlinks
PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \
+ system/etc/init/config \
system/product/% \
system/system_ext/% \
system/lib/vndk-29 \
diff --git a/tools/aconfig/src/codegen_java.rs b/tools/aconfig/src/codegen_java.rs
index 702ef22..c4fc405 100644
--- a/tools/aconfig/src/codegen_java.rs
+++ b/tools/aconfig/src/codegen_java.rs
@@ -214,12 +214,12 @@
return value;
}
private Map<String, Boolean> mFlagMap = new HashMap<>(
- Map.of(
- Flags.FLAG_DISABLED_RO, false,
- Flags.FLAG_DISABLED_RW, false,
- Flags.FLAG_ENABLED_FIXED_RO, false,
- Flags.FLAG_ENABLED_RO, false,
- Flags.FLAG_ENABLED_RW, false
+ Map.ofEntries(
+ Map.entry(Flags.FLAG_DISABLED_RO, false),
+ Map.entry(Flags.FLAG_DISABLED_RW, false),
+ Map.entry(Flags.FLAG_ENABLED_FIXED_RO, false),
+ Map.entry(Flags.FLAG_ENABLED_RO, false),
+ Map.entry(Flags.FLAG_ENABLED_RW, false)
)
);
}
diff --git a/tools/aconfig/templates/FakeFeatureFlagsImpl.java.template b/tools/aconfig/templates/FakeFeatureFlagsImpl.java.template
index e4a1fb7..d2cea95 100644
--- a/tools/aconfig/templates/FakeFeatureFlagsImpl.java.template
+++ b/tools/aconfig/templates/FakeFeatureFlagsImpl.java.template
@@ -37,9 +37,10 @@
}
private Map<String, Boolean> mFlagMap = new HashMap<>(
- Map.of(
+ Map.ofEntries(
{{-for item in class_elements}}
- Flags.FLAG_{item.flag_name_constant_suffix}, false{{ if not @last }},{{ endif }}
+ Map.entry(Flags.FLAG_{item.flag_name_constant_suffix}, false)
+ {{ -if not @last }},{{ endif }}
{{ -endfor }}
)
);
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a3daca5..c5a3fe7 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -20,7 +20,6 @@
import datetime
import errno
import fnmatch
-from genericpath import isdir
import getopt
import getpass
import gzip
@@ -34,12 +33,13 @@
import shlex
import shutil
import subprocess
-import sys
import stat
+import sys
import tempfile
import threading
import time
import zipfile
+from genericpath import isdir
from hashlib import sha1, sha256
import images
@@ -112,13 +112,18 @@
# descriptor into vbmeta.img. When adding a new entry here, the
# AVB_FOOTER_ARGS_BY_PARTITION in sign_target_files_apks need to be updated
# accordingly.
-AVB_PARTITIONS = ('boot', 'init_boot', 'dtbo', 'odm', 'product', 'pvmfw', 'recovery',
- 'system', 'system_ext', 'vendor', 'vendor_boot', 'vendor_kernel_boot',
- 'vendor_dlkm', 'odm_dlkm', 'system_dlkm')
+AVB_PARTITIONS = ('boot', 'init_boot', 'dtbo', 'odm', 'product', 'pvmfw',
+ 'recovery', 'system', 'system_ext', 'vendor', 'vendor_boot',
+ 'vendor_kernel_boot', 'vendor_dlkm', 'odm_dlkm',
+ 'system_dlkm')
# Chained VBMeta partitions.
AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor')
+# avbtool arguments name
+AVB_ARG_NAME_INCLUDE_DESC_FROM_IMG = '--include_descriptors_from_image'
+AVB_ARG_NAME_CHAIN_PARTITION = '--chain_partition'
+
# Partitions that should have their care_map added to META/care_map.pb
PARTITIONS_WITH_CARE_MAP = [
'system',
@@ -1467,7 +1472,7 @@
# Check if chain partition is used.
key_path = info_dict.get("avb_" + partition + "_key_path")
if not key_path:
- return ["--include_descriptors_from_image", image]
+ return [AVB_ARG_NAME_INCLUDE_DESC_FROM_IMG, image]
# For a non-A/B device, we don't chain /recovery nor include its descriptor
# into vbmeta.img. The recovery image will be configured on an independent
@@ -1479,7 +1484,7 @@
# Otherwise chain the partition into vbmeta.
chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict)
- return ["--chain_partition", chained_partition_arg]
+ return [AVB_ARG_NAME_CHAIN_PARTITION, chained_partition_arg]
def GetAvbChainedPartitionArg(partition, info_dict, key=None):
@@ -1598,7 +1603,7 @@
# same location when running this script (we have the input target_files
# zip only). For such cases, we additionally scan other locations (e.g.
# IMAGES/, RADIO/, etc) before bailing out.
- if arg == '--include_descriptors_from_image':
+ if arg == AVB_ARG_NAME_INCLUDE_DESC_FROM_IMG:
chained_image = split_args[index + 1]
if os.path.exists(chained_image):
continue
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index c69a13d..2bd4f36 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -1585,7 +1585,8 @@
info_dict = {}
cmd = common.GetAvbPartitionArg('system', '/path/to/system.img', info_dict)
self.assertEqual(
- ['--include_descriptors_from_image', '/path/to/system.img'], cmd)
+ [common.AVB_ARG_NAME_INCLUDE_DESC_FROM_IMG, '/path/to/system.img'],
+ cmd)
@test_utils.SkipIfExternalToolsUnavailable()
def test_AppendVBMetaArgsForPartition_vendorAsChainedPartition(self):
@@ -1598,7 +1599,7 @@
}
cmd = common.GetAvbPartitionArg('vendor', '/path/to/vendor.img', info_dict)
self.assertEqual(2, len(cmd))
- self.assertEqual('--chain_partition', cmd[0])
+ self.assertEqual(common.AVB_ARG_NAME_CHAIN_PARTITION, cmd[0])
chained_partition_args = cmd[1].split(':')
self.assertEqual(3, len(chained_partition_args))
self.assertEqual('vendor', chained_partition_args[0])
@@ -1631,7 +1632,7 @@
cmd = common.GetAvbPartitionArg(
'recovery', '/path/to/recovery.img', info_dict)
self.assertEqual(2, len(cmd))
- self.assertEqual('--chain_partition', cmd[0])
+ self.assertEqual(common.AVB_ARG_NAME_CHAIN_PARTITION, cmd[0])
chained_partition_args = cmd[1].split(':')
self.assertEqual(3, len(chained_partition_args))
self.assertEqual('recovery', chained_partition_args[0])