Merge "Merge sc-v2-dev-plus-aosp-without-vendor@8084891" into stage-aosp-master
diff --git a/core/definitions.mk b/core/definitions.mk
index c981152..94e03a2 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -577,6 +577,15 @@
endef
###########################################################
+# License metadata targets corresponding to targets in $(1)
+###########################################################
+define corresponding-license-metadata
+$(strip $(eval _dir := $(call license-metadata-dir)) \
+$(foreach target, $(sort $(1)), $(_dir)/$(target).meta_lic) \
+)
+endef
+
+###########################################################
## License metadata build rule for my_register_name $(1)
###########################################################
define license-metadata-rule
@@ -728,6 +737,22 @@
endef
###########################################################
+## Declare that non-module targets copied from project $(1) and
+## optionally ending in $(2) have the following license
+## metadata:
+##
+## $(3) -- license kinds e.g. SPDX-license-identifier-Apache-2.0
+## $(4) -- license conditions e.g. notice by_exception_only
+## $(5) -- license text filenames (notices)
+## $(6) -- package name
+###########################################################
+define declare-copy-files-license-metadata
+$(strip \
+ $(foreach _pair,$(filter $(1)%$(2),$(PRODUCT_COPY_FILES)),$(eval $(call declare-license-metadata,$(PRODUCT_OUT)/$(call word-colon,2,$(_pair)),$(3),$(4),$(5),$(6),$(1)))) \
+)
+endef
+
+###########################################################
## Declare the license metadata for non-module container-type target $(1).
##
## Container-type targets are targets like .zip files that
@@ -765,6 +790,18 @@
endef
###########################################################
+## Declare that non-module targets copied from project $(1) and
+## optionally ending in $(2) are non-copyrightable files.
+##
+## e.g. an information-only file merely listing other files.
+###########################################################
+define declare-0p-copy-files
+$(strip \
+ $(foreach _pair,$(filter $(1)%$(2),$(PRODUCT_COPY_FILES)),$(eval $(call declare-0p-target,$(PRODUCT_OUT)/$(call word-colon,2,$(_pair))))) \
+)
+endef
+
+###########################################################
## Declare non-module target $(1) to have a first-party license
## (Android Apache 2.0)
##
@@ -775,6 +812,15 @@
endef
###########################################################
+## Declare that non-module targets copied from project $(1) and
+## optionally ending in $(2) are first-party licensed
+## (Android Apache 2.0)
+###########################################################
+define declare-1p-copy-files
+$(foreach _pair,$(filter $(1)%$(2),$(PRODUCT_COPY_FILES)),$(call declare-1p-target,$(PRODUCT_OUT)/$(call word-colon,2,$(_pair)),$(1)))
+endef
+
+###########################################################
## Declare non-module container-type target $(1) to have a
## first-party license (Android Apache 2.0).
##
diff --git a/core/sysprop.mk b/core/sysprop.mk
index 12ead6e..86435d96 100644
--- a/core/sysprop.mk
+++ b/core/sysprop.mk
@@ -270,6 +270,7 @@
PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
+ PLATFORM_VERSION_KNOWN_CODENAMES="$(PLATFORM_VERSION_KNOWN_CODENAMES)" \
PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
$(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 2705f26..3ca5366 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -79,6 +79,13 @@
PLATFORM_BASE_SDK_EXTENSION_VERSION := 1
.KATI_READONLY := PLATFORM_BASE_SDK_EXTENSION_VERSION
+# This is are all known codenames starting from Q.
+PLATFORM_VERSION_KNOWN_CODENAMES := Q R S Sv2 Tiramisu
+# Convert from space separated list to comma separated
+PLATFORM_VERSION_KNOWN_CODENAMES := \
+ $(call normalize-comma-list,$(PLATFORM_VERSION_KNOWN_CODENAMES))
+.KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES
+
ifndef PLATFORM_SECURITY_PATCH
# Used to indicate the security patch that has been applied to the device.
# It must signify that the build includes all security patches issued up through the designated Android Public Security Bulletin.
diff --git a/core/version_util.mk b/core/version_util.mk
index b7c4e48..2633640 100644
--- a/core/version_util.mk
+++ b/core/version_util.mk
@@ -90,6 +90,15 @@
PLATFORM_VERSION_CODENAME \
PLATFORM_VERSION_ALL_CODENAMES
+ifneq (REL,$(PLATFORM_VERSION_CODENAME))
+ codenames := \
+ $(subst $(comma),$(space),$(strip $(PLATFORM_VERSION_KNOWN_CODENAMES)))
+ ifeq ($(filter $(PLATFORM_VERSION_CODENAME),$(codenames)),)
+ $(error '$(PLATFORM_VERSION_CODENAME)' is not in '$(codenames)'. \
+ Add PLATFORM_VERSION_CODENAME to PLATFORM_VERSION_KNOWN_CODENAMES)
+ endif
+endif
+
ifndef PLATFORM_VERSION
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
PLATFORM_VERSION := $(PLATFORM_VERSION_LAST_STABLE)
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index a349cba..20c96de 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -16,6 +16,7 @@
echo "ro.build.version.preview_sdk_fingerprint=$PLATFORM_PREVIEW_SDK_FINGERPRINT"
echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
+echo "ro.build.version.known_codenames=$PLATFORM_VERSION_KNOWN_CODENAMES"
echo "ro.build.version.release=$PLATFORM_VERSION_LAST_STABLE"
echo "ro.build.version.release_or_codename=$PLATFORM_VERSION"
echo "ro.build.version.security_patch=$PLATFORM_SECURITY_PATCH"
diff --git a/tools/compliance/noticeindex.go b/tools/compliance/noticeindex.go
index 00deb41..904916c 100644
--- a/tools/compliance/noticeindex.go
+++ b/tools/compliance/noticeindex.go
@@ -20,6 +20,7 @@
"fmt"
"io"
"io/fs"
+ "net/url"
"path/filepath"
"regexp"
"sort"
@@ -93,13 +94,14 @@
}
hashes := make(map[hash]struct{})
for _, text := range tn.LicenseTexts() {
- if _, ok := ni.hash[text]; !ok {
- err := ni.addText(text)
+ fname := strings.SplitN(text, ":", 2)[0]
+ if _, ok := ni.hash[fname]; !ok {
+ err := ni.addText(fname)
if err != nil {
return nil, err
}
}
- hash := ni.hash[text]
+ hash := ni.hash[fname]
if _, ok := hashes[hash]; !ok {
hashes[hash] = struct{}{}
}
@@ -108,11 +110,12 @@
return hashes, nil
}
- link := func(libName string, hashes map[hash]struct{}, installPaths []string) {
- if _, ok := ni.libHash[libName]; !ok {
- ni.libHash[libName] = make(map[hash]struct{})
- }
+ link := func(tn *TargetNode, hashes map[hash]struct{}, installPaths []string) {
for h := range hashes {
+ libName := ni.getLibName(tn, h)
+ if _, ok := ni.libHash[libName]; !ok {
+ ni.libHash[libName] = make(map[hash]struct{})
+ }
if _, ok := ni.hashLibInstall[h]; !ok {
ni.hashLibInstall[h] = make(map[string]map[string]struct{})
}
@@ -160,7 +163,7 @@
if err != nil {
return false
}
- link(ni.getLibName(tn), hashes, installPaths)
+ link(tn, hashes, installPaths)
if tn.IsContainer() {
return true
}
@@ -170,7 +173,7 @@
if err != nil {
return false
}
- link(ni.getLibName(r.actsOn), hashes, installPaths)
+ link(r.actsOn, hashes, installPaths)
}
return false
})
@@ -305,7 +308,24 @@
}
// getLibName returns the name of the library associated with `noticeFor`.
-func (ni *NoticeIndex) getLibName(noticeFor *TargetNode) string {
+func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) string {
+ for _, text := range noticeFor.LicenseTexts() {
+ if !strings.Contains(text, ":") {
+ continue
+ }
+
+ fields := strings.SplitN(text, ":", 2)
+ fname, pname := fields[0], fields[1]
+ if ni.hash[fname].key != h.key {
+ continue
+ }
+
+ ln, err := url.QueryUnescape(pname)
+ if err != nil {
+ continue
+ }
+ return ln
+ }
// use name from METADATA if available
ln := ni.checkMetadata(noticeFor)
if len(ln) > 0 {
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 8506199..60a9265 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -498,8 +498,9 @@
def GetPartitionBuildProp(self, prop, partition):
"""Returns the inquired build property for the provided partition."""
- # Boot image uses ro.[product.]bootimage instead of boot.
- prop_partition = "bootimage" if partition == "boot" else partition
+ # Boot image and init_boot image uses ro.[product.]bootimage instead of boot.
+ # This comes from the generic ramdisk
+ prop_partition = "bootimage" if partition == "boot" or partition == "init_boot" else partition
# If provided a partition for this property, only look within that
# partition's build.prop.