Merge "Read from new storage in Java codegen" into main
diff --git a/core/Makefile b/core/Makefile
index 5ec5a94..96588e3 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -7863,9 +7863,7 @@
include $(BUILD_SYSTEM)/layoutlib_data.mk
# -----------------------------------------------------------------
-# Desktop pack image hook.
-ifneq (,$(strip $(PACK_DESKTOP_FILESYSTEM_IMAGES)))
-PACK_IMAGE_TARGET := $(PRODUCT_OUT)/android-desktop_image.bin
+# Desktop pack common variables.
PACK_IMAGE_SCRIPT := $(HOST_OUT_EXECUTABLES)/pack_image
IMAGES := $(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_SUPERIMAGE_TARGET) \
@@ -7874,6 +7872,11 @@
$(INSTALLED_VBMETAIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET)
+# -----------------------------------------------------------------
+# Desktop pack image hook.
+ifneq (,$(strip $(PACK_DESKTOP_FILESYSTEM_IMAGES)))
+PACK_IMAGE_TARGET := $(PRODUCT_OUT)/android-desktop_image.bin
+
$(PACK_IMAGE_TARGET): $(IMAGES) $(PACK_IMAGE_SCRIPT)
$(PACK_IMAGE_SCRIPT) --out_dir $(PRODUCT_OUT) --noarchive
@@ -7889,6 +7892,25 @@
endif # PACK_DESKTOP_FILESYSTEM_IMAGES
# -----------------------------------------------------------------
+# Desktop pack recovery image hook.
+ifneq (,$(strip $(PACK_DESKTOP_RECOVERY_IMAGE)))
+PACK_RECOVERY_IMAGE_TARGET := $(PRODUCT_OUT)/android-desktop_recovery_image.bin
+
+$(PACK_RECOVERY_IMAGE_TARGET): $(IMAGES) $(PACK_IMAGE_SCRIPT)
+ $(PACK_IMAGE_SCRIPT) --out_dir $(PRODUCT_OUT) --noarchive --recovery
+
+PACKED_RECOVERY_IMAGE_ARCHIVE_TARGET := $(PACK_RECOVERY_IMAGE_TARGET).gz
+
+$(PACKED_RECOVERY_IMAGE_ARCHIVE_TARGET): $(PACK_RECOVERY_IMAGE_TARGET) | $(GZIP)
+ $(GZIP) -fk $(PACK_RECOVERY_IMAGE_TARGET)
+
+droidcore-unbundled: $(PACKED_RECOVERY_IMAGE_ARCHIVE_TARGET)
+
+$(call dist-for-goals,dist_files,$(PACKED_RECOVERY_IMAGE_ARCHIVE_TARGET))
+
+endif # PACK_DESKTOP_RECOVERY_IMAGE
+
+# -----------------------------------------------------------------
# OS Licensing
include $(BUILD_SYSTEM)/os_licensing.mk
diff --git a/core/main.mk b/core/main.mk
index 8d73793..ac1953b 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1860,75 +1860,8 @@
installed_files := $(apps_only_installed_files)
endif # TARGET_BUILD_APPS
-# sbom-metadata.csv contains all raw data collected in Make for generating SBOM in generate-sbom.py.
-# There are multiple columns and each identifies the source of an installed file for a specific case.
-# The columns and their uses are described as below:
-# installed_file: the file path on device, e.g. /product/app/Browser2/Browser2.apk
-# module_path: the path of the module that generates the installed file, e.g. packages/apps/Browser2
-# soong_module_type: Soong module type, e.g. android_app, cc_binary
-# is_prebuilt_make_module: Y, if the installed file is from a prebuilt Make module, see prebuilt_internal.mk
-# product_copy_files: the installed file is from variable PRODUCT_COPY_FILES, e.g. device/google/cuttlefish/shared/config/init.product.rc:product/etc/init/init.rc
-# kernel_module_copy_files: the installed file is from variable KERNEL_MODULE_COPY_FILES, similar to product_copy_files
-# is_platform_generated: this is an aggregated value including some small cases instead of adding more columns. It is set to Y if any case is Y
-# is_build_prop: build.prop in each partition, see sysprop.mk.
-# is_notice_file: NOTICE.xml.gz in each partition, see Makefile.
-# is_dexpreopt_image_profile: see the usage of DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED in Soong and Make
-# is_product_system_other_avbkey: see INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET
-# is_system_other_odex_marker: see INSTALLED_SYSTEM_OTHER_ODEX_MARKER
-# is_event_log_tags_file: see variable event_log_tags_file in Makefile
-# is_kernel_modules_blocklist: modules.blocklist created for _dlkm partitions, see macro build-image-kernel-modules-dir in Makefile.
-# is_fsverity_build_manifest_apk: BuildManifest<part>.apk files for system and system_ext partition, see ALL_FSVERITY_BUILD_MANIFEST_APK in Makefile.
-# is_linker_config: see SYSTEM_LINKER_CONFIG and vendor_linker_config_file in Makefile.
-# build_output_path: the path of the built file, used to calculate checksum
-# static_libraries/whole_static_libraries: list of module name of the static libraries the file links against, e.g. libclang_rt.builtins or libclang_rt.builtins_32
-# Info of all static libraries of all installed files are collected in variable _all_static_libs that is used to list all the static library files in sbom-metadata.csv.
-# See the second foreach loop in the rule of sbom-metadata.csv for the detailed info of static libraries collected in _all_static_libs.
-# is_static_lib: whether the file is a static library
-
metadata_list := $(OUT_DIR)/.module_paths/METADATA.list
metadata_files := $(subst $(newline),$(space),$(file <$(metadata_list)))
-$(PRODUCT_OUT)/sbom-metadata.csv:
- rm -f $@
- echo 'installed_file,module_path,soong_module_type,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,build_output_path,static_libraries,whole_static_libraries,is_static_lib' >> $@
- $(eval _all_static_libs :=)
- $(foreach f,$(installed_files),\
- $(eval _module_name := $(ALL_INSTALLED_FILES.$f)) \
- $(eval _path_on_device := $(patsubst $(PRODUCT_OUT)/%,%,$f)) \
- $(eval _build_output_path := $(PRODUCT_OUT)/$(_path_on_device)) \
- $(eval _module_path := $(strip $(sort $(ALL_MODULES.$(_module_name).PATH)))) \
- $(eval _soong_module_type := $(strip $(sort $(ALL_MODULES.$(_module_name).SOONG_MODULE_TYPE)))) \
- $(eval _is_prebuilt_make_module := $(ALL_MODULES.$(_module_name).IS_PREBUILT_MAKE_MODULE)) \
- $(eval _product_copy_files := $(sort $(filter %:$(_path_on_device),$(product_copy_files_without_owner)))) \
- $(eval _kernel_module_copy_files := $(sort $(filter %$(_path_on_device),$(KERNEL_MODULE_COPY_FILES)))) \
- $(eval _is_build_prop := $(call is-build-prop,$f)) \
- $(eval _is_notice_file := $(call is-notice-file,$f)) \
- $(eval _is_dexpreopt_image_profile := $(if $(filter %:/$(_path_on_device),$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED)),Y)) \
- $(eval _is_product_system_other_avbkey := $(if $(findstring $f,$(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET)),Y)) \
- $(eval _is_event_log_tags_file := $(if $(findstring $f,$(event_log_tags_file)),Y)) \
- $(eval _is_system_other_odex_marker := $(if $(findstring $f,$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)),Y)) \
- $(eval _is_kernel_modules_blocklist := $(if $(findstring $f,$(ALL_KERNEL_MODULES_BLOCKLIST)),Y)) \
- $(eval _is_fsverity_build_manifest_apk := $(if $(findstring $f,$(ALL_FSVERITY_BUILD_MANIFEST_APK)),Y)) \
- $(eval _is_linker_config := $(if $(findstring $f,$(SYSTEM_LINKER_CONFIG) $(vendor_linker_config_file)),Y)) \
- $(eval _is_partition_compat_symlink := $(if $(findstring $f,$(PARTITION_COMPAT_SYMLINKS)),Y)) \
- $(eval _is_flags_file := $(if $(findstring $f, $(ALL_FLAGS_FILES)),Y)) \
- $(eval _is_rootdir_symlink := $(if $(findstring $f, $(ALL_ROOTDIR_SYMLINKS)),Y)) \
- $(eval _is_platform_generated := $(_is_build_prop)$(_is_notice_file)$(_is_dexpreopt_image_profile)$(_is_product_system_other_avbkey)$(_is_event_log_tags_file)$(_is_system_other_odex_marker)$(_is_kernel_modules_blocklist)$(_is_fsverity_build_manifest_apk)$(_is_linker_config)$(_is_partition_compat_symlink)$(_is_flags_file)$(_is_rootdir_symlink)) \
- $(eval _static_libs := $(ALL_INSTALLED_FILES.$f.STATIC_LIBRARIES)) \
- $(eval _whole_static_libs := $(ALL_INSTALLED_FILES.$f.WHOLE_STATIC_LIBRARIES)) \
- $(foreach l,$(_static_libs),$(eval _all_static_libs += $l:$(strip $(sort $(ALL_MODULES.$l.PATH))):$(strip $(sort $(ALL_MODULES.$l.SOONG_MODULE_TYPE))):$(ALL_STATIC_LIBRARIES.$l.BUILT_FILE))) \
- $(foreach l,$(_whole_static_libs),$(eval _all_static_libs += $l:$(strip $(sort $(ALL_MODULES.$l.PATH))):$(strip $(sort $(ALL_MODULES.$l.SOONG_MODULE_TYPE))):$(ALL_STATIC_LIBRARIES.$l.BUILT_FILE))) \
- echo '/$(_path_on_device),$(_module_path),$(_soong_module_type),$(_is_prebuilt_make_module),$(_product_copy_files),$(_kernel_module_copy_files),$(_is_platform_generated),$(_build_output_path),$(_static_libs),$(_whole_static_libs),' >> $@; \
- )
- $(foreach l,$(sort $(_all_static_libs)), \
- $(eval _lib_stem := $(call word-colon,1,$l)) \
- $(eval _module_path := $(call word-colon,2,$l)) \
- $(eval _soong_module_type := $(call word-colon,3,$l)) \
- $(eval _built_file := $(call word-colon,4,$l)) \
- $(eval _static_libs := $(ALL_STATIC_LIBRARIES.$l.STATIC_LIBRARIES)) \
- $(eval _whole_static_libs := $(ALL_STATIC_LIBRARIES.$l.WHOLE_STATIC_LIBRARIES)) \
- $(eval _is_static_lib := Y) \
- echo '$(_lib_stem).a,$(_module_path),$(_soong_module_type),,,,,$(_built_file),$(_static_libs),$(_whole_static_libs),$(_is_static_lib)' >> $@; \
- )
# Create metadata for compliance support in Soong
.PHONY: make-compliance-metadata
@@ -1988,22 +1921,13 @@
$(SOONG_OUT_DIR)/compliance-metadata/$(TARGET_PRODUCT)/installed_files.stamp: $(installed_files)
touch $@
-# (TODO: b/272358583 find another way of always rebuilding sbom.spdx)
# Remove the always_dirty_file.txt whenever the makefile is evaluated
$(shell rm -f $(PRODUCT_OUT)/always_dirty_file.txt)
$(PRODUCT_OUT)/always_dirty_file.txt:
touch $@
.PHONY: sbom
-ifeq ($(TARGET_BUILD_APPS),)
-sbom: $(PRODUCT_OUT)/sbom.spdx.json
-$(PRODUCT_OUT)/sbom.spdx.json: $(PRODUCT_OUT)/sbom.spdx
-$(PRODUCT_OUT)/sbom.spdx: $(PRODUCT_OUT)/sbom-metadata.csv $(GEN_SBOM) $(installed_files) $(metadata_list) $(metadata_files) $(PRODUCT_OUT)/always_dirty_file.txt
- rm -rf $@
- $(GEN_SBOM) --output_file $@ --metadata $(PRODUCT_OUT)/sbom-metadata.csv --build_version $(BUILD_FINGERPRINT_FROM_FILE) --product_mfr "$(PRODUCT_MANUFACTURER)" --json
-
-$(call dist-for-goals,droid,$(PRODUCT_OUT)/sbom.spdx.json:sbom/sbom.spdx.json)
-else
+ifneq ($(TARGET_BUILD_APPS),)
# Create build rules for generating SBOMs of unbundled APKs and APEXs
# $1: sbom file
# $2: sbom fragment file
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 58234a8..9e8afa8 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -181,3 +181,5 @@
# Copy preopted files from system_b on first boot.
PRODUCT_SYSTEM_PROPERTIES += ro.cp_system_other_odex=1
+PRODUCT_PACKAGES += \
+ cppreopts.sh
diff --git a/tools/aconfig/aconfig_storage_read_api/Android.bp b/tools/aconfig/aconfig_storage_read_api/Android.bp
index 619b488..9e950a6 100644
--- a/tools/aconfig/aconfig_storage_read_api/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/Android.bp
@@ -176,6 +176,7 @@
],
libs: [
"unsupportedappusage",
+ "strict_mode_stub",
],
static_libs: [
"aconfig_storage_file_java",
@@ -196,6 +197,7 @@
],
libs: [
"unsupportedappusage-sdk-none",
+ "fake_device_config",
],
static_libs: [
"aconfig_storage_file_java_none",
diff --git a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageInternalReader.java b/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageInternalReader.java
index f73f35e..71c1c0d 100644
--- a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageInternalReader.java
+++ b/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageInternalReader.java
@@ -17,6 +17,7 @@
package android.aconfig.storage;
import android.compat.annotation.UnsupportedAppUsage;
+import android.os.StrictMode;
import java.io.Closeable;
import java.nio.MappedByteBuffer;
@@ -42,8 +43,10 @@
@UnsupportedAppUsage
public StorageInternalReader(String packageName, String packageMapFile, String flagValueFile) {
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
mPackageTable = PackageTable.fromBytes(mapStorageFile(packageMapFile));
mFlagValueList = FlagValueList.fromBytes(mapStorageFile(flagValueFile));
+ StrictMode.setThreadPolicy(oldPolicy);
mPackageBooleanStartOffset = getPackageBooleanStartOffset(packageName);
}
diff --git a/tools/aconfig/fake_device_config/Android.bp b/tools/aconfig/fake_device_config/Android.bp
index 4566bf9..d6a1f22 100644
--- a/tools/aconfig/fake_device_config/Android.bp
+++ b/tools/aconfig/fake_device_config/Android.bp
@@ -13,10 +13,22 @@
// limitations under the License.
java_library {
- name: "fake_device_config",
- srcs: ["src/**/*.java"],
- sdk_version: "none",
- system_modules: "core-all-system-modules",
- host_supported: true,
+ name: "fake_device_config",
+ srcs: [
+ "src/android/util/Log.java",
+ "src/android/provider/DeviceConfig.java",
+ "src/android/os/StrictMode.java",
+ ],
+ sdk_version: "none",
+ system_modules: "core-all-system-modules",
+ host_supported: true,
}
+java_library {
+ name: "strict_mode_stub",
+ srcs: [
+ "src/android/os/StrictMode.java",
+ ],
+ sdk_version: "core_current",
+ host_supported: true,
+}
diff --git a/tools/aconfig/fake_device_config/src/android/os/StrictMode.java b/tools/aconfig/fake_device_config/src/android/os/StrictMode.java
new file mode 100644
index 0000000..6416252
--- /dev/null
+++ b/tools/aconfig/fake_device_config/src/android/os/StrictMode.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+public class StrictMode {
+ public static ThreadPolicy allowThreadDiskReads() {
+ throw new UnsupportedOperationException("Stub!");
+ }
+
+ public static void setThreadPolicy(final ThreadPolicy policy) {
+ throw new UnsupportedOperationException("Stub!");
+ }
+
+ public static final class ThreadPolicy {}
+}
diff --git a/tools/aconfig/fake_device_config/src/android/provider/Log.java b/tools/aconfig/fake_device_config/src/android/util/Log.java
similarity index 100%
rename from tools/aconfig/fake_device_config/src/android/provider/Log.java
rename to tools/aconfig/fake_device_config/src/android/util/Log.java