1#
2# Copyright (C) 2013 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Provides a functioning ART environment without Android frameworks
18
19$(call inherit-product, $(SRC_TARGET_DIR)/product/default_art_config.mk)
20
21# Additional mixins to the boot classpath.
22PRODUCT_PACKAGES += \
23    android.test.base \
24
25# Why are we pulling in ext, which is frameworks/base, depending on tagsoup and nist-sip?
26PRODUCT_PACKAGES += \
27    ext \
28
29# Runtime (Bionic) APEX module.
30PRODUCT_PACKAGES += com.android.runtime
31
32# ART APEX module.
33#
34# Select either release (com.android.art) or debug (com.android.art.debug)
35# variant of the ART APEX. By default, "user" build variants contain the release
36# module, while the "eng" build variant contain the debug module. However, if
37# `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is defined, it overrides the previous
38# logic:
39# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `false`, the
40#   build will include the release module (whatever the build
41#   variant);
42# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `true`, the
43#   build will include the debug module (whatever the build variant).
44#
45# Note that the ART APEX package includes the minimal boot classpath JARs
46# (listed in ART_APEX_JARS), which should no longer be added directly to
47# PRODUCT_PACKAGES.
48
49art_target_include_debug_build := $(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD)
50ifneq (false,$(art_target_include_debug_build))
51  ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
52    art_target_include_debug_build := true
53  endif
54endif
55
56ifeq (true,$(art_target_include_debug_build))
57  PRODUCT_PACKAGES += com.android.art.debug
58  apex_test_module := art-check-debug-apex-gen-fakebin
59else
60  PRODUCT_PACKAGES += com.android.art
61  apex_test_module := art-check-release-apex-gen-fakebin
62endif
63
64ifeq (true,$(call soong_config_get,art_module,source_build))
65  PRODUCT_HOST_PACKAGES += $(apex_test_module)
66endif
67
68art_target_include_debug_build :=
69apex_test_module :=
70
71# Certificates.
72PRODUCT_PACKAGES += \
73    cacerts \
74
75PRODUCT_PACKAGES += \
76    hiddenapi-package-whitelist.xml \
77
78ifeq (,$(TARGET_BUILD_UNBUNDLED))
79  # Don't depend on the framework boot image profile in unbundled builds where
80  # frameworks/base may not be present.
81  # TODO(b/179900989): We may not need this check once we stop using full
82  # platform products on the thin ART manifest branch.
83  PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION += frameworks/base/boot/boot-image-profile.txt
84endif
85
86# The dalvik.vm.dexopt.thermal-cutoff property must contain one of the values
87# listed here:
88#
89# https://source.android.com/devices/architecture/hidl/thermal-mitigation#thermal-api
90#
91# If the thermal status of the device reaches or exceeds the value set here
92# background dexopt will be terminated and rescheduled using an exponential
93# backoff polcy.
94#
95# The thermal cutoff value is currently set to THERMAL_STATUS_MODERATE.
96PRODUCT_SYSTEM_PROPERTIES += \
97    dalvik.vm.usejit=true \
98    dalvik.vm.dexopt.secondary=true \
99    dalvik.vm.dexopt.thermal-cutoff=2 \
100    dalvik.vm.appimageformat=lz4
101
102PRODUCT_SYSTEM_PROPERTIES += \
103    ro.dalvik.vm.native.bridge?=0
104
105# The install filter is speed-profile in order to enable the use of
106# profiles from the dex metadata files. Note that if a profile is not provided
107# or if it is empty speed-profile is equivalent to (quicken + empty app image).
108# Note that `cmdline` is not strictly needed but it simplifies the management
109# of compilation reason in the platform (as we have a unified, single path,
110# without exceptions).
111# TODO(b/243646876): Remove `pm.dexopt.post-boot`.
112PRODUCT_SYSTEM_PROPERTIES += \
113    pm.dexopt.post-boot?=verify \
114    pm.dexopt.first-boot?=verify \
115    pm.dexopt.boot-after-ota?=verify \
116    pm.dexopt.boot-after-mainline-update?=verify \
117    pm.dexopt.install?=speed-profile \
118    pm.dexopt.install-fast?=skip \
119    pm.dexopt.install-bulk?=speed-profile \
120    pm.dexopt.install-bulk-secondary?=verify \
121    pm.dexopt.install-bulk-downgraded?=verify \
122    pm.dexopt.install-bulk-secondary-downgraded?=verify \
123    pm.dexopt.bg-dexopt?=speed-profile \
124    pm.dexopt.ab-ota?=speed-profile \
125    pm.dexopt.inactive?=verify \
126    pm.dexopt.cmdline?=verify \
127    pm.dexopt.shared?=speed
128
129ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
130    OVERRIDE_DISABLE_DEXOPT_ALL ?= true
131endif
132
133# OVERRIDE_DISABLE_DEXOPT_ALL disables all dexpreopt (build-time) and dexopt (on-device) activities.
134# This option is for faster iteration during development and should never be enabled for production.
135ifneq (,$(filter true,$(OVERRIDE_DISABLE_DEXOPT_ALL)))
136  PRODUCT_SYSTEM_PROPERTIES += \
137    dalvik.vm.disable-art-service-dexopt=true \
138    dalvik.vm.disable-odrefresh=true
139
140  # Disable all dexpreopt activities except for the ART boot image.
141  # We have to dexpreopt the ART boot image because they are used by ART tests. This should not
142  # be too much of a problem for platform developers because a change to framework code should not
143  # trigger dexpreopt for the ART boot image.
144  WITH_DEXPREOPT_ART_BOOT_IMG_ONLY := true
145endif
146
147# Enable resolution of startup const strings.
148PRODUCT_SYSTEM_PROPERTIES += \
149    dalvik.vm.dex2oat-resolve-startup-strings=true
150
151# Specify default block size of 512K to enable parallel image decompression.
152PRODUCT_SYSTEM_PROPERTIES += \
153    dalvik.vm.dex2oat-max-image-block-size=524288
154
155# Enable minidebuginfo generation unless overridden.
156PRODUCT_SYSTEM_PROPERTIES += \
157    dalvik.vm.minidebuginfo=true \
158    dalvik.vm.dex2oat-minidebuginfo=true
159
160# Enable Madvising of the whole art, odex and vdex files to MADV_WILLNEED.
161# The size specified here is the size limit of how much of the file
162# (in bytes) is madvised.
163# We madvise the whole .art file to MADV_WILLNEED with UINT_MAX limit.
164# For odex and vdex files, we limit madvising to 100MB.
165PRODUCT_SYSTEM_PROPERTIES += \
166    dalvik.vm.madvise.vdexfile.size=104857600 \
167    dalvik.vm.madvise.odexfile.size=104857600 \
168    dalvik.vm.madvise.artfile.size=4294967295
169
170# Properties for the Unspecialized App Process Pool
171PRODUCT_SYSTEM_PROPERTIES += \
172    dalvik.vm.usap_pool_enabled?=false \
173    dalvik.vm.usap_refill_threshold?=1 \
174    dalvik.vm.usap_pool_size_max?=3 \
175    dalvik.vm.usap_pool_size_min?=1 \
176    dalvik.vm.usap_pool_refill_delay_ms?=3000
177
178PRODUCT_SYSTEM_PROPERTIES += \
179    dalvik.vm.useartservice=true \
180    dalvik.vm.enable_pr_dexopt=true
181