summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/product/base_system.mk5
-rw-r--r--tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt27
-rw-r--r--tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt9
-rw-r--r--tools/releasetools/create_brick_ota.py8
-rwxr-xr-xtools/whichgit61
5 files changed, 84 insertions, 26 deletions
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 57e8275270..22284b1c18 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -486,6 +486,11 @@ PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
# Enable dirty image object binning to reduce dirty pages in the image.
PRODUCT_PACKAGES += dirty-image-objects
+# Enable go/perfetto-persistent-tracing for eng builds
+ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
+ PRODUCT_PRODUCT_PROPERTIES += persist.debug.perfetto.persistent_sysui_tracing_for_bugreport=1
+endif
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
# Ensure all trunk-stable flags are available.
diff --git a/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt b/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
index 04c2f80e79..2f76b2a5a7 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
@@ -34,6 +34,9 @@ private val API_SIGNATURE =
ctor @FlaggedApi("android.flag.foo") public Clazz();
field @FlaggedApi("android.flag.foo") public static final int FOO = 1; // 0x1
method @FlaggedApi("android.flag.foo") public int getErrorCode();
+ method @FlaggedApi("android.flag.foo") public boolean setData(int, int[][], @NonNull android.util.Utility<T, U>);
+ method @FlaggedApi("android.flag.foo") public boolean setVariableData(int, android.util.Atom...);
+ method @FlaggedApi("android.flag.foo") public boolean innerClassArg(android.Clazz.Builder);
}
@FlaggedApi("android.flag.bar") public static class Clazz.Builder {
}
@@ -49,6 +52,9 @@ private val API_VERSIONS =
<method name="&lt;init>()V"/>
<field name="FOO"/>
<method name="getErrorCode()I"/>
+ <method name="setData(I[[ILandroid/util/Utility;)Z"/>
+ <method name="setVariableData(I[Landroid/util/Atom;)Z"/>
+ <method name="innerClassArg(Landroid/Clazz${"$"}Builder;)"/>
</class>
<class name="android/Clazz${"$"}Builder" since="2">
</class>
@@ -93,6 +99,15 @@ class CheckFlaggedApisTest {
Pair(Symbol("android/Clazz/Clazz()"), Flag("android.flag.foo")),
Pair(Symbol("android/Clazz/FOO"), Flag("android.flag.foo")),
Pair(Symbol("android/Clazz/getErrorCode()"), Flag("android.flag.foo")),
+ Pair(
+ Symbol("android/Clazz/setData(I[[ILandroid/util/Utility;)"),
+ Flag("android.flag.foo")),
+ Pair(
+ Symbol("android/Clazz/setVariableData(I[Landroid/util/Atom;)"),
+ Flag("android.flag.foo")),
+ Pair(
+ Symbol("android/Clazz/innerClassArg(Landroid/Clazz/Builder;)"),
+ Flag("android.flag.foo")),
Pair(Symbol("android/Clazz/Builder"), Flag("android.flag.bar")),
)
val actual = parseApiSignature("in-memory", API_SIGNATURE.byteInputStream())
@@ -115,6 +130,9 @@ class CheckFlaggedApisTest {
Symbol("android/Clazz/Clazz()"),
Symbol("android/Clazz/FOO"),
Symbol("android/Clazz/getErrorCode()"),
+ Symbol("android/Clazz/setData(I[[ILandroid/util/Utility;)"),
+ Symbol("android/Clazz/setVariableData(I[Landroid/util/Atom;)"),
+ Symbol("android/Clazz/innerClassArg(Landroid/Clazz/Builder;)"),
Symbol("android/Clazz/Builder"),
)
val actual = parseApiVersions(API_VERSIONS.byteInputStream())
@@ -143,6 +161,15 @@ class CheckFlaggedApisTest {
DisabledFlaggedApiIsPresentError(
Symbol("android/Clazz/getErrorCode()"), Flag("android.flag.foo")),
DisabledFlaggedApiIsPresentError(
+ Symbol("android/Clazz/setData(I[[ILandroid/util/Utility;)"),
+ Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(
+ Symbol("android/Clazz/setVariableData(I[Landroid/util/Atom;)"),
+ Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(
+ Symbol("android/Clazz/innerClassArg(Landroid/Clazz/Builder;)"),
+ Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(
Symbol("android/Clazz/Builder"), Flag("android.flag.bar")),
)
val actual =
diff --git a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
index 0f2fbef719..e8b1b65fce 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
@@ -178,7 +178,6 @@ The tool will exit with a non-zero exit code if any flagged APIs are found to be
}
internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbol, Flag>> {
- // TODO(334870672): add support for metods
val output = mutableSetOf<Pair<Symbol, Flag>>()
val visitor =
object : BaseItemVisitor() {
@@ -203,11 +202,7 @@ internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbo
append(".")
append(method.name())
append("(")
- // TODO(334870672): replace this early return with proper parsing of the command line
- // arguments, followed by translation to Lname/of/class; + III format
- if (!method.parameters().isEmpty()) {
- return
- }
+ method.parameters().joinTo(this, separator = "") { it.type().internalName() }
append(")")
}
val symbol = Symbol.create(name)
@@ -281,7 +276,7 @@ internal fun parseApiVersions(input: InputStream): Set<Symbol> {
if (methodSignatureParts.size != 3) {
throw Exception("Bad XML: method signature '$methodSignature'")
}
- var (methodName, methodArgs, methodReturnValue) = methodSignatureParts
+ var (methodName, methodArgs, _) = methodSignatureParts
val packageAndClassName =
requireNotNull(method.getParentNode()?.getAttribute("name")) {
"Bad XML: top level <method> element, or <class> element missing name attribute"
diff --git a/tools/releasetools/create_brick_ota.py b/tools/releasetools/create_brick_ota.py
index 9e040a53d4..bf50f71049 100644
--- a/tools/releasetools/create_brick_ota.py
+++ b/tools/releasetools/create_brick_ota.py
@@ -45,10 +45,10 @@ def CreateBrickOta(product_name: str, output_path: Path, extra_wipe_partitions:
partitions_to_wipe = PARTITIONS_TO_WIPE
if extra_wipe_partitions is not None:
partitions_to_wipe = PARTITIONS_TO_WIPE + extra_wipe_partitions.split(",")
- ota_metadata = ["ota-type=BRICK", "post-timestamp=9999999999",
- "pre-device=" + product_name]
- if serialno is not None:
- ota_metadata.append("serialno=" + serialno)
+ ota_metadata = ["ota-type=BRICK", "post-timestamp=9999999999",
+ "pre-device=" + product_name]
+ if serialno is not None:
+ ota_metadata.append("serialno=" + serialno)
# recovery requiers product name to be a | separated list
product_name = product_name.replace(",", "|")
with zipfile.ZipFile(output_path, "w") as zfp:
diff --git a/tools/whichgit b/tools/whichgit
index 8cf84f5629..55c8c6fb5a 100755
--- a/tools/whichgit
+++ b/tools/whichgit
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import argparse
+import itertools
import os
import subprocess
import sys
@@ -10,15 +11,34 @@ def get_build_var(var):
check=True, capture_output=True, text=True).stdout.strip()
+def get_all_modules():
+ product_out = subprocess.run(["build/soong/soong_ui.bash", "--dumpvar-mode", "--abs", "PRODUCT_OUT"],
+ check=True, capture_output=True, text=True).stdout.strip()
+ result = subprocess.run(["cat", product_out + "/all_modules.txt"], check=True, capture_output=True, text=True)
+ return result.stdout.strip().split("\n")
+
+
+def batched(iterable, n):
+ # introduced in itertools 3.12, could delete once that's universally available
+ if n < 1:
+ raise ValueError('n must be at least one')
+ it = iter(iterable)
+ while batch := tuple(itertools.islice(it, n)):
+ yield batch
+
+
def get_sources(modules):
- result = subprocess.run(["./prebuilts/build-tools/linux-x86/bin/ninja", "-f",
- "out/combined-" + os.environ["TARGET_PRODUCT"] + ".ninja",
- "-t", "inputs", "-d", ] + modules,
- stderr=subprocess.STDOUT, stdout=subprocess.PIPE, check=False, text=True)
- if result.returncode != 0:
- sys.stderr.write(result.stdout)
- sys.exit(1)
- return set([f for f in result.stdout.split("\n") if not f.startswith("out/")])
+ sources = set()
+ for module_group in batched(modules, 40_000):
+ result = subprocess.run(["./prebuilts/build-tools/linux-x86/bin/ninja", "-f",
+ "out/combined-" + os.environ["TARGET_PRODUCT"] + ".ninja",
+ "-t", "inputs", "-d", ] + list(module_group),
+ stderr=subprocess.STDOUT, stdout=subprocess.PIPE, check=False, text=True)
+ if result.returncode != 0:
+ sys.stderr.write(result.stdout)
+ sys.exit(1)
+ sources.update(set([f for f in result.stdout.split("\n") if not f.startswith("out/")]))
+ return sources
def m_nothing():
@@ -57,13 +77,13 @@ def main(argv):
# Argument parsing
ap = argparse.ArgumentParser(description="List the required git projects for the given modules")
ap.add_argument("--products", nargs="*",
- help="The TARGET_PRODUCT to check. If not provided just uses whatever has"
- + " already been built")
+ help="One or more TARGET_PRODUCT to check, or \"*\" for all. If not provided"
+ + "just uses whatever has already been built")
ap.add_argument("--variants", nargs="*",
help="The TARGET_BUILD_VARIANTS to check. If not provided just uses whatever has"
+ " already been built, or eng if --products is supplied")
ap.add_argument("--modules", nargs="*",
- help="The build modules to check, or droid if not supplied")
+ help="The build modules to check, or \"*\" for all, or droid if not supplied")
ap.add_argument("--why", nargs="*",
help="Also print the input files used in these projects, or \"*\" for all")
ap.add_argument("--unused", help="List the unused git projects for the given modules rather than"
@@ -72,22 +92,33 @@ def main(argv):
modules = args.modules if args.modules else ["droid"]
+ match args.products:
+ case ["*"]:
+ products = get_build_var("all_named_products").split(" ")
+ case _:
+ products = args.products
+
# Get the list of sources for all of the requested build combos
- if not args.products and not args.variants:
+ if not products and not args.variants:
+ m_nothing()
+ if args.modules == ["*"]:
+ modules = get_all_modules()
sources = get_sources(modules)
else:
- if not args.products:
+ if not products:
sys.stderr.write("Error: --products must be supplied if --variants is supplied")
sys.exit(1)
sources = set()
build_num = 1
- for product in args.products:
+ for product in products:
os.environ["TARGET_PRODUCT"] = product
variants = args.variants if args.variants else ["user", "userdebug", "eng"]
for variant in variants:
- sys.stderr.write(f"Analyzing build {build_num} of {len(args.products)*len(variants)}\r")
+ sys.stderr.write(f"Analyzing build {build_num} of {len(products)*len(variants)}\r")
os.environ["TARGET_BUILD_VARIANT"] = variant
m_nothing()
+ if args.modules == ["*"]:
+ modules = get_all_modules()
sources.update(get_sources(modules))
build_num += 1
sys.stderr.write("\n\n")