Merge "Add rkpd mainline module"
diff --git a/core/OWNERS b/core/OWNERS
index d48ceab..762d2a7 100644
--- a/core/OWNERS
+++ b/core/OWNERS
@@ -1,4 +1,5 @@
-per-file *dex_preopt*.* = ngeoffray@google.com,skvadrik@google.com
+per-file *dex_preopt*.* = jiakaiz@google.com,ngeoffray@google.com,skvadrik@google.com
+per-file art_*.* = jiakaiz@google.com,ngeoffray@google.com,skvadrik@google.com
per-file verify_uses_libraries.sh = ngeoffray@google.com,skvadrik@google.com
# For global Proguard rules
diff --git a/core/art_config.mk b/core/art_config.mk
new file mode 100644
index 0000000..1ea05db
--- /dev/null
+++ b/core/art_config.mk
@@ -0,0 +1,46 @@
+# ART configuration that has to be determined after product config is resolved.
+#
+# Inputs:
+# PRODUCT_ENABLE_UFFD_GC: See comments in build/make/core/product.mk.
+# OVERRIDE_ENABLE_UFFD_GC: Overrides PRODUCT_ENABLE_UFFD_GC. Can be passed from the commandline for
+# debugging purposes.
+# BOARD_API_LEVEL: See comments in build/make/core/main.mk.
+# BOARD_SHIPPING_API_LEVEL: See comments in build/make/core/main.mk.
+# PRODUCT_SHIPPING_API_LEVEL: See comments in build/make/core/product.mk.
+#
+# Outputs:
+# ENABLE_UFFD_GC: Whether to use userfaultfd GC.
+
+config_enable_uffd_gc := \
+ $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC))
+
+ifeq (,$(filter-out default,$(config_enable_uffd_gc)))
+ ENABLE_UFFD_GC := true
+
+ # Disable userfaultfd GC if the device doesn't support it (i.e., if
+ # `min(ro.board.api_level ?? ro.board.first_api_level ?? MAX_VALUE,
+ # ro.product.first_api_level ?? ro.build.version.sdk ?? MAX_VALUE) < 31`)
+ # This logic aligns with how `ro.vendor.api_level` is calculated in
+ # `system/core/init/property_service.cpp`.
+ # We omit the check on `ro.build.version.sdk` here because we are on the latest build system.
+ board_api_level := $(firstword $(BOARD_API_LEVEL) $(BOARD_SHIPPING_API_LEVEL))
+ ifneq (,$(board_api_level))
+ ifeq (true,$(call math_lt,$(board_api_level),31))
+ ENABLE_UFFD_GC := false
+ endif
+ endif
+
+ ifneq (,$(PRODUCT_SHIPPING_API_LEVEL))
+ ifeq (true,$(call math_lt,$(PRODUCT_SHIPPING_API_LEVEL),31))
+ ENABLE_UFFD_GC := false
+ endif
+ endif
+else ifeq (true,$(config_enable_uffd_gc))
+ ENABLE_UFFD_GC := true
+else ifeq (false,$(config_enable_uffd_gc))
+ ENABLE_UFFD_GC := false
+else
+ $(error Unknown PRODUCT_ENABLE_UFFD_GC value: $(config_enable_uffd_gc))
+endif
+
+ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC)
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index c11b7f4..e36e2eb 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -130,6 +130,7 @@
$(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX))
$(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS))
$(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty)
+ $(call add_json_bool, EnableUffdGc, $(filter true,$(ENABLE_UFFD_GC)))
ifdef TARGET_ARCH
$(call add_json_map, CpuVariant)
diff --git a/core/java_host_unit_test_config_template.xml b/core/java_host_unit_test_config_template.xml
index d8795f9..5d8b254 100644
--- a/core/java_host_unit_test_config_template.xml
+++ b/core/java_host_unit_test_config_template.xml
@@ -23,5 +23,14 @@
<test class="com.android.tradefed.testtype.IsolatedHostTest" >
<option name="jar" value="{MODULE}.jar" />
+ <option name="java-flags" value="--add-modules=jdk.compiler"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
+ <option name="java-flags" value="--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
</test>
</configuration>
diff --git a/core/main.mk b/core/main.mk
index 2e39601..0453cda 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -493,6 +493,8 @@
# Typical build; include any Android.mk files we can find.
#
+include $(BUILD_SYSTEM)/art_config.mk
+
# Bring in dex_preopt.mk
# This creates some modules so it needs to be included after
# should-install-to-system is defined (in order for base_rules.mk to function
diff --git a/core/product.mk b/core/product.mk
index dcfdf1f..4c642b8 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -370,6 +370,18 @@
# If true, installs a full version of com.android.virt APEX.
_product_single_value_vars += PRODUCT_AVF_ENABLED
+# Whether to use userfaultfd GC.
+# Possible values are:
+# - "default" or empty: both the build system and the runtime determine whether to use userfaultfd
+# GC based on the vendor API level
+# - "true": forces the build system to use userfaultfd GC regardless of the vendor API level; the
+# runtime determines whether to use userfaultfd GC based on the kernel support. Note that the
+# device may have to re-compile everything on the first boot if the kernel doesn't support
+# userfaultfd
+# - "false": disallows the build system and the runtime to use userfaultfd GC even if the device
+# supports it
+_product_single_value_vars += PRODUCT_ENABLE_UFFD_GC
+
.KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index b000df6..7d3ae23 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -9,6 +9,7 @@
endif
endif
+include $(BUILD_SYSTEM)/art_config.mk
include $(BUILD_SYSTEM)/dex_preopt_config.mk
ifeq ($(WRITE_SOONG_VARIABLES),true)
diff --git a/envsetup.sh b/envsetup.sh
index 4c1aeaa..3709999 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -35,6 +35,7 @@
- rsgrep: Greps on all local Rust files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
+- pygrep: Greps on all local Python files.
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
@@ -1226,6 +1227,12 @@
-exec grep --color -n "$@" {} +
}
+function pygrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.py" \
+ -exec grep --color -n "$@" {} +
+}
+
case `uname -s` in
Darwin)
function mgrep()
diff --git a/finalize-step-1-for-build-target.sh b/finalize-step-1-for-build-target.sh
new file mode 100755
index 0000000..843c142
--- /dev/null
+++ b/finalize-step-1-for-build-target.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Continuous Integration script for *-finalization-1 branches.
+# Reverts previous finalization script commits and runs local build.
+
+function revert_to_unfinalized_state() {
+ repo forall -c '\
+ git checkout . ; git revert --abort ; git clean -fdx ;\
+ git checkout @ ; git branch fina-step1 -D ; git reset --hard; \
+ repo start fina-step1 ; git checkout @ ; git b fina-step1 -D ;\
+ baselineHash="$(git log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_1_BASELINE_COMMIT)" ;\
+ if [[ $baselineHash ]]; then
+ previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ;\
+ else
+ previousHash="$(git log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;\
+ fi ; \
+ if [[ $previousHash ]]; then git revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;'
+}
+
+function finalize_step_1_main() {
+ local top="$(dirname "$0")"/../..
+ local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
+
+ revert_to_unfinalized_state
+
+ set -ex
+
+ # vndk etc finalization
+ source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
+
+ # build to confirm everything is OK
+ AIDL_FROZEN_REL=true $m
+}
+
+finalize_step_1_main
diff --git a/target/product/aosp_riscv64.mk b/target/product/aosp_riscv64.mk
index 023317b..436ff97 100644
--- a/target/product/aosp_riscv64.mk
+++ b/target/product/aosp_riscv64.mk
@@ -62,6 +62,7 @@
# just the modules that work for riscv64.
PRODUCT_PACKAGES := \
init.environ.rc \
+ init_first_stage \
init_system \
linker \
shell_and_utilities \
diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk
index 20d2865..4e75679 100644
--- a/target/product/default_art_config.mk
+++ b/target/product/default_art_config.mk
@@ -113,3 +113,5 @@
dalvik.vm.image-dex2oat-Xmx=64m \
dalvik.vm.dex2oat-Xms=64m \
dalvik.vm.dex2oat-Xmx=512m \
+
+PRODUCT_ENABLE_UFFD_GC := false # TODO(jiakaiz): Change this to "default".
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index 56a9d8a..24005d9 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -21,7 +21,6 @@
LLNDK: libvulkan.so
VNDK-SP: android.hardware.common-V2-ndk.so
VNDK-SP: android.hardware.common.fmq-V1-ndk.so
-VNDK-SP: android.hardware.graphics.allocator-V1-ndk.so
VNDK-SP: android.hardware.graphics.common-V3-ndk.so
VNDK-SP: android.hardware.graphics.common@1.0.so
VNDK-SP: android.hardware.graphics.common@1.1.so
@@ -31,6 +30,7 @@
VNDK-SP: android.hardware.graphics.mapper@2.1.so
VNDK-SP: android.hardware.graphics.mapper@3.0.so
VNDK-SP: android.hardware.graphics.mapper@4.0.so
+VNDK-SP: android.hardware.graphics.allocator-V1-ndk.so
VNDK-SP: android.hardware.renderscript@1.0.so
VNDK-SP: android.hidl.memory.token@1.0.so
VNDK-SP: android.hidl.memory@1.0-impl.so