Merge "Add module type information to make modules." into main
diff --git a/ci/Android.bp b/ci/Android.bp
index 066b83f..104f517 100644
--- a/ci/Android.bp
+++ b/ci/Android.bp
@@ -14,6 +14,7 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
+ default_team: "trendy_team_adte",
}
python_test_host {
@@ -74,6 +75,7 @@
name: "build_test_suites",
srcs: [
"build_test_suites.py",
+ "optimized_targets.py",
],
}
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 29ed50e..6e1f88c 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -15,11 +15,19 @@
"""Build script for the CI `test_suites` target."""
import argparse
+from dataclasses import dataclass
+import json
import logging
import os
import pathlib
import subprocess
import sys
+from typing import Callable
+import optimized_targets
+
+
+REQUIRED_ENV_VARS = frozenset(['TARGET_PRODUCT', 'TARGET_RELEASE', 'TOP'])
+SOONG_UI_EXE_REL_PATH = 'build/soong/soong_ui.bash'
class Error(Exception):
@@ -35,16 +43,54 @@
self.return_code = return_code
-REQUIRED_ENV_VARS = frozenset(['TARGET_PRODUCT', 'TARGET_RELEASE', 'TOP'])
-SOONG_UI_EXE_REL_PATH = 'build/soong/soong_ui.bash'
+class BuildPlanner:
+ """Class in charge of determining how to optimize build targets.
+
+ Given the build context and targets to build it will determine a final list of
+ targets to build along with getting a set of packaging functions to package up
+ any output zip files needed by the build.
+ """
+
+ def __init__(
+ self,
+ build_context: dict[str, any],
+ args: argparse.Namespace,
+ target_optimizations: dict[str, optimized_targets.OptimizedBuildTarget],
+ ):
+ self.build_context = build_context
+ self.args = args
+ self.target_optimizations = target_optimizations
+
+ def create_build_plan(self):
+
+ if 'optimized_build' not in self.build_context['enabled_build_features']:
+ return BuildPlan(set(self.args.extra_targets), set())
+
+ build_targets = set()
+ packaging_functions = set()
+ for target in self.args.extra_targets:
+ target_optimizer_getter = self.target_optimizations.get(target, None)
+ if not target_optimizer_getter:
+ build_targets.add(target)
+ continue
+
+ target_optimizer = target_optimizer_getter(
+ target, self.build_context, self.args
+ )
+ build_targets.update(target_optimizer.get_build_targets())
+ packaging_functions.add(target_optimizer.package_outputs)
+
+ return BuildPlan(build_targets, packaging_functions)
-def get_top() -> pathlib.Path:
- return pathlib.Path(os.environ['TOP'])
+@dataclass(frozen=True)
+class BuildPlan:
+ build_targets: set[str]
+ packaging_functions: set[Callable[..., None]]
def build_test_suites(argv: list[str]) -> int:
- """Builds the general-tests and any other test suites passed in.
+ """Builds all test suites passed in, optimizing based on the build_context content.
Args:
argv: The command line arguments passed in.
@@ -54,9 +100,14 @@
"""
args = parse_args(argv)
check_required_env()
+ build_context = load_build_context()
+ build_planner = BuildPlanner(
+ build_context, args, optimized_targets.OPTIMIZED_BUILD_TARGETS
+ )
+ build_plan = build_planner.create_build_plan()
try:
- build_everything(args)
+ execute_build_plan(build_plan)
except BuildFailureError as e:
logging.error('Build command failed! Check build_log for details.')
return e.return_code
@@ -64,6 +115,16 @@
return 0
+def parse_args(argv: list[str]) -> argparse.Namespace:
+ argparser = argparse.ArgumentParser()
+
+ argparser.add_argument(
+ 'extra_targets', nargs='*', help='Extra test suites to build.'
+ )
+
+ return argparser.parse_args(argv)
+
+
def check_required_env():
"""Check for required env vars.
@@ -79,43 +140,40 @@
raise Error(f'Missing required environment variables: {t}')
-def parse_args(argv):
- argparser = argparse.ArgumentParser()
+def load_build_context():
+ build_context_path = pathlib.Path(os.environ.get('BUILD_CONTEXT', ''))
+ if build_context_path.is_file():
+ try:
+ with open(build_context_path, 'r') as f:
+ return json.load(f)
+ except json.decoder.JSONDecodeError as e:
+ raise Error(f'Failed to load JSON file: {build_context_path}')
- argparser.add_argument(
- 'extra_targets', nargs='*', help='Extra test suites to build.'
- )
-
- return argparser.parse_args(argv)
+ logging.info('No BUILD_CONTEXT found, skipping optimizations.')
+ return empty_build_context()
-def build_everything(args: argparse.Namespace):
- """Builds all tests (regardless of whether they are needed).
+def empty_build_context():
+ return {'enabled_build_features': []}
- Args:
- args: The parsed arguments.
- Raises:
- BuildFailure: If the build command fails.
- """
- build_command = base_build_command(args, args.extra_targets)
+def execute_build_plan(build_plan: BuildPlan):
+ build_command = []
+ build_command.append(get_top().joinpath(SOONG_UI_EXE_REL_PATH))
+ build_command.append('--make-mode')
+ build_command.extend(build_plan.build_targets)
try:
run_command(build_command)
except subprocess.CalledProcessError as e:
raise BuildFailureError(e.returncode) from e
+ for packaging_function in build_plan.packaging_functions:
+ packaging_function()
-def base_build_command(
- args: argparse.Namespace, extra_targets: set[str]
-) -> list[str]:
- build_command = []
- build_command.append(get_top().joinpath(SOONG_UI_EXE_REL_PATH))
- build_command.append('--make-mode')
- build_command.extend(extra_targets)
-
- return build_command
+def get_top() -> pathlib.Path:
+ return pathlib.Path(os.environ['TOP'])
def run_command(args: list[str], stdout=None):
diff --git a/ci/build_test_suites_test.py b/ci/build_test_suites_test.py
index 08a79a3..a9ff3fb 100644
--- a/ci/build_test_suites_test.py
+++ b/ci/build_test_suites_test.py
@@ -14,7 +14,9 @@
"""Tests for build_test_suites.py"""
+import argparse
from importlib import resources
+import json
import multiprocessing
import os
import pathlib
@@ -27,9 +29,11 @@
import textwrap
import time
from typing import Callable
+import unittest
from unittest import mock
import build_test_suites
import ci_test_lib
+import optimized_targets
from pyfakefs import fake_filesystem_unittest
@@ -80,12 +84,20 @@
with self.assertRaisesRegex(SystemExit, '42'):
build_test_suites.main([])
+ def test_incorrectly_formatted_build_context_raises(self):
+ build_context = self.fake_top.joinpath('build_context')
+ build_context.touch()
+ os.environ['BUILD_CONTEXT'] = str(build_context)
+
+ with self.assert_raises_word(build_test_suites.Error, 'JSON'):
+ build_test_suites.main([])
+
def test_build_success_returns(self):
with self.assertRaisesRegex(SystemExit, '0'):
build_test_suites.main([])
def assert_raises_word(self, cls, word):
- return self.assertRaisesRegex(build_test_suites.Error, rf'\b{word}\b')
+ return self.assertRaisesRegex(cls, rf'\b{word}\b')
def _setup_working_build_env(self):
self.fake_top = pathlib.Path('/fake/top')
@@ -222,6 +234,171 @@
os.kill(p.pid, signal.SIGINT)
+class BuildPlannerTest(unittest.TestCase):
+
+ class TestOptimizedBuildTarget(optimized_targets.OptimizedBuildTarget):
+
+ def __init__(self, output_targets):
+ self.output_targets = output_targets
+
+ def get_build_targets(self):
+ return self.output_targets
+
+ def package_outputs(self):
+ return f'packaging {" ".join(self.output_targets)}'
+
+ def test_build_optimization_off_builds_everything(self):
+ build_targets = {'target_1', 'target_2'}
+ build_planner = self.create_build_planner(
+ build_context=self.create_build_context(optimized_build_enabled=False),
+ build_targets=build_targets,
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ self.assertSetEqual(build_targets, build_plan.build_targets)
+
+ def test_build_optimization_off_doesnt_package(self):
+ build_targets = {'target_1', 'target_2'}
+ build_planner = self.create_build_planner(
+ build_context=self.create_build_context(optimized_build_enabled=False),
+ build_targets=build_targets,
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ self.assertEqual(len(build_plan.packaging_functions), 0)
+
+ def test_build_optimization_on_optimizes_target(self):
+ build_targets = {'target_1', 'target_2'}
+ build_planner = self.create_build_planner(
+ build_targets=build_targets,
+ build_context=self.create_build_context(
+ enabled_build_features={self.get_target_flag('target_1')}
+ ),
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ expected_targets = {self.get_optimized_target_name('target_1'), 'target_2'}
+ self.assertSetEqual(expected_targets, build_plan.build_targets)
+
+ def test_build_optimization_on_packages_target(self):
+ build_targets = {'target_1', 'target_2'}
+ build_planner = self.create_build_planner(
+ build_targets=build_targets,
+ build_context=self.create_build_context(
+ enabled_build_features={self.get_target_flag('target_1')}
+ ),
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ optimized_target_name = self.get_optimized_target_name('target_1')
+ self.assertIn(
+ f'packaging {optimized_target_name}',
+ self.run_packaging_functions(build_plan),
+ )
+
+ def test_individual_build_optimization_off_doesnt_optimize(self):
+ build_targets = {'target_1', 'target_2'}
+ build_planner = self.create_build_planner(
+ build_targets=build_targets,
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ self.assertSetEqual(build_targets, build_plan.build_targets)
+
+ def test_individual_build_optimization_off_doesnt_package(self):
+ build_targets = {'target_1', 'target_2'}
+ build_planner = self.create_build_planner(
+ build_targets=build_targets,
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ expected_packaging_function_outputs = {None, None}
+ self.assertSetEqual(
+ expected_packaging_function_outputs,
+ self.run_packaging_functions(build_plan),
+ )
+
+ def create_build_planner(
+ self,
+ build_targets: set[str],
+ build_context: dict[str, any] = None,
+ args: argparse.Namespace = None,
+ target_optimizations: dict[
+ str, optimized_targets.OptimizedBuildTarget
+ ] = None,
+ ) -> build_test_suites.BuildPlanner:
+ if not build_context:
+ build_context = self.create_build_context()
+ if not args:
+ args = self.create_args(extra_build_targets=build_targets)
+ if not target_optimizations:
+ target_optimizations = self.create_target_optimizations(
+ build_context, build_targets
+ )
+ return build_test_suites.BuildPlanner(
+ build_context, args, target_optimizations
+ )
+
+ def create_build_context(
+ self,
+ optimized_build_enabled: bool = True,
+ enabled_build_features: set[str] = set(),
+ test_context: dict[str, any] = {},
+ ) -> dict[str, any]:
+ build_context = {}
+ build_context['enabled_build_features'] = enabled_build_features
+ if optimized_build_enabled:
+ build_context['enabled_build_features'].add('optimized_build')
+ build_context['test_context'] = test_context
+ return build_context
+
+ def create_args(
+ self, extra_build_targets: set[str] = set()
+ ) -> argparse.Namespace:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('extra_targets', nargs='*')
+ return parser.parse_args(extra_build_targets)
+
+ def create_target_optimizations(
+ self, build_context: dict[str, any], build_targets: set[str]
+ ):
+ target_optimizations = dict()
+ for target in build_targets:
+ target_optimizations[target] = (
+ lambda target, build_context, args: optimized_targets.get_target_optimizer(
+ target,
+ self.get_target_flag(target),
+ build_context,
+ self.TestOptimizedBuildTarget(
+ {self.get_optimized_target_name(target)}
+ ),
+ )
+ )
+
+ return target_optimizations
+
+ def get_target_flag(self, target: str):
+ return f'{target}_enabled'
+
+ def get_optimized_target_name(self, target: str):
+ return f'{target}_optimized'
+
+ def run_packaging_functions(
+ self, build_plan: build_test_suites.BuildPlan
+ ) -> set[str]:
+ output = set()
+ for packaging_function in build_plan.packaging_functions:
+ output.add(packaging_function())
+
+ return output
+
+
def wait_until(
condition_function: Callable[[], bool],
timeout_secs: float = 3.0,
diff --git a/ci/optimized_targets.py b/ci/optimized_targets.py
new file mode 100644
index 0000000..224c8c0
--- /dev/null
+++ b/ci/optimized_targets.py
@@ -0,0 +1,69 @@
+#
+# Copyright 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.
+
+from abc import ABC
+
+
+class OptimizedBuildTarget(ABC):
+ """A representation of an optimized build target.
+
+ This class will determine what targets to build given a given build_cotext and
+ will have a packaging function to generate any necessary output zips for the
+ build.
+ """
+
+ def __init__(self, build_context, args):
+ self.build_context = build_context
+ self.args = args
+
+ def get_build_targets(self):
+ pass
+
+ def package_outputs(self):
+ pass
+
+
+class NullOptimizer(OptimizedBuildTarget):
+ """No-op target optimizer.
+
+ This will simply build the same target it was given and do nothing for the
+ packaging step.
+ """
+
+ def __init__(self, target):
+ self.target = target
+
+ def get_build_targets(self):
+ return {self.target}
+
+ def package_outputs(self):
+ pass
+
+
+def get_target_optimizer(target, enabled_flag, build_context, optimizer):
+ if enabled_flag in build_context['enabled_build_features']:
+ return optimizer
+
+ return NullOptimizer(target)
+
+
+# To be written as:
+# 'target': lambda target, build_context, args: get_target_optimizer(
+# target,
+# 'target_enabled_flag',
+# build_context,
+# TargetOptimizer(build_context, args),
+# )
+OPTIMIZED_BUILD_TARGETS = dict()
diff --git a/core/Makefile b/core/Makefile
index a16365d..cdb8423 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -7562,6 +7562,10 @@
droidcore-unbundled: $(QEMU_VERIFIED_BOOT_PARAMS)
endif
+
+# Preprocess files for emulator and sdk.
+-include development/build/tools/sdk-preprocess-files.mk
+
# -----------------------------------------------------------------
# The emulator package
ifeq ($(BUILD_EMULATOR),true)
@@ -7606,7 +7610,6 @@
sdk_dep_file := $(sdk_dir)/sdk_deps.mk
ATREE_FILES :=
-include development/build/tools/sdk-preprocess-files.mk
-include $(sdk_dep_file)
# if we don't have a real list, then use "everything"
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 274a7de..9b536f0 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -60,19 +60,10 @@
# Set this soong config variable to true for now, and cleanup `prefer` as part of b/308187800
$(call add_soong_config_var_value,ANDROID,module_build_from_source,true)
-# Messaging app vars
-ifeq (eng,$(TARGET_BUILD_VARIANT))
-$(call soong_config_set,messaging,build_variant_eng,true)
-endif
-
# Enable SystemUI optimizations by default unless explicitly set.
SYSTEMUI_OPTIMIZE_JAVA ?= true
$(call add_soong_config_var,ANDROID,SYSTEMUI_OPTIMIZE_JAVA)
-# Enable Compose in SystemUI by default.
-SYSTEMUI_USE_COMPOSE ?= true
-$(call add_soong_config_var,ANDROID,SYSTEMUI_USE_COMPOSE)
-
ifdef PRODUCT_AVF_ENABLED
$(call add_soong_config_var_value,ANDROID,avf_enabled,$(PRODUCT_AVF_ENABLED))
endif
@@ -156,6 +147,7 @@
# Add crashrecovery build flag to soong
$(call soong_config_set,ANDROID,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE))
+# Add crashrecovery file move flags to soong, for both platform and module
ifeq (true,$(RELEASE_CRASHRECOVERY_FILE_MOVE))
$(call soong_config_set,ANDROID,crashrecovery_files_in_module,true)
$(call soong_config_set,ANDROID,crashrecovery_files_in_platform,false)
@@ -163,5 +155,9 @@
$(call soong_config_set,ANDROID,crashrecovery_files_in_module,false)
$(call soong_config_set,ANDROID,crashrecovery_files_in_platform,true)
endif
-# Weirdly required because platform_bootclasspath is using AUTO namespace
-$(call soong_config_set,AUTO,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE))
+# Required as platform_bootclasspath is using this namespace
+$(call soong_config_set,bootclasspath,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE))
+
+# Enable Profiling module. Also used by platform_bootclasspath.
+$(call soong_config_set,ANDROID,release_package_profiling_module,$(RELEASE_PACKAGE_PROFILING_MODULE))
+$(call soong_config_set,bootclasspath,release_package_profiling_module,$(RELEASE_PACKAGE_PROFILING_MODULE))
diff --git a/core/binary.mk b/core/binary.mk
index f86b5a4..77ae6ef 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1352,6 +1352,8 @@
my_allowed_types := $(my_allowed_ndk_types) native:platform native:platform_vndk
endif
+ALL_MODULES.$(my_register_name).WHOLE_STATIC_LIBS := $(my_whole_static_libraries)
+
my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
ifneq ($(filter-out STATIC_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
my_link_deps += $(addprefix SHARED_LIBRARIES:,$(my_shared_libraries))
diff --git a/core/definitions.mk b/core/definitions.mk
index dde0aa9..51def29 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2925,19 +2925,15 @@
echo "Install path: $(patsubst $(PRODUCT_OUT)/%,%,$(PRIVATE_INSTALLED_MODULE))" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
endef
-ART_VERIDEX_APPCOMPAT_SCRIPT:=$(HOST_OUT)/bin/appcompat.sh
+ART_VERIDEX_APPCOMPAT:=$(HOST_OUT)/bin/appcompat
define run-appcompat
$(hide) \
- echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
- PACKAGING=$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING ANDROID_LOG_TAGS="*:e" $(ART_VERIDEX_APPCOMPAT_SCRIPT) --dex-file=$@ --api-flags=$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
+ echo "appcompat output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ ANDROID_LOG_TAGS="*:e" $(ART_VERIDEX_APPCOMPAT) --dex-file=$@ 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
endef
appcompat-files = \
$(AAPT2) \
- $(ART_VERIDEX_APPCOMPAT_SCRIPT) \
- $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) \
- $(HOST_OUT_EXECUTABLES)/veridex \
- $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex \
- $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/oahl_dex_intermediates/classes.dex
+ $(ART_VERIDEX_APPCOMPAT) \
else
appcompat-header =
run-appcompat =
diff --git a/core/java_common.mk b/core/java_common.mk
index 65feb15..a21f062 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -32,6 +32,8 @@
else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_USE_PREBUILT_SDKS))
# TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ else ifeq ($(EXPERIMENTAL_TARGET_JAVA_VERSION_21),true)
+ LOCAL_JAVA_LANGUAGE_VERSION := 21
else
LOCAL_JAVA_LANGUAGE_VERSION := 17
endif
diff --git a/core/tasks/art.mk b/core/tasks/art.mk
new file mode 100644
index 0000000..ded6125
--- /dev/null
+++ b/core/tasks/art.mk
@@ -0,0 +1,26 @@
+# 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.
+
+########################################################################
+# clean-oat rules
+#
+
+.PHONY: clean-oat
+clean-oat: clean-oat-host clean-oat-target
+
+.PHONY: clean-oat-host
+clean-oat-host:
+ find $(OUT_DIR) '(' -name '*.oat' -o -name '*.odex' -o -name '*.art' -o -name '*.vdex' ')' -a -type f | xargs rm -f
+ rm -rf $(TMPDIR)/*/test-*/dalvik-cache/*
+ rm -rf $(TMPDIR)/android-data/dalvik-cache/*
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index b9f0988..2e2ea79 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -16,6 +16,8 @@
test_suite_tradefed := cts-tradefed
test_suite_dynamic_config := cts/tools/cts-tradefed/DynamicConfig.xml
test_suite_readme := cts/tools/cts-tradefed/README
+test_suite_tools := $(HOST_OUT_JAVA_LIBRARIES)/ats_console_deploy.jar \
+ $(HOST_OUT_JAVA_LIBRARIES)/ats_olc_server_local_mode_deploy.jar
$(call declare-1p-target,$(test_suite_dynamic_config),cts)
$(call declare-1p-target,$(test_suite_readme),cts)
diff --git a/core/tasks/mcts.mk b/core/tasks/mcts.mk
new file mode 100644
index 0000000..09a4191
--- /dev/null
+++ b/core/tasks/mcts.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2023 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.
+
+ifneq ($(wildcard test/mts/README.md),)
+
+mcts_test_suites :=
+mcts_test_suites += mcts
+
+$(foreach module, $(mts_modules), $(eval mcts_test_suites += mcts-$(module)))
+
+$(foreach suite, $(mcts_test_suites), \
+ $(eval test_suite_name := $(suite)) \
+ $(eval test_suite_tradefed := mts-tradefed) \
+ $(eval test_suite_readme := test/mts/README.md) \
+ $(eval include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk) \
+ $(eval .PHONY: $(suite)) \
+ $(eval $(suite): $(compatibility_zip)) \
+ $(eval $(call dist-for-goals, $(suite), $(compatibility_zip))) \
+)
+
+endif
diff --git a/core/tasks/meta-lic.mk b/core/tasks/meta-lic.mk
index 17c76af..a94a016 100644
--- a/core/tasks/meta-lic.mk
+++ b/core/tasks/meta-lic.mk
@@ -30,6 +30,23 @@
$(eval $(call declare-1p-copy-files,device/google/atv,atv-component-overrides.xml))
$(eval $(call declare-1p-copy-files,device/google/atv,tv_core_hardware.xml))
+# Moved here from device/google/bramble/Android.mk
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,default-permissions.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,libnfc-nci.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,fstab.postinstall,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,ueventd.rc,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,wpa_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,hals.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,media_profiles_V1_0.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,media_codecs_performance.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,device_state_configuration.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,task_profiles.json,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,p2p_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,wpa_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/bramble,wpa_supplicant_overlay.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+
+$(eval $(call declare-1p-copy-files,device/google/bramble,audio_policy_configuration.xml))
+
# Moved here from device/google/barbet/Android.mk
$(eval $(call declare-copy-files-license-metadata,device/google/barbet,default-permissions.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
$(eval $(call declare-copy-files-license-metadata,device/google/barbet,libnfc-nci.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index 4e78d89..86c23f8 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -26,7 +26,15 @@
# Output variables:
# compatibility_zip: the path to the output zip file.
-test_suite_subdir := android-$(test_suite_name)
+special_mts_test_suites :=
+special_mts_test_suites += mcts
+special_mts_test_suites += $(mts_modules)
+ifneq ($(filter $(special_mts_test_suites),$(subst -, ,$(test_suite_name))),)
+ test_suite_subdir := android-mts
+else
+ test_suite_subdir := android-$(test_suite_name)
+endif
+
out_dir := $(HOST_OUT)/$(test_suite_name)/$(test_suite_subdir)
test_artifacts := $(COMPATIBILITY.$(test_suite_name).FILES)
test_tools := $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \
@@ -107,9 +115,9 @@
compatibility_zip_deps += $(test_suite_notice_txt)
compatibility_zip_resources += $(test_suite_notice_txt)
-compatibility_tests_list_zip := $(out_dir)-tests_list.zip
+compatibility_tests_list_zip := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name)-tests_list.zip
-compatibility_zip := $(out_dir).zip
+compatibility_zip := $(HOST_OUT)/$(test_suite_name)/android-$(test_suite_name).zip
$(compatibility_zip) : .KATI_IMPLICIT_OUTPUTS := $(compatibility_tests_list_zip)
$(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir)
$(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools)
diff --git a/envsetup.sh b/envsetup.sh
index 0ccb631..06dadd3 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -865,6 +865,16 @@
run_tool_with_logging "ADB" $ADB "${@}"
}
+function fastboot() {
+ local FASTBOOT=$(command which fastboot)
+ if [ -z "$FASTBOOT" ]; then
+ echo "Command fastboot not found; try lunch (and building) first?"
+ return 1
+ fi
+ # Support tool event logging for fastboot command.
+ run_tool_with_logging "FASTBOOT" $FASTBOOT "${@}"
+}
+
# communicate with a running device or emulator, set up necessary state,
# and run the hat command.
function runhat()
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 7a9325d..783ed3b 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -58,6 +58,9 @@
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS ?= system
+# Set widevine apex signed with dev key
+$(call soong_config_set,widevine,use_devkey,true)
+
#
# Special settings for GSI releasing
#
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 595940d..e9ca482 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -60,6 +60,9 @@
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS ?= system
+# Set widevine apex signed with dev key
+$(call soong_config_set,widevine,use_devkey,true)
+
#
# Special settings for GSI releasing
#
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 98adba5..8ce8855 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -83,6 +83,7 @@
CtsShimPrivPrebuilt \
debuggerd\
device_config \
+ DeviceDiagnostics \
dmctl \
dnsmasq \
dmesgd \
@@ -91,7 +92,9 @@
dump.erofs \
dumpstate \
dumpsys \
+ E2eeContactKeysProvider \
e2fsck \
+ enhanced-confirmation.xml \
ExtShared \
flags_health_check \
framework-graphics \
@@ -235,6 +238,7 @@
org.apache.http.legacy \
otacerts \
PackageInstaller \
+ package-shareduid-allowlist.xml \
passwd_system \
perfetto \
perfetto-extras \
@@ -287,6 +291,7 @@
uiautomator \
uinput \
uncrypt \
+ uprobestats \
usbd \
vdc \
vintf \
@@ -328,6 +333,12 @@
com.android.nfcservices
endif
+# Check if the build supports Profiling module
+ifeq ($(RELEASE_PACKAGE_PROFILING_MODULE),true)
+ PRODUCT_PACKAGES += \
+ com.android.profiling
+endif
+
ifeq ($(RELEASE_USE_WEBVIEW_BOOTSTRAP_MODULE),true)
PRODUCT_PACKAGES += \
com.android.webview.bootstrap
@@ -499,3 +510,5 @@
# Use "image" APEXes always.
$(call inherit-product,$(SRC_TARGET_DIR)/product/updatable_apex.mk)
+
+$(call soong_config_set, bionic, large_system_property_node, $(RELEASE_LARGE_SYSTEM_PROPERTY_NODE))
diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk
index 4a968d7..1a3f2cf 100644
--- a/target/product/default_art_config.mk
+++ b/target/product/default_art_config.mk
@@ -101,8 +101,16 @@
PRODUCT_BOOT_JARS += \
framework-nfc
else
- PRODUCT_APEX_BOOT_JARS := \
+ PRODUCT_APEX_BOOT_JARS += \
com.android.nfcservices:framework-nfc
+ $(call soong_config_set,bootclasspath,nfc_apex_bootclasspath_fragment,true)
+endif
+
+# Check if build supports Profiling module.
+ifeq ($(RELEASE_PACKAGE_PROFILING_MODULE),true)
+ PRODUCT_APEX_BOOT_JARS += \
+ com.android.profiling:framework-profiling \
+
endif
# List of system_server classpath jars delivered via apex.
@@ -153,6 +161,13 @@
com.android.uwb:service-uwb \
com.android.wifi:service-wifi \
+# Check if build supports Profiling module.
+ifeq ($(RELEASE_PACKAGE_PROFILING_MODULE),true)
+ PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS += \
+ com.android.profiling:service-profiling \
+
+endif
+
# Overrides the (apex, jar) pairs above when determining the on-device location. The format is:
# <old_apex>:<old_jar>:<new_apex>:<new_jar>
PRODUCT_CONFIGURED_JAR_LOCATION_OVERRIDES := \
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index 3c401f3..fb55f56 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -75,6 +75,10 @@
vr \
PRODUCT_PACKAGES += $(RELEASE_PACKAGE_VIRTUAL_CAMERA)
+# Set virtual_camera_service_enabled soong config variable based on the
+# RELEASE_PACKAGE_VIRTUAL_CAMERA build. virtual_camera_service_enabled soong config
+# variable is used to prevent accessing the service when it's not present in the build.
+$(call soong_config_set,vdm,virtual_camera_service_enabled,$(if $(RELEASE_PACKAGE_VIRTUAL_CAMERA),true,false))
PRODUCT_SYSTEM_SERVER_APPS += \
FusedLocation \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index d9c3c9a..dc78368 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -176,4 +176,5 @@
dalvik.vm.usap_pool_refill_delay_ms?=3000
PRODUCT_SYSTEM_PROPERTIES += \
- dalvik.vm.useartservice=true
+ dalvik.vm.useartservice=true \
+ dalvik.vm.enable_pr_dexopt=true
diff --git a/teams/Android.bp b/teams/Android.bp
index b3a5752..c56af6b 100644
--- a/teams/Android.bp
+++ b/teams/Android.bp
@@ -4391,3 +4391,17 @@
// go/trendy/manage/engineers/5955405559201792
trendy_team_id: "5955405559201792",
}
+
+team {
+ name: "trendy_team_android_media_better_together",
+
+ // go/trendy/manage/engineers/5617300451721216
+ trendy_team_id: "5617300451721216",
+}
+
+team {
+ name: "trendy_team_attack_tools",
+
+ // go/trendy/manage/engineers/4705629185081344
+ trendy_team_id: "4705629185081344",
+}
diff --git a/tools/aconfig/aflags/src/main.rs b/tools/aconfig/aflags/src/main.rs
index 05c15bb..810f2e3 100644
--- a/tools/aconfig/aflags/src/main.rs
+++ b/tools/aconfig/aflags/src/main.rs
@@ -233,8 +233,6 @@
}
fn set_flag(qualified_name: &str, value: &str) -> Result<()> {
- ensure!(nix::unistd::Uid::current().is_root(), "must be root to mutate flags");
-
let flags_binding = DeviceConfigSource::list_flags()?;
let flag = flags_binding.iter().find(|f| f.qualified_name() == qualified_name).ok_or(
anyhow!("no aconfig flag '{qualified_name}'. Does the flag have an .aconfig definition?"),
@@ -282,7 +280,9 @@
Ok(result)
}
-fn main() {
+fn main() -> Result<()> {
+ ensure!(nix::unistd::Uid::current().is_root(), "must be root");
+
let cli = Cli::parse();
let output = match cli.command {
Command::List { use_new_storage: true, container } => {
@@ -299,6 +299,8 @@
Ok(None) => (),
Err(message) => println!("Error: {message}"),
}
+
+ Ok(())
}
#[cfg(test)]
diff --git a/tools/check-flagged-apis/check-flagged-apis.sh b/tools/check-flagged-apis/check-flagged-apis.sh
index d9934a1..8078cd8 100755
--- a/tools/check-flagged-apis/check-flagged-apis.sh
+++ b/tools/check-flagged-apis/check-flagged-apis.sh
@@ -14,8 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Run check-flagged-apis for public APIs and the three @SystemApi flavours
-# Usage: lunch <your-target> && source <this script>
+# Run check-flagged-apis for public APIs and the three @SystemApi flavours.
+#
+# This script expects an argument to tell it which subcommand of
+# check-flagged-apis to execute. Run the script without any arguments to see
+# the valid options.
+#
+# Remember to lunch to select the relevant release config before running this script.
source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../shell_utils.sh
require_top
@@ -43,6 +48,10 @@
$MODULE_LIB_XML_VERSIONS
}
+function noop() {
+ true
+}
+
function aninja() {
local T="$(gettop)"
(\cd "${T}" && prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-${TARGET_PRODUCT}.ninja "$@")
@@ -52,11 +61,11 @@
aninja -t query device_"$1"_all_targets | grep -A1 -e input: | tail -n1
}
-function run() {
+function run_check() {
local errors=0
echo "# current"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $PUBLIC_XML_VERSIONS
@@ -64,7 +73,7 @@
echo
echo "# system-current"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-system-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $SYSTEM_XML_VERSIONS
@@ -72,7 +81,7 @@
echo
echo "# system-server-current"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-system-server-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $SYSTEM_SERVER_XML_VERSONS
@@ -80,7 +89,7 @@
echo
echo "# module-lib"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-module-lib-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $MODULE_LIB_XML_VERSIONS
@@ -89,8 +98,39 @@
return $errors
}
-if [[ "$1" != "--skip-build" ]]; then
- build && run
-else
- run
+function run_list() {
+ echo "# current"
+ check-flagged-apis list \
+ --api-signature $(path_to_api_signature_file "frameworks-base-api-current.txt") \
+ --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb
+
+ echo
+ echo "# system-current"
+ check-flagged-apis list \
+ --api-signature $(path_to_api_signature_file "frameworks-base-api-system-current.txt") \
+ --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb
+
+ echo
+ echo "# system-server-current"
+ check-flagged-apis list \
+ --api-signature $(path_to_api_signature_file "frameworks-base-api-system-server-current.txt") \
+ --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb
+
+ echo
+ echo "# module-lib"
+ check-flagged-apis list \
+ --api-signature $(path_to_api_signature_file "frameworks-base-api-module-lib-current.txt") \
+ --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb
+}
+
+build_cmd=build
+if [[ "$1" == "--skip-build" ]]; then
+ build_cmd=noop
+ shift 1
fi
+
+case "$1" in
+ check) $build_cmd && run_check ;;
+ list) $build_cmd && run_list ;;
+ *) echo "usage: $(basename $0): [--skip-build] check|list"; exit 1
+esac
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 8e285f6..e07ac1d 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
@@ -358,4 +358,23 @@
parseApiVersions(API_VERSIONS.byteInputStream()))
assertEquals(expected, actual)
}
+
+ @Test
+ fun testListFlaggedApis() {
+ val expected =
+ listOf(
+ "android.flag.bar DISABLED android/Clazz/Builder",
+ "android.flag.foo ENABLED android/Clazz",
+ "android.flag.foo ENABLED android/Clazz/Clazz()",
+ "android.flag.foo ENABLED android/Clazz/FOO",
+ "android.flag.foo ENABLED android/Clazz/getErrorCode()",
+ "android.flag.foo ENABLED android/Clazz/innerClassArg(Landroid/Clazz/Builder;)",
+ "android.flag.foo ENABLED android/Clazz/setData(I[[ILandroid/util/Utility;)",
+ "android.flag.foo ENABLED android/Clazz/setVariableData(I[Landroid/util/Atom;)")
+ val actual =
+ listFlaggedApis(
+ parseApiSignature("in-memory", API_SIGNATURE.byteInputStream()),
+ parseFlagValues(generateFlagsProto(ENABLED, DISABLED)))
+ assertEquals(expected, 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 1d2440d..1125d39 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
@@ -26,6 +26,7 @@
import com.android.tools.metalava.model.text.ApiFile
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.ProgramResult
+import com.github.ajalt.clikt.core.subcommands
import com.github.ajalt.clikt.parameters.options.help
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
@@ -141,6 +142,33 @@
}
}
+val ARG_API_SIGNATURE = "--api-signature"
+val ARG_API_SIGNATURE_HELP =
+ """
+Path to API signature file.
+Usually named *current.txt.
+Tip: `m frameworks-base-api-current.txt` will generate a file that includes all platform and mainline APIs.
+"""
+
+val ARG_FLAG_VALUES = "--flag-values"
+val ARG_FLAG_VALUES_HELP =
+ """
+Path to aconfig parsed_flags binary proto file.
+Tip: `m all_aconfig_declarations` will generate a file that includes all information about all flags.
+"""
+
+val ARG_API_VERSIONS = "--api-versions"
+val ARG_API_VERSIONS_HELP =
+ """
+Path to API versions XML file.
+Usually named xml-versions.xml.
+Tip: `m sdk dist` will generate a file that includes all platform and mainline APIs.
+"""
+
+class MainCommand : CliktCommand() {
+ override fun run() {}
+}
+
class CheckCommand :
CliktCommand(
help =
@@ -152,32 +180,18 @@
The tool will exit with a non-zero exit code if any flagged APIs are found to be used in the incorrect way.
""") {
private val apiSignaturePath by
- option("--api-signature")
- .help(
- """
- Path to API signature file.
- Usually named *current.txt.
- Tip: `m frameworks-base-api-current.txt` will generate a file that includes all platform and mainline APIs.
- """)
+ option(ARG_API_SIGNATURE)
+ .help(ARG_API_SIGNATURE_HELP)
.path(mustExist = true, canBeDir = false, mustBeReadable = true)
.required()
private val flagValuesPath by
- option("--flag-values")
- .help(
- """
- Path to aconfig parsed_flags binary proto file.
- Tip: `m all_aconfig_declarations` will generate a file that includes all information about all flags.
- """)
+ option(ARG_FLAG_VALUES)
+ .help(ARG_FLAG_VALUES_HELP)
.path(mustExist = true, canBeDir = false, mustBeReadable = true)
.required()
private val apiVersionsPath by
- option("--api-versions")
- .help(
- """
- Path to API versions XML file.
- Usually named xml-versions.xml.
- Tip: `m sdk dist` will generate a file that includes all platform and mainline APIs.
- """)
+ option(ARG_API_VERSIONS)
+ .help(ARG_API_VERSIONS_HELP)
.path(mustExist = true, canBeDir = false, mustBeReadable = true)
.required()
@@ -196,6 +210,40 @@
}
}
+class ListCommand :
+ CliktCommand(
+ help =
+ """
+List all flagged APIs and corresponding flags.
+
+The output format is "<fully-qualified-name-of-flag> <state-of-flag> <API>", one line per API.
+
+The output can be post-processed by e.g. piping it to grep to filter out only enabled APIs, or all APIs guarded by a given flag.
+""") {
+ private val apiSignaturePath by
+ option(ARG_API_SIGNATURE)
+ .help(ARG_API_SIGNATURE_HELP)
+ .path(mustExist = true, canBeDir = false, mustBeReadable = true)
+ .required()
+ private val flagValuesPath by
+ option(ARG_FLAG_VALUES)
+ .help(ARG_FLAG_VALUES_HELP)
+ .path(mustExist = true, canBeDir = false, mustBeReadable = true)
+ .required()
+
+ override fun run() {
+ val flaggedSymbols =
+ apiSignaturePath.toFile().inputStream().use {
+ parseApiSignature(apiSignaturePath.toString(), it)
+ }
+ val flags = flagValuesPath.toFile().inputStream().use { parseFlagValues(it) }
+ val output = listFlaggedApis(flaggedSymbols, flags)
+ if (output.isNotEmpty()) {
+ println(output.joinToString("\n"))
+ }
+ }
+}
+
internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbol, Flag>> {
val output = mutableSetOf<Pair<Symbol, Flag>>()
val visitor =
@@ -446,4 +494,35 @@
return errors
}
-fun main(args: Array<String>) = CheckCommand().main(args)
+/**
+ * Collect all known info about all @FlaggedApi annotated APIs.
+ *
+ * Each API will be represented as a String, on the format
+ * <pre>
+ * <fully-qualified-name-of-flag< <state-of-flag< <API<
+ * </pre>
+ *
+ * @param flaggedSymbolsInSource the set of symbols that are flagged in the source code
+ * @param flags the set of flags and their values
+ * @return a list of Strings encoding API data using the format described above, sorted
+ * alphabetically
+ */
+internal fun listFlaggedApis(
+ flaggedSymbolsInSource: Set<Pair<Symbol, Flag>>,
+ flags: Map<Flag, Boolean>
+): List<String> {
+ val output = mutableListOf<String>()
+ for ((symbol, flag) in flaggedSymbolsInSource) {
+ val flagState =
+ when (flags.get(flag)) {
+ true -> "ENABLED"
+ false -> "DISABLED"
+ null -> "UNKNOWN"
+ }
+ output.add("$flag $flagState ${symbol.toPrettyString()}")
+ }
+ output.sort()
+ return output
+}
+
+fun main(args: Array<String>) = MainCommand().subcommands(CheckCommand(), ListCommand()).main(args)
diff --git a/tools/finalization/README.md b/tools/finalization/README.md
index cc97d1f..d0aed69 100644
--- a/tools/finalization/README.md
+++ b/tools/finalization/README.md
@@ -3,18 +3,19 @@
## Automation:
1. [Environment setup](./environment.sh). Set values for varios finalization constants.
-2. [Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh). Prepare the branch for SDK release. SDK contains Android Java APIs and other stable APIs. Commonly referred as a 1st step.
-3. [Finalize Android](./finalize-sdk-rel.sh). Mark branch as "REL", i.e. prepares for Android release. Any signed build containing these changes will be considered an official Android Release. Referred as a 2nd finalization step.
-4. [Finalize SDK and submit](./step-1.sh). Do [Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh) step, create CLs, organize them into topic and send to Gerrit.
- a. [Update SDK and submit](./update-step-1.sh). Same as above, but updates the existings CLs.
-5. [Finalize Android and submit](./step-2.sh). Do [Finalize Android](./finalize-sdk-rel.sh) step, create CLs, organize them into topic and send to Gerrit.
- a. [Update Android and submit](./update-step-2.sh). Same as above, but updates the existings CLs.
+1. [Finalize VINTF](./finalize-vintf-resources.sh). Prepare the branch for VINTF release.
+1. [Finalize SDK](./finalize-sdk-resources.sh). Prepare the branch for SDK release. SDK contains Android Java APIs and other stable APIs. Commonly referred as a 1st step.
+1. [Finalize Android](./finalize-sdk-rel.sh). Mark branch as "REL", i.e. prepares for Android release. Any signed build containing these changes will be considered an official Android Release. Referred as a 2nd finalization step.
+1. [Finalize VINTF and submit](./step-0.sh). Do Finalize VINTF step, create CLs, organize them into topic and send to Gerrit.
+1. [Finalize SDK and submit](./step-1.sh). Do Finalize SDK step, create CLs, organize them into topic and send to Gerrit.
+1. [Finalize Android and submit](./step-2.sh). Do [Finalize Android](./finalize-sdk-rel.sh) step, create CLs, organize them into topic and send to Gerrit.
## CI:
Performed in build targets in Finalization branches.
-1. [Finalization Step 1, git_main-fina-1-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-1-release). Test [1st step/Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh).
-3. [Finalization Step 2, git_main-fina-2-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-2-release). Test [1st step/Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh) and [2nd step/Finalize Android](./finalize-sdk-rel.sh). Use [local finalization](./localonly-steps.sh) to build and copy presubmits.
-5. [Local finalization steps](./localonly-steps.sh) are done only during local testing or in the CI lab. Normally these steps use artifacts from other builds.
+1. [Finalization Step 0, git_main-fina-0-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-0-release). Test Finalize VINTF.
+1. [Finalization Step 1, git_main-fina-1-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-1-release). Test Finalize VINTF, Finalize SDK.
+1. [Finalization Step 2, git_main-fina-2-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-2-release). Test Finalize VINTF, Finalize SDK, and [2nd step/Finalize Android](./finalize-sdk-rel.sh). Use [local finalization](./localonly-steps.sh) to build and copy presubmits.
+1. [Local finalization steps](./localonly-steps.sh) are done only during local testing or in the CI lab. Normally these steps use artifacts from other builds.
## Utility:
[Full cleanup](./cleanup.sh). Remove all local changes and switch each project into head-less state. This is the best state to sync/rebase/finalize the branch.
diff --git a/tools/finalization/build-step-0.sh b/tools/finalization/build-step-0.sh
new file mode 100755
index 0000000..f81b720
--- /dev/null
+++ b/tools/finalization/build-step-0.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Copyright 2024 Google Inc. All rights reserved.
+
+set -ex
+
+function finalize_main_step0() {
+ local top="$(dirname "$0")"/../../../..
+ source $top/build/make/tools/finalization/environment.sh
+
+ if [ "$FINAL_STATE" = "unfinalized" ] ; then
+ # VINTF finalization
+ source $top/build/make/tools/finalization/finalize-vintf-resources.sh
+ fi;
+}
+
+finalize_main_step0
+
diff --git a/tools/finalization/build-step-1-and-2.sh b/tools/finalization/build-step-1-and-2.sh
index 84e2782..ca22678 100755
--- a/tools/finalization/build-step-1-and-2.sh
+++ b/tools/finalization/build-step-1-and-2.sh
@@ -7,11 +7,16 @@
source $top/build/make/tools/finalization/environment.sh
if [ "$FINAL_STATE" = "unfinalized" ] ; then
- # SDK codename -> int
- source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
+ # VINTF finalization
+ source $top/build/make/tools/finalization/finalize-vintf-resources.sh
fi;
- if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "sdk" ] ; then
+ if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "vintf" ] ; then
+ # SDK codename -> int
+ source $top/build/make/tools/finalization/finalize-sdk-resources.sh
+ fi;
+
+ if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "vintf" ] || [ "$FINAL_STATE" = "sdk" ] ; then
# ADB, Platform/Mainline SDKs build and move to prebuilts
source $top/build/make/tools/finalization/localonly-steps.sh
diff --git a/tools/finalization/build-step-1.sh b/tools/finalization/build-step-1.sh
index 3d5eadb..7294698 100755
--- a/tools/finalization/build-step-1.sh
+++ b/tools/finalization/build-step-1.sh
@@ -7,8 +7,13 @@
source $top/build/make/tools/finalization/environment.sh
if [ "$FINAL_STATE" = "unfinalized" ] ; then
+ # VINTF finalization
+ source $top/build/make/tools/finalization/finalize-vintf-resources.sh
+ fi;
+
+ if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "vintf" ] ; then
# Build finalization artifacts.
- source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
+ source $top/build/make/tools/finalization/finalize-sdk-resources.sh
fi;
}
diff --git a/tools/finalization/environment.sh b/tools/finalization/environment.sh
index d9c42c8..7961e8b 100755
--- a/tools/finalization/environment.sh
+++ b/tools/finalization/environment.sh
@@ -19,8 +19,14 @@
# Options:
# 'unfinalized' - branch is in development state,
-# 'sdk' - SDK/API is finalized
+# 'vintf' - VINTF is finalized
+# 'sdk' - VINTF and SDK/API are finalized
# 'rel' - branch is finalized, switched to REL
-export FINAL_STATE='unfinalized'
+export FINAL_STATE='vintf'
-export BUILD_FROM_SOURCE_STUB=true
\ No newline at end of file
+export BUILD_FROM_SOURCE_STUB=true
+
+# FINAL versions for VINTF
+# TODO(b/323985297): The version must match with that from the release configuration.
+# Instead of hardcoding the version here, read it from a release configuration.
+export FINAL_BOARD_API_LEVEL='202404'
diff --git a/tools/finalization/finalize-sdk-rel.sh b/tools/finalization/finalize-sdk-rel.sh
index 245305b..59fe28c 100755
--- a/tools/finalization/finalize-sdk-rel.sh
+++ b/tools/finalization/finalize-sdk-rel.sh
@@ -40,9 +40,6 @@
fi
git -C "$top/cts" mv hostsidetests/theme/assets/${FINAL_PLATFORM_CODENAME} hostsidetests/theme/assets/${FINAL_PLATFORM_SDK_VERSION}
- # system/sepolicy
- system/sepolicy/tools/finalize-sdk-rel.sh "$top" "$FINAL_PLATFORM_SDK_VERSION"
-
# prebuilts/abi-dumps/platform
mkdir -p "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION"
cp -r "$top/prebuilts/abi-dumps/platform/current/64/" "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION/"
@@ -52,10 +49,6 @@
# prebuilts/abi-dumps/ndk
#mkdir -p "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION"
#cp -r "$top/prebuilts/abi-dumps/ndk/current/64/" "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION/"
- #if [ "$FINAL_STATE" != "sdk" ] || [ "$FINAL_PLATFORM_CODENAME" == "$CURRENT_PLATFORM_CODENAME" ] ; then
- # prebuilts/abi-dumps/vndk
- #mv "$top/prebuilts/abi-dumps/vndk/$CURRENT_PLATFORM_CODENAME" "$top/prebuilts/abi-dumps/vndk/$FINAL_PLATFORM_SDK_VERSION"
- #fi;
}
finalize_sdk_rel
diff --git a/tools/finalization/finalize-aidl-vndk-sdk-resources.sh b/tools/finalization/finalize-sdk-resources.sh
similarity index 91%
rename from tools/finalization/finalize-aidl-vndk-sdk-resources.sh
rename to tools/finalization/finalize-sdk-resources.sh
index 75379ff..596f803 100755
--- a/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
+++ b/tools/finalization/finalize-sdk-resources.sh
@@ -96,7 +96,7 @@
$modules_arg
}
-function finalize_aidl_vndk_sdk_resources() {
+function finalize_sdk_resources() {
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
@@ -111,13 +111,6 @@
# bionic/NDK
finalize_bionic_ndk
- # pre-finalization build target (trunk)
- local aidl_m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=trunk TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist"
- AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api
-
- # TODO(b/309880485)
- # Add back create_reference_dumps and $top/build/make/target/product/gsi/current.txt
-
# Finalize SDK
# frameworks/libs/modules-utils
@@ -129,10 +122,6 @@
local build_tools_source="$top/development/sdk/build_tools_source.prop_template"
sed -i -e 's/Pkg\.Revision.*/Pkg\.Revision=${PLATFORM_SDK_VERSION}.0.0/g' $build_tools_source
- # build/make
- sed -i -e "s/sepolicy_major_vers := .*/sepolicy_major_vers := ${FINAL_PLATFORM_SDK_VERSION}/g" "$top/build/make/core/config.mk"
- cp "$top/build/make/target/product/gsi/current.txt" "$top/build/make/target/product/gsi/$FINAL_PLATFORM_SDK_VERSION.txt"
-
# build/soong
local codename_version="\"${FINAL_PLATFORM_CODENAME}\": ${FINAL_PLATFORM_SDK_VERSION}"
if ! grep -q "$codename_version" "$top/build/soong/android/api_levels.go" ; then
@@ -179,5 +168,5 @@
$sdk_m update-api
}
-finalize_aidl_vndk_sdk_resources
+finalize_sdk_resources
diff --git a/tools/finalization/finalize-vintf-resources.sh b/tools/finalization/finalize-vintf-resources.sh
new file mode 100755
index 0000000..a55d8e1
--- /dev/null
+++ b/tools/finalization/finalize-vintf-resources.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+set -ex
+
+function finalize_vintf_resources() {
+ local top="$(dirname "$0")"/../../../..
+ source $top/build/make/tools/finalization/environment.sh
+ # environment needed to build dependencies and run scripts
+ # These should remain the same for all steps here to speed up build time
+ export ANDROID_BUILD_TOP="$top"
+ export ANDROID_HOST_OUT="$ANDROID_BUILD_TOP/out/host/linux-x86"
+ export ANDROID_PRODUCT_OUT="$ANDROID_BUILD_TOP/out/target/product/generic_arm64"
+ export PATH="$PATH:$ANDROID_HOST_OUT/bin/"
+ export TARGET_BUILD_VARIANT=userdebug
+ export DIST_DIR=out/dist
+ export TARGET_RELEASE=fina_0
+ export TARGET_PRODUCT=aosp_arm64
+
+ # TODO(b/314010764): finalize LL_NDK
+
+ # system/sepolicy
+ "$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL"
+
+ create_new_compat_matrix_and_kernel_configs
+
+ # pre-finalization build target (trunk)
+ local aidl_m="$top/build/soong/soong_ui.bash --make-mode"
+ AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api
+}
+
+function create_new_compat_matrix_and_kernel_configs() {
+ # The compatibility matrix versions are bumped during vFRC
+ # These will change every time we have a new vFRC
+ local CURRENT_COMPATIBILITY_MATRIX_LEVEL='202404'
+ local NEXT_COMPATIBILITY_MATRIX_LEVEL='202504'
+ # The kernel configs need the letter of the Android release
+ local CURRENT_RELEASE_LETTER='v'
+ local NEXT_RELEASE_LETTER='w'
+
+
+ # build the targets required before touching the Android.bp/Android.mk files
+ local build_cmd="$top/build/soong/soong_ui.bash --make-mode"
+ $build_cmd bpmodify
+
+ "$top/prebuilts/build-tools/path/linux-x86/python3" "$top/hardware/interfaces/compatibility_matrices/bump.py" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL" "$NEXT_COMPATIBILITY_MATRIX_LEVEL" "$CURRENT_RELEASE_LETTER" "$NEXT_RELEASE_LETTER"
+
+ # Freeze the current framework manifest file. This relies on the
+ # aosp_cf_x86_64-trunk_staging build target to get the right manifest
+ # fragments installed.
+ "$top/system/libhidl/vintfdata/freeze.sh" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL"
+}
+
+function freeze_framework_manifest() {
+ ANDROID_PRODUCT_OUT=~/workspace/internal/main/out/target/product/vsoc_x86 ANDROID_BUILD_TOP=~/workspace/internal/main ANDROID_HOST_OUT=~/workspace/internal/main/out/host/linux-x86 ./freeze.sh 202404
+
+}
+
+
+finalize_vintf_resources
+
diff --git a/tools/finalization/step-0.sh b/tools/finalization/step-0.sh
new file mode 100755
index 0000000..e61c644
--- /dev/null
+++ b/tools/finalization/step-0.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Copyright 2024 Google Inc. All rights reserved.
+
+# Script to perform a 0th step of Android Finalization: VINTF finalization, create CLs and upload to Gerrit.
+
+set -ex
+
+function commit_step_0_changes() {
+ set +e
+ repo forall -c '\
+ if [[ $(git status --short) ]]; then
+ repo start "VINTF-$FINAL_BOARD_API_LEVEL-Finalization" ;
+ git add -A . ;
+ git commit -m "Vendor API level $FINAL_BOARD_API_LEVEL is now frozen" \
+ -m "Ignore-AOSP-First: VINTF $FINAL_BOARD_API_LEVEL Finalization
+Bug: $FINAL_BUG_ID
+Test: build";
+ repo upload --cbr --no-verify -o nokeycheck -t -y . ;
+ fi'
+}
+
+function finalize_step_0_main() {
+ local top="$(dirname "$0")"/../../../..
+ source $top/build/make/tools/finalization/environment.sh
+
+ local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+
+ source $top/build/make/tools/finalization/finalize-vintf-resources.sh
+
+ # move all changes to finalization branch/topic and upload to gerrit
+ commit_step_0_changes
+
+ # build to confirm everything is OK
+ AIDL_FROZEN_REL=true $m
+}
+
+finalize_step_0_main
diff --git a/tools/finalization/step-1.sh b/tools/finalization/step-1.sh
index 0dd4b3a..0e483d5 100755
--- a/tools/finalization/step-1.sh
+++ b/tools/finalization/step-1.sh
@@ -21,10 +21,9 @@
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
- local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
- # vndk etc finalization
- source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
+ source $top/build/make/tools/finalization/finalize-sdk-resources.sh
# move all changes to finalization branch/topic and upload to gerrit
commit_step_1_changes
diff --git a/tools/finalization/step-2.sh b/tools/finalization/step-2.sh
index d0b24ae..356cad0 100755
--- a/tools/finalization/step-2.sh
+++ b/tools/finalization/step-2.sh
@@ -19,7 +19,7 @@
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
- local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+ local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
# prebuilts etc
source $top/build/make/tools/finalization/finalize-sdk-rel.sh
diff --git a/tools/finalization/update-step-1.sh b/tools/finalization/update-step-1.sh
deleted file mode 100755
index b469988..0000000
--- a/tools/finalization/update-step-1.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# Script to perform a 1st step of Android Finalization: API/SDK finalization, update CLs and upload to Gerrit.
-
-# WIP, does not work yet
-exit 10
-
-set -ex
-
-function update_step_1_changes() {
- set +e
- repo forall -c '\
- if [[ $(git status --short) ]]; then
- git stash -u ;
- repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization" ;
- git stash pop ;
- git add -A . ;
- git commit --amend --no-edit ;
- repo upload --cbr --no-verify -o nokeycheck -t -y . ;
- fi'
-}
-
-function update_step_1_main() {
- local top="$(dirname "$0")"/../../../..
- source $top/build/make/tools/finalization/environment.sh
-
-
- local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
-
- # vndk etc finalization
- source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
-
- # update existing CLs and upload to gerrit
- update_step_1_changes
-
- # build to confirm everything is OK
- AIDL_FROZEN_REL=true $m
-}
-
-update_step_1_main
diff --git a/tools/finalization/update-step-2.sh b/tools/finalization/update-step-2.sh
deleted file mode 100755
index d2b8592..0000000
--- a/tools/finalization/update-step-2.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# Script to perform a 2nd step of Android Finalization: REL finalization, create CLs and upload to Gerrit.
-
-# WIP, does not work yet
-exit 10
-
-set -ex
-
-function update_step_2_changes() {
- set +e
- repo forall -c '\
- if [[ $(git status --short) ]]; then
- git stash -u ;
- repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel" ;
- git stash pop ;
- git add -A . ;
- git commit --amend --no-edit ;
- repo upload --cbr --no-verify -o nokeycheck -t -y . ;
- fi'
-}
-
-function update_step_2_main() {
- local top="$(dirname "$0")"/../../../..
- source $top/build/make/tools/finalization/environment.sh
-
- local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
-
- # prebuilts etc
- source $top/build/make/tools/finalization/finalize-sdk-rel.sh
-
- # move all changes to finalization branch/topic and upload to gerrit
- update_step_2_changes
-
- # build to confirm everything is OK
- AIDL_FROZEN_REL=true $m
-}
-
-update_step_2_main
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp
index f32f90b..3d65bc0 100644
--- a/tools/zipalign/ZipAlign.cpp
+++ b/tools/zipalign/ZipAlign.cpp
@@ -200,7 +200,7 @@
}
if (verbose)
- printf("Verification %s\n", foundBad ? "FAILED" : "succesful");
+ printf("Verification %s\n", foundBad ? "FAILED" : "successful");
return foundBad ? 1 : 0;
}