Merge "Fix problem of RepackApexPayload when using option --signing_args" into main
diff --git a/core/Makefile b/core/Makefile
index 1e7e3f2..d2e712e 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -717,7 +717,7 @@
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-charger-load,$(kmd))) \
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-kernel-ramdisk-charger-load,$(kmd))) \
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(if $(filter true,$(BOARD_USES_ODM_DLKMIMAGE)),$(TARGET_OUT_ODM_DLKM),$(TARGET_OUT_ODM)),odm,modules.load,,$(kmd))) \
- $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,SYSTEM,$(if $(filter true,$(BOARD_USES_SYSTEM_DLKMIMAGE)),$(TARGET_OUT_SYSTEM_DLKM),$(TARGET_OUT_SYSTEM)),system,modules.load,,$(kmd))) \
+ $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,SYSTEM,$(if $(filter true,$(BOARD_USES_SYSTEM_DLKMIMAGE)),$(TARGET_OUT_SYSTEM_DLKM),$(TARGET_OUT)),system,modules.load,,$(kmd))) \
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(kmd))),\
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,$(GENERIC_RAMDISK_STRIPPED_MODULE_STAGING_DIR),$(kmd)))))
@@ -1267,9 +1267,8 @@
endif
-
+# The value of RAMDISK_NODE_LIST is defined in system/core/rootdir/Android.bp.
# This file contains /dev nodes description added to the generic ramdisk
-RAMDISK_NODE_LIST := $(PRODUCT_OUT)/ramdisk_node_list
# We just build this directly to the install location.
INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
@@ -5136,6 +5135,7 @@
$(TARGET_OUT)/apex/% \
$(TARGET_OUT_SYSTEM_EXT)/apex/% \
$(TARGET_OUT_VENDOR)/apex/% \
+ $(TARGET_OUT_ODM)/apex/% \
$(TARGET_OUT_PRODUCT)/apex/% \
apex_files := $(sort $(filter $(apex_dirs), $(INTERNAL_ALLIMAGES_FILES)))
@@ -5188,6 +5188,7 @@
$(TARGET_OUT_PRODUCT)/apex/% \
$(TARGET_OUT_SYSTEM_EXT)/apex/% \
$(TARGET_OUT_VENDOR)/apex/% \
+ $(TARGET_OUT_ODM)/apex/% \
apex_files := $(sort $(filter $(apex_dirs), $(INTERNAL_ALLIMAGES_FILES)))
@@ -5206,6 +5207,7 @@
--system_ext_path $(TARGET_OUT_SYSTEM_EXT) \
--product_path $(TARGET_OUT_PRODUCT) \
--vendor_path $(TARGET_OUT_VENDOR) \
+ --odm_path $(TARGET_OUT_ODM) \
--apex_path $(APEX_OUT)
apex_files :=
@@ -7886,7 +7888,7 @@
$(call dist-for-goals,haiku-presubmit,$(SOONG_PRESUBMIT_FUZZ_PACKAGING_ARCH_MODULES))
# -----------------------------------------------------------------
-# Extract platform fonts used in Layoutlib
+# Extract additional data files used in Layoutlib
include $(BUILD_SYSTEM)/layoutlib_data.mk
# -----------------------------------------------------------------
@@ -7912,10 +7914,11 @@
$(PACKED_IMAGE_ARCHIVE_TARGET): $(PACK_IMAGE_TARGET) | $(GZIP)
$(GZIP) -fk $(PACK_IMAGE_TARGET)
-droidcore-unbundled: $(PACKED_IMAGE_ARCHIVE_TARGET)
-
$(call dist-for-goals,dist_files,$(PACKED_IMAGE_ARCHIVE_TARGET))
+.PHONY: pack-image
+pack-image: $(PACK_IMAGE_TARGET)
+
endif # PACK_DESKTOP_FILESYSTEM_IMAGES
# -----------------------------------------------------------------
@@ -7931,10 +7934,11 @@
$(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))
+.PHONY: pack-recovery-image
+pack-recovery-image: $(PACK_RECOVERY_IMAGE_TARGET)
+
endif # PACK_DESKTOP_RECOVERY_IMAGE
# -----------------------------------------------------------------
diff --git a/core/layoutlib_data.mk b/core/layoutlib_data.mk
index e45f7ef..e420a00 100644
--- a/core/layoutlib_data.mk
+++ b/core/layoutlib_data.mk
@@ -66,11 +66,19 @@
# Resource files from frameworks/base/core/res/res
LAYOUTLIB_RES := $(call intermediates-dir-for,PACKAGING,layoutlib-res,HOST,COMMON)
LAYOUTLIB_RES_FILES := $(shell find frameworks/base/core/res/res -type f -not -path 'frameworks/base/core/res/res/values-m[nc]c*' | sort)
-$(LAYOUTLIB_RES)/layoutlib-res.zip: $(SOONG_ZIP) $(HOST_OUT_EXECUTABLES)/aapt2 $(LAYOUTLIB_RES_FILES)
+EMULATED_OVERLAYS_FILES := $(shell find frameworks/base/packages/overlays/*/res/ | sort)
+DEVICE_OVERLAYS_FILES := $(shell find device/generic/goldfish/phone/overlay/frameworks/base/packages/overlays/*/AndroidOverlay/res/ | sort)
+$(LAYOUTLIB_RES)/layoutlib-res.zip: $(SOONG_ZIP) $(HOST_OUT_EXECUTABLES)/aapt2 $(LAYOUTLIB_RES_FILES) $(EMULATED_OVERLAYS_FILES) $(DEVICE_OVERLAYS_FILES)
rm -rf $@
- echo $(LAYOUTLIB_RES_FILES) > $(LAYOUTLIB_RES)/filelist.txt
- $(SOONG_ZIP) -C frameworks/base/core/res -l $(LAYOUTLIB_RES)/filelist.txt -o $(LAYOUTLIB_RES)/temp.zip
- rm -rf $(LAYOUTLIB_RES)/data && unzip -q -d $(LAYOUTLIB_RES)/data $(LAYOUTLIB_RES)/temp.zip
+ echo $(LAYOUTLIB_RES_FILES) > $(LAYOUTLIB_RES)/filelist_res.txt
+ $(SOONG_ZIP) -C frameworks/base/core/res -l $(LAYOUTLIB_RES)/filelist_res.txt -o $(LAYOUTLIB_RES)/temp_res.zip
+ echo $(EMULATED_OVERLAYS_FILES) > $(LAYOUTLIB_RES)/filelist_emulated_overlays.txt
+ $(SOONG_ZIP) -C frameworks/base/packages -l $(LAYOUTLIB_RES)/filelist_emulated_overlays.txt -o $(LAYOUTLIB_RES)/temp_emulated_overlays.zip
+ echo $(DEVICE_OVERLAYS_FILES) > $(LAYOUTLIB_RES)/filelist_device_overlays.txt
+ $(SOONG_ZIP) -C device/generic/goldfish/phone/overlay/frameworks/base/packages -l $(LAYOUTLIB_RES)/filelist_device_overlays.txt -o $(LAYOUTLIB_RES)/temp_device_overlays.zip
+ rm -rf $(LAYOUTLIB_RES)/data && unzip -q -d $(LAYOUTLIB_RES)/data $(LAYOUTLIB_RES)/temp_res.zip
+ unzip -q -d $(LAYOUTLIB_RES)/data $(LAYOUTLIB_RES)/temp_emulated_overlays.zip
+ unzip -q -d $(LAYOUTLIB_RES)/data $(LAYOUTLIB_RES)/temp_device_overlays.zip
rm -rf $(LAYOUTLIB_RES)/compiled && mkdir $(LAYOUTLIB_RES)/compiled && $(HOST_OUT_EXECUTABLES)/aapt2 compile $(LAYOUTLIB_RES)/data/res/**/*.9.png -o $(LAYOUTLIB_RES)/compiled
printf '<?xml version="1.0" encoding="utf-8"?>\n<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.layoutlib" />' > $(LAYOUTLIB_RES)/AndroidManifest.xml
$(HOST_OUT_EXECUTABLES)/aapt2 link -R $(LAYOUTLIB_RES)/compiled/* -o $(LAYOUTLIB_RES)/compiled.apk --manifest $(LAYOUTLIB_RES)/AndroidManifest.xml
@@ -78,7 +86,7 @@
for f in $(LAYOUTLIB_RES)/compiled_apk/res/*; do mv "$$f" "$${f/-v4/}";done
for f in $(LAYOUTLIB_RES)/compiled_apk/res/**/*.9.png; do mv "$$f" "$${f/.9.png/.compiled.9.png}";done
cp -r $(LAYOUTLIB_RES)/compiled_apk/res $(LAYOUTLIB_RES)/data
- $(SOONG_ZIP) -C $(LAYOUTLIB_RES)/data -D $(LAYOUTLIB_RES)/data/res -o $@
+ $(SOONG_ZIP) -C $(LAYOUTLIB_RES)/data -D $(LAYOUTLIB_RES)/data/ -o $@
$(call dist-for-goals,layoutlib,$(LAYOUTLIB_RES)/layoutlib-res.zip:layoutlib_native/res.zip)
@@ -132,16 +140,26 @@
echo $(_path),,,,,,Y,$f,,, >> $@; \
)
+ $(foreach f,$(EMULATED_OVERLAYS_FILES), \
+ $(eval _path := $(subst frameworks/base/packages,data,$f)) \
+ echo $(_path),,,,,,Y,$f,,, >> $@; \
+ )
+
+ $(foreach f,$(DEVICE_OVERLAYS_FILES), \
+ $(eval _path := $(subst device/generic/goldfish/phone/overlay/frameworks/base/packages,data,$f)) \
+ echo $(_path),,,,,,Y,$f,,, >> $@; \
+ )
+
.PHONY: layoutlib-sbom
layoutlib-sbom: $(LAYOUTLIB_SBOM)/layoutlib.spdx.json
-$(LAYOUTLIB_SBOM)/layoutlib.spdx.json: $(PRODUCT_OUT)/always_dirty_file.txt $(GEN_SBOM) $(LAYOUTLIB_SBOM)/sbom-metadata.csv $(_layoutlib_font_config_files) $(_layoutlib_fonts_files) $(LAYOUTLIB_BUILD_PROP)/layoutlib-build.prop $(_layoutlib_keyboard_files) $(LAYOUTLIB_RES_FILES)
+$(LAYOUTLIB_SBOM)/layoutlib.spdx.json: $(PRODUCT_OUT)/always_dirty_file.txt $(GEN_SBOM) $(LAYOUTLIB_SBOM)/sbom-metadata.csv $(_layoutlib_font_config_files) $(_layoutlib_fonts_files) $(LAYOUTLIB_BUILD_PROP)/layoutlib-build.prop $(_layoutlib_keyboard_files) $(LAYOUTLIB_RES_FILES) $(EMULATED_OVERLAYS_FILES) $(DEVICE_OVERLAYS_FILES)
rm -rf $@
$(GEN_SBOM) --output_file $@ --metadata $(LAYOUTLIB_SBOM)/sbom-metadata.csv --build_version $(BUILD_FINGERPRINT_FROM_FILE) --product_mfr "$(PRODUCT_MANUFACTURER)" --module_name "layoutlib" --json
$(call dist-for-goals,layoutlib,$(LAYOUTLIB_SBOM)/layoutlib.spdx.json:layoutlib_native/sbom/layoutlib.spdx.json)
# Generate SBOM of framework_res.jar that is created in release_layoutlib.sh.
-# The generated SBOM contains placeholders for release_layotlib.sh to substitute, and the placeholders include:
+# The generated SBOM contains placeholders for release_layoutlib.sh to substitute, and the placeholders include:
# document name, document namespace, document creation info, organization and SHA1 value of framework_res.jar.
GEN_SBOM_FRAMEWORK_RES := $(HOST_OUT_EXECUTABLES)/generate-sbom-framework_res
.PHONY: layoutlib-framework_res-sbom
diff --git a/core/product_config.rbc b/core/product_config.rbc
index 59e2c95..20344f4 100644
--- a/core/product_config.rbc
+++ b/core/product_config.rbc
@@ -382,6 +382,11 @@
_soong_config_namespace(g, nsname)
g[_soong_config_namespaces_key][nsname][var]=_mkstrip(value)
+def _soong_config_set_bool(g, nsname, var, value):
+ """Assigns the value to the variable in the namespace, and marks it as a boolean."""
+ _soong_config_set(g, nsname, var, _filter("true", value))
+ g["SOONG_CONFIG_TYPE_%s_%s" % (nsname, var)] = "bool"
+
def _soong_config_append(g, nsname, var, value):
"""Appends to the value of the variable in the namespace."""
_soong_config_namespace(g, nsname)
@@ -861,6 +866,7 @@
soong_config_namespace = _soong_config_namespace,
soong_config_append = _soong_config_append,
soong_config_set = _soong_config_set,
+ soong_config_set_bool = _soong_config_set_bool,
soong_config_get = _soong_config_get,
abspath = _abspath,
add_product_dex_preopt_module_config = _add_product_dex_preopt_module_config,
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 797b14c..5769c06 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -206,6 +206,7 @@
$(call add_json_str, BoardSepolicyVers, $(BOARD_SEPOLICY_VERS))
$(call add_json_str, SystemExtSepolicyPrebuiltApiDir, $(BOARD_SYSTEM_EXT_PREBUILT_DIR))
$(call add_json_str, ProductSepolicyPrebuiltApiDir, $(BOARD_PRODUCT_PREBUILT_DIR))
+$(call add_json_str, BoardPlatform, $(TARGET_BOARD_PLATFORM))
$(call add_json_str, PlatformSepolicyVersion, $(PLATFORM_SEPOLICY_VERSION))
$(call add_json_list, PlatformSepolicyCompatVersions, $(PLATFORM_SEPOLICY_COMPAT_VERSIONS))
diff --git a/core/tasks/art-host-tests.mk b/core/tasks/art-host-tests.mk
index c95f6e7..eb54fae 100644
--- a/core/tasks/art-host-tests.mk
+++ b/core/tasks/art-host-tests.mk
@@ -47,21 +47,16 @@
$(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list; \
done
- grep $(TARGET_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/target.list || true
$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host.list \
- -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target.list \
-P host/testcases -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list \
-sha256
grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list > $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list || true
- grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list > $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list || true
$(hide) $(SOONG_ZIP) -d -o $(PRIVATE_art_host_tests_configs_zip) \
- -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list \
- -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list
+ -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list
grep $(HOST_OUT) $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list > $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list || true
$(hide) $(SOONG_ZIP) -d -o $(PRIVATE_art_host_tests_host_shared_libs_zip) \
-P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list
grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_INTERMEDIATES_DIR)/art-host-tests_list
- grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_INTERMEDIATES_DIR)/art-host-tests_list
$(hide) $(SOONG_ZIP) -d -o $(PRIVATE_art_host_tests_list_zip) -C $(PRIVATE_INTERMEDIATES_DIR) -f $(PRIVATE_INTERMEDIATES_DIR)/art-host-tests_list
art-host-tests: $(art_host_tests_zip)
diff --git a/target/product/large_screen_common.mk b/target/product/large_screen_common.mk
new file mode 100644
index 0000000..3eb9ff0
--- /dev/null
+++ b/target/product/large_screen_common.mk
@@ -0,0 +1,21 @@
+# 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.
+#
+
+# Window Extensions
+$(call inherit-product, $(SRC_TARGET_DIR)/product/window_extensions.mk)
+
+# Enable Settings 2-pane optimization for large-screen
+PRODUCT_SYSTEM_PROPERTIES += \
+ persist.settings.large_screen_opt.enabled=true
diff --git a/teams/Android.bp b/teams/Android.bp
index a9699d2..94585fc 100644
--- a/teams/Android.bp
+++ b/teams/Android.bp
@@ -4414,8 +4414,29 @@
}
team {
+ name: "trendy_team_android_media_solutions_playback",
+
+ // go/trendy/manage/engineers/6742515252559872
+ trendy_team_id: "6742515252559872",
+}
+
+team {
name: "trendy_team_android_telemetry_client_infra",
// go/trendy/manage/engineers/5403245077430272
trendy_team_id: "5403245077430272",
}
+
+team {
+ name: "trendy_team_pte_sysui",
+
+ // go/trendy/manage/engineers/5185897463382016
+ trendy_team_id: "5185897463382016",
+}
+
+team {
+ name: "trendy_team_pixel_troubleshooting_app",
+
+ // go/trendy/manage/engineers/5097003746426880
+ trendy_team_id: "5097003746426880",
+}
diff --git a/tools/aconfig/aconfig_device_paths/Android.bp b/tools/aconfig/aconfig_device_paths/Android.bp
index 2d943de..95cecf4 100644
--- a/tools/aconfig/aconfig_device_paths/Android.bp
+++ b/tools/aconfig/aconfig_device_paths/Android.bp
@@ -39,8 +39,8 @@
genrule {
name: "libaconfig_java_device_paths_src",
- srcs: ["src/DevicePathsTemplate.java"],
- out: ["DevicePaths.java"],
+ srcs: ["src/DeviceProtosTemplate.java"],
+ out: ["DeviceProtos.java"],
tool_files: ["partition_aconfig_flags_paths.txt"],
cmd: "sed -e '/TEMPLATE/{r$(location partition_aconfig_flags_paths.txt)' -e 'd}' $(in) > $(out)",
}
@@ -48,5 +48,7 @@
java_library {
name: "aconfig_device_paths_java",
srcs: [":libaconfig_java_device_paths_src"],
- sdk_version: "core_current",
+ static_libs: [
+ "libaconfig_java_proto_nano",
+ ],
}
diff --git a/tools/aconfig/aconfig_device_paths/src/DevicePathsTemplate.java b/tools/aconfig/aconfig_device_paths/src/DeviceProtosTemplate.java
similarity index 62%
rename from tools/aconfig/aconfig_device_paths/src/DevicePathsTemplate.java
rename to tools/aconfig/aconfig_device_paths/src/DeviceProtosTemplate.java
index 16355a3..58c58de 100644
--- a/tools/aconfig/aconfig_device_paths/src/DevicePathsTemplate.java
+++ b/tools/aconfig/aconfig_device_paths/src/DeviceProtosTemplate.java
@@ -15,7 +15,12 @@
*/
package android.aconfig;
+import android.aconfig.nano.Aconfig.parsed_flag;
+import android.aconfig.nano.Aconfig.parsed_flags;
+
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -23,7 +28,7 @@
/**
* @hide
*/
-public class DevicePaths {
+public class DeviceProtos {
static final String[] PATHS = {
TEMPLATE
};
@@ -31,12 +36,35 @@
private static final String APEX_DIR = "/apex";
private static final String APEX_ACONFIG_PATH_SUFFIX = "/etc/aconfig_flags.pb";
+ /**
+ * Returns a list of all on-device aconfig protos.
+ *
+ * May throw an exception if the protos can't be read at the call site. For
+ * example, some of the protos are in the apex/ partition, which is mounted
+ * somewhat late in the boot process.
+ *
+ * @throws IOException if we can't read one of the protos yet
+ * @return a list of all on-device aconfig protos
+ */
+ public static List<parsed_flag> loadAndParseFlagProtos() throws IOException {
+ ArrayList<parsed_flag> result = new ArrayList();
+
+ for (String path : parsedFlagsProtoPaths()) {
+ FileInputStream inputStream = new FileInputStream(path);
+ parsed_flags parsedFlags = parsed_flags.parseFrom(inputStream.readAllBytes());
+ for (parsed_flag flag : parsedFlags.parsedFlag) {
+ result.add(flag);
+ }
+ }
+
+ return result;
+ }
/**
* Returns the list of all on-device aconfig protos paths.
* @hide
*/
- public static List<String> parsedFlagsProtoPaths() {
+ private static List<String> parsedFlagsProtoPaths() {
ArrayList<String> paths = new ArrayList(Arrays.asList(PATHS));
File apexDirectory = new File(APEX_DIR);
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index 9b134f2..cf7e2ae 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -96,6 +96,7 @@
],
libs: [
"apex_manifest",
+ "releasetools_apex_utils",
"releasetools_common",
],
required: [
@@ -107,7 +108,7 @@
python_library_host {
name: "ota_metadata_proto",
srcs: [
- "ota_metadata.proto",
+ "ota_metadata.proto",
],
proto: {
canonical_path_from_root: false,
@@ -117,7 +118,7 @@
cc_library_static {
name: "ota_metadata_proto_cc",
srcs: [
- "ota_metadata.proto",
+ "ota_metadata.proto",
],
host_supported: true,
recovery_available: true,
@@ -144,7 +145,7 @@
static_libs: ["libprotobuf-java-nano"],
},
},
- visibility: ["//frameworks/base:__subpackages__"]
+ visibility: ["//frameworks/base:__subpackages__"],
}
python_defaults {
@@ -436,7 +437,7 @@
name: "check_target_files_vintf",
defaults: [
"releasetools_binary_defaults",
- "releasetools_check_target_files_vintf_defaults"
+ "releasetools_check_target_files_vintf_defaults",
],
}
@@ -546,13 +547,14 @@
defaults: ["releasetools_binary_defaults"],
srcs: [
"sign_target_files_apks.py",
- "payload_signer.py",
- "ota_signing_utils.py",
+ "ota_from_raw_img.py",
],
libs: [
"releasetools_add_img_to_target_files",
"releasetools_apex_utils",
"releasetools_common",
+ "ota_metadata_proto",
+ "ota_utils_lib",
],
}
@@ -632,7 +634,7 @@
data: [
"testdata/**/*",
":com.android.apex.compressed.v1",
- ":com.android.apex.vendor.foo.with_vintf"
+ ":com.android.apex.vendor.foo.with_vintf",
],
target: {
darwin: {
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 1b0b89a..73f36c7 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -36,6 +36,8 @@
APEX_PUBKEY = 'apex_pubkey'
+# Partitions supporting APEXes
+PARTITIONS = ['system', 'system_ext', 'product', 'vendor', 'odm']
class ApexInfoError(Exception):
"""An Exception raised during Apex Information command."""
@@ -550,7 +552,7 @@
if not isinstance(input_file, str):
raise RuntimeError("must pass filepath to target-files zip or directory")
apex_infos = []
- for partition in ['system', 'system_ext', 'product', 'vendor']:
+ for partition in PARTITIONS:
apex_infos.extend(GetApexInfoForPartition(input_file, partition))
return apex_infos
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index b8dcd84..dc123ef 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -30,6 +30,7 @@
import sys
import zipfile
+import apex_utils
import common
from apex_manifest import ParseApexManifest
@@ -229,7 +230,7 @@
apex_host = os.path.join(OPTIONS.search_path, 'bin', 'apexd_host')
cmd = [apex_host, '--tool_path', OPTIONS.search_path]
cmd += ['--apex_path', dirmap['/apex']]
- for p in ['system', 'system_ext', 'product', 'vendor']:
+ for p in apex_utils.PARTITIONS:
if '/' + p in dirmap:
cmd += ['--' + p + '_path', dirmap['/' + p]]
common.RunAndCheckOutput(cmd)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 5d942b5..edd4366 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -898,7 +898,7 @@
if key.endswith("selinux_fc"):
fc_basename = os.path.basename(d[key])
fc_config = os.path.join(input_file, "META", fc_basename)
- assert os.path.exists(fc_config)
+ assert os.path.exists(fc_config), "{} does not exist".format(fc_config)
d[key] = fc_config
@@ -3008,7 +3008,7 @@
zipfile.ZIP64_LIMIT = saved_zip64_limit
-def ZipWriteStr(zip_file, zinfo_or_arcname, data, perms=None,
+def ZipWriteStr(zip_file: zipfile.ZipFile, zinfo_or_arcname, data, perms=None,
compress_type=None):
"""Wrap zipfile.writestr() function to work around the zip64 limit.
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index b8f848f..b485440 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -189,6 +189,8 @@
from xml.etree import ElementTree
import add_img_to_target_files
+import ota_from_raw_img
+import ota_utils
import apex_utils
import common
import payload_signer
@@ -579,7 +581,61 @@
filename.endswith("/prop.default")
-def ProcessTargetFiles(input_tf_zip: zipfile.ZipFile, output_tf_zip, misc_info,
+def RegenerateKernelPartitions(input_tf_zip: zipfile.ZipFile, output_tf_zip: zipfile.ZipFile, misc_info):
+ """Re-generate boot and dtbo partitions using new signing configuration"""
+ if OPTIONS.input_tmp is None:
+ OPTIONS.input_tmp = common.UnzipTemp(input_tf_zip.filename, [
+ "*/boot.img", "*/dtbo.img"])
+ else:
+ common.UnzipToDir(input_tf_zip, OPTIONS.input_tmp, [
+ "*/boot.img", "*/dtbo.img"])
+ unzip_dir = OPTIONS.input_tmp
+ image_dir = os.path.join(unzip_dir, "IMAGES")
+ shutil.rmtree(image_dir)
+ os.makedirs(image_dir, exist_ok=True)
+
+ boot_image = common.GetBootableImage(
+ "IMAGES/boot.img", "boot.img", unzip_dir, "BOOT", misc_info)
+ if boot_image:
+ boot_image.WriteToDir(unzip_dir)
+ boot_image = os.path.join(unzip_dir, boot_image.name)
+ common.ZipWrite(output_tf_zip, boot_image, "IMAGES/boot.img",
+ compress_type=zipfile.ZIP_STORED)
+ add_img_to_target_files.AddDtbo(output_tf_zip)
+ return unzip_dir
+
+
+def RegenerateBootOTA(input_tf_zip: zipfile.ZipFile, output_tf_zip: zipfile.ZipFile, misc_info, filename, input_ota):
+ if filename not in ["VENDOR/boot_otas/boot_ota_4k.zip", "SYSTEM/boot_otas/boot_ota_4k.zip"]:
+ # We only need to re-generate 4K boot OTA, for other OTA packages
+ # simply copy as is
+ with input_tf_zip.open(filename, "r") as in_fp:
+ shutil.copyfileobj(in_fp, input_ota)
+ input_ota.flush()
+ return
+ timestamp = misc_info["build.prop"].GetProp(
+ "ro.system.build.date.utc")
+ unzip_dir = RegenerateKernelPartitions(
+ input_tf_zip, output_tf_zip, misc_info)
+ signed_boot_image = os.path.join(unzip_dir, "IMAGES/boot.img")
+ signed_dtbo_image = os.path.join(unzip_dir, "IMAGES/dtbo.img")
+
+ if not os.path.exists(signed_boot_image):
+ logger.warn("Need to re-generate boot OTA {} but failed to get signed boot image. 16K dev option will be impacted, after rolling back to 4K user would need to sideload/flash their device to continue receiving OTAs.")
+ return
+ logger.info(
+ "Re-generating boot OTA {} with timestamp {}".format(filename, timestamp))
+ args = ["ota_from_raw_img", "--package_key", OPTIONS.package_key,
+ "--max_timestamp", timestamp, "--output", input_ota.name]
+ if os.path.exists(signed_dtbo_image):
+ args.extend(["--partition_name", "boot,dtbo",
+ signed_boot_image, signed_dtbo_image])
+ else:
+ args.extend(["--partition_name", "boot", signed_boot_image])
+ ota_from_raw_img.main(args)
+
+
+def ProcessTargetFiles(input_tf_zip: zipfile.ZipFile, output_tf_zip: zipfile.ZipFile, misc_info,
apk_keys, apex_keys, key_passwords,
platform_api_level, codename_to_api_level_map,
compressed_extension):
@@ -593,6 +649,14 @@
# Sets this to zero for targets without APK files.
maxsize = 0
+ # Replace the AVB signing keys, if any.
+ ReplaceAvbSigningKeys(misc_info)
+ OPTIONS.info_dict = misc_info
+
+ # Rewrite the props in AVB signing args.
+ if misc_info.get('avb_enable') == 'true':
+ RewriteAvbProps(misc_info)
+
for info in input_tf_zip.infolist():
filename = info.filename
if filename.startswith("IMAGES/"):
@@ -670,9 +734,9 @@
elif filename.endswith(".zip") and IsEntryOtaPackage(input_tf_zip, filename):
logger.info("Re-signing OTA package {}".format(filename))
with tempfile.NamedTemporaryFile() as input_ota, tempfile.NamedTemporaryFile() as output_ota:
- with input_tf_zip.open(filename, "r") as in_fp:
- shutil.copyfileobj(in_fp, input_ota)
- input_ota.flush()
+ RegenerateBootOTA(input_tf_zip, output_tf_zip,
+ misc_info, filename, input_ota)
+
SignOtaPackage(input_ota.name, output_ota.name)
common.ZipWrite(output_tf_zip, output_ota.name, filename,
compress_type=zipfile.ZIP_STORED)
@@ -811,17 +875,18 @@
common.ZipWrite(output_tf_zip, image.name, filename)
# A non-APK file; copy it verbatim.
else:
- common.ZipWriteStr(output_tf_zip, out_info, data)
+ try:
+ entry = output_tf_zip.getinfo(filename)
+ if output_tf_zip.read(entry) != data:
+ logger.warn(
+ "Output zip contains duplicate entries for %s with different contents", filename)
+ continue
+ except KeyError:
+ common.ZipWriteStr(output_tf_zip, out_info, data)
if OPTIONS.replace_ota_keys:
ReplaceOtaKeys(input_tf_zip, output_tf_zip, misc_info)
- # Replace the AVB signing keys, if any.
- ReplaceAvbSigningKeys(misc_info)
-
- # Rewrite the props in AVB signing args.
- if misc_info.get('avb_enable') == 'true':
- RewriteAvbProps(misc_info)
# Write back misc_info with the latest values.
ReplaceMiscInfoTxt(input_tf_zip, output_tf_zip, misc_info)
diff --git a/tools/sbom/generate-sbom-framework_res.py b/tools/sbom/generate-sbom-framework_res.py
index d0d232d..27f3d2e 100644
--- a/tools/sbom/generate-sbom-framework_res.py
+++ b/tools/sbom/generate-sbom-framework_res.py
@@ -80,7 +80,8 @@
resource_file_spdxids = []
for file in layoutlib_sbom[sbom_writers.PropNames.FILES]:
- if file[sbom_writers.PropNames.FILE_NAME].startswith('data/res/'):
+ file_path = file[sbom_writers.PropNames.FILE_NAME]
+ if file_path.startswith('data/res/') or file_path.startswith('data/overlays/'):
resource_file_spdxids.append(file[sbom_writers.PropNames.SPDXID])
doc.relationships = [