1# Copyright (C) 2020 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# This file defines the Soong Config Variable namespace ANDROID, and also any 16# variables in that namespace. 17 18# The expectation is that no vendor should be using the ANDROID namespace. This 19# check ensures that we don't collide with any existing vendor usage. 20 21ifdef SOONG_CONFIG_ANDROID 22$(error The Soong config namespace ANDROID is reserved.) 23endif 24 25$(call add_soong_config_namespace,ANDROID) 26 27# Add variables to the namespace below: 28 29$(call add_soong_config_var,ANDROID,BOARD_USES_ODMIMAGE) 30$(call soong_config_set_bool,ANDROID,BOARD_USES_RECOVERY_AS_BOOT,$(BOARD_USES_RECOVERY_AS_BOOT)) 31$(call soong_config_set_bool,ANDROID,BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT,$(BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT)) 32$(call add_soong_config_var,ANDROID,CHECK_DEV_TYPE_VIOLATIONS) 33$(call soong_config_set_bool,ANDROID,HAS_BOARD_SYSTEM_EXT_PREBUILT_DIR,$(if $(BOARD_SYSTEM_EXT_PREBUILT_DIR),true,false)) 34$(call soong_config_set_bool,ANDROID,HAS_BOARD_PRODUCT_PREBUILT_DIR,$(if $(BOARD_PRODUCT_PREBUILT_DIR),true,false)) 35$(call add_soong_config_var,ANDROID,PLATFORM_SEPOLICY_VERSION) 36$(call add_soong_config_var,ANDROID,PLATFORM_SEPOLICY_COMPAT_VERSIONS) 37$(call add_soong_config_var,ANDROID,PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT) 38$(call soong_config_set_bool,ANDROID,RELEASE_BOARD_API_LEVEL_FROZEN,$(RELEASE_BOARD_API_LEVEL_FROZEN)) 39$(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_DRMSERVER) 40$(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64) 41$(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_MEDIASERVER) 42$(call add_soong_config_var,ANDROID,BOARD_GENFS_LABELS_VERSION) 43 44$(call add_soong_config_var,ANDROID,ADDITIONAL_M4DEFS,$(if $(BOARD_SEPOLICY_M4DEFS),$(addprefix -D,$(BOARD_SEPOLICY_M4DEFS)))) 45 46# For bootable/recovery 47RECOVERY_API_VERSION := 3 48RECOVERY_FSTAB_VERSION := 2 49$(call soong_config_set, recovery, recovery_api_version, $(RECOVERY_API_VERSION)) 50$(call soong_config_set, recovery, recovery_fstab_version, $(RECOVERY_FSTAB_VERSION)) 51$(call soong_config_set_bool, recovery ,target_userimages_use_f2fs ,$(if $(TARGET_USERIMAGES_USE_F2FS),true,false)) 52$(call soong_config_set_bool, recovery ,has_board_cacheimage_partition_size ,$(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),true,false)) 53ifdef TARGET_RECOVERY_UI_LIB 54 $(call soong_config_set_string_list, recovery, target_recovery_ui_lib, $(TARGET_RECOVERY_UI_LIB)) 55endif 56 57# For Sanitizers 58$(call soong_config_set_bool,ANDROID,ASAN_ENABLED,$(if $(filter address,$(SANITIZE_TARGET)),true,false)) 59$(call soong_config_set_bool,ANDROID,HWASAN_ENABLED,$(if $(filter hwaddress,$(SANITIZE_TARGET)),true,false)) 60$(call soong_config_set_bool,ANDROID,SANITIZE_TARGET_SYSTEM_ENABLED,$(if $(filter true,$(SANITIZE_TARGET_SYSTEM)),true,false)) 61 62# For init.environ.rc 63$(call soong_config_set_bool,ANDROID,GCOV_COVERAGE,$(NATIVE_COVERAGE)) 64$(call soong_config_set_bool,ANDROID,CLANG_COVERAGE,$(CLANG_COVERAGE)) 65$(call soong_config_set,ANDROID,SCUDO_ALLOCATION_RING_BUFFER_SIZE,$(PRODUCT_SCUDO_ALLOCATION_RING_BUFFER_SIZE)) 66 67$(call soong_config_set_bool,ANDROID,EMMA_INSTRUMENT,$(if $(filter true,$(EMMA_INSTRUMENT)),true,false)) 68 69# PRODUCT_PRECOMPILED_SEPOLICY defaults to true. Explicitly check if it's "false" or not. 70$(call soong_config_set_bool,ANDROID,PRODUCT_PRECOMPILED_SEPOLICY,$(if $(filter false,$(PRODUCT_PRECOMPILED_SEPOLICY)),false,true)) 71 72# For art modules 73$(call soong_config_set_bool,art_module,host_prefer_32_bit,$(if $(filter true,$(HOST_PREFER_32_BIT)),true,false)) 74ifdef ART_DEBUG_OPT_FLAG 75$(call soong_config_set,art_module,art_debug_opt_flag,$(ART_DEBUG_OPT_FLAG)) 76endif 77# The default value of ART_BUILD_HOST_DEBUG is true 78$(call soong_config_set_bool,art_module,art_build_host_debug,$(if $(filter false,$(ART_BUILD_HOST_DEBUG)),false,true)) 79 80# For chre 81$(call soong_config_set_bool,chre,chre_daemon_lama_enabled,$(if $(filter true,$(CHRE_DAEMON_LPMA_ENABLED)),true,false)) 82$(call soong_config_set_bool,chre,chre_dedicated_transport_channel_enabled,$(if $(filter true,$(CHRE_DEDICATED_TRANSPORT_CHANNEL_ENABLED)),true,false)) 83$(call soong_config_set_bool,chre,chre_log_atom_extension_enabled,$(if $(filter true,$(CHRE_LOG_ATOM_EXTENSION_ENABLED)),true,false)) 84 85ifdef TARGET_BOARD_AUTO 86 $(call add_soong_config_var_value, ANDROID, target_board_auto, $(TARGET_BOARD_AUTO)) 87endif 88 89# Apex build mode variables 90ifdef APEX_BUILD_FOR_PRE_S_DEVICES 91$(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static) 92else 93ifdef KEEP_APEX_INHERIT 94$(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static) 95endif 96endif 97 98# Enable SystemUI optimizations by default unless explicitly set. 99SYSTEMUI_OPTIMIZE_JAVA ?= true 100$(call add_soong_config_var,ANDROID,SYSTEMUI_OPTIMIZE_JAVA) 101 102# Flag to use baseline profile for SystemUI. 103$(call soong_config_set,ANDROID,release_systemui_use_speed_profile,$(RELEASE_SYSTEMUI_USE_SPEED_PROFILE)) 104 105# Flag for enabling compose for Launcher. 106$(call soong_config_set,ANDROID,release_enable_compose_in_launcher,$(RELEASE_ENABLE_COMPOSE_IN_LAUNCHER)) 107 108ifdef PRODUCT_AVF_ENABLED 109$(call add_soong_config_var_value,ANDROID,avf_enabled,$(PRODUCT_AVF_ENABLED)) 110endif 111 112# Enable AVF remote attestation according to the flag value if PRODUCT_AVF_REMOTE_ATTESTATION_DISABLED is not 113# set to true explicitly. 114ifneq (true,$(PRODUCT_AVF_REMOTE_ATTESTATION_DISABLED)) 115 $(call add_soong_config_var_value,ANDROID,avf_remote_attestation_enabled,$(RELEASE_AVF_ENABLE_REMOTE_ATTESTATION)) 116endif 117 118ifdef PRODUCT_AVF_MICRODROID_GUEST_GKI_VERSION 119$(call add_soong_config_var_value,ANDROID,avf_microdroid_guest_gki_version,$(PRODUCT_AVF_MICRODROID_GUEST_GKI_VERSION)) 120endif 121 122ifdef TARGET_BOOTS_16K 123$(call soong_config_set_bool,ANDROID,target_boots_16k,$(filter true,$(TARGET_BOOTS_16K))) 124endif 125 126ifdef PRODUCT_MEMCG_V2_FORCE_ENABLED 127$(call add_soong_config_var_value,ANDROID,memcg_v2_force_enabled,$(PRODUCT_MEMCG_V2_FORCE_ENABLED)) 128endif 129 130ifdef PRODUCT_CGROUP_V2_SYS_APP_ISOLATION_ENABLED 131$(call add_soong_config_var_value,ANDROID,cgroup_v2_sys_app_isolation,$(PRODUCT_CGROUP_V2_SYS_APP_ISOLATION_ENABLED)) 132endif 133 134$(call add_soong_config_var_value,ANDROID,release_avf_allow_preinstalled_apps,$(RELEASE_AVF_ALLOW_PREINSTALLED_APPS)) 135$(call add_soong_config_var_value,ANDROID,release_avf_enable_device_assignment,$(RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT)) 136$(call add_soong_config_var_value,ANDROID,release_avf_enable_dice_changes,$(RELEASE_AVF_ENABLE_DICE_CHANGES)) 137$(call add_soong_config_var_value,ANDROID,release_avf_enable_early_vm,$(RELEASE_AVF_ENABLE_EARLY_VM)) 138$(call add_soong_config_var_value,ANDROID,release_avf_enable_llpvm_changes,$(RELEASE_AVF_ENABLE_LLPVM_CHANGES)) 139$(call add_soong_config_var_value,ANDROID,release_avf_enable_multi_tenant_microdroid_vm,$(RELEASE_AVF_ENABLE_MULTI_TENANT_MICRODROID_VM)) 140$(call add_soong_config_var_value,ANDROID,release_avf_enable_network,$(RELEASE_AVF_ENABLE_NETWORK)) 141# TODO(b/341292601): This flag is needed until the V release. We with clean it up after V together 142# with most of the release_avf_ flags here. 143$(call add_soong_config_var_value,ANDROID,release_avf_enable_remote_attestation,$(RELEASE_AVF_ENABLE_REMOTE_ATTESTATION)) 144$(call add_soong_config_var_value,ANDROID,release_avf_enable_vendor_modules,$(RELEASE_AVF_ENABLE_VENDOR_MODULES)) 145$(call add_soong_config_var_value,ANDROID,release_avf_enable_virt_cpufreq,$(RELEASE_AVF_ENABLE_VIRT_CPUFREQ)) 146$(call add_soong_config_var_value,ANDROID,release_avf_microdroid_kernel_version,$(RELEASE_AVF_MICRODROID_KERNEL_VERSION)) 147$(call add_soong_config_var_value,ANDROID,release_avf_support_custom_vm_with_paravirtualized_devices,$(RELEASE_AVF_SUPPORT_CUSTOM_VM_WITH_PARAVIRTUALIZED_DEVICES)) 148 149$(call add_soong_config_var_value,ANDROID,release_binder_death_recipient_weak_from_jni,$(RELEASE_BINDER_DEATH_RECIPIENT_WEAK_FROM_JNI)) 150 151$(call add_soong_config_var_value,ANDROID,release_libpower_no_lock_binder_txn,$(RELEASE_LIBPOWER_NO_LOCK_BINDER_TXN)) 152 153$(call add_soong_config_var_value,ANDROID,release_package_libandroid_runtime_punch_holes,$(RELEASE_PACKAGE_LIBANDROID_RUNTIME_PUNCH_HOLES)) 154 155$(call add_soong_config_var_value,ANDROID,release_selinux_data_data_ignore,$(RELEASE_SELINUX_DATA_DATA_IGNORE)) 156ifneq (,$(filter eng userdebug,$(TARGET_BUILD_VARIANT))) 157 # write appcompat system properties on userdebug and eng builds 158 $(call add_soong_config_var_value,ANDROID,release_write_appcompat_override_system_properties,true) 159endif 160 161# Enable system_server optimizations by default unless explicitly set or if 162# there may be dependent runtime jars. 163# TODO(b/240588226): Remove the off-by-default exceptions after handling 164# system_server jars automatically w/ R8. 165ifeq (true,$(PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS)) 166 # If system_server jar ordering is broken, don't assume services.jar can be 167 # safely optimized in isolation, as there may be dependent jars. 168 SYSTEM_OPTIMIZE_JAVA ?= false 169else ifneq (platform:services,$(lastword $(PRODUCT_SYSTEM_SERVER_JARS))) 170 # If services is not the final jar in the dependency ordering, don't assume 171 # it can be safely optimized in isolation, as there may be dependent jars. 172 SYSTEM_OPTIMIZE_JAVA ?= false 173else 174 SYSTEM_OPTIMIZE_JAVA ?= true 175endif 176 177ifeq (true,$(FULL_SYSTEM_OPTIMIZE_JAVA)) 178 SYSTEM_OPTIMIZE_JAVA := true 179endif 180 181$(call add_soong_config_var,ANDROID,SYSTEM_OPTIMIZE_JAVA) 182$(call add_soong_config_var,ANDROID,FULL_SYSTEM_OPTIMIZE_JAVA) 183 184# TODO(b/319697968): Remove this build flag support when metalava fully supports flagged api 185$(call soong_config_set,ANDROID,release_hidden_api_exportable_stubs,$(RELEASE_HIDDEN_API_EXPORTABLE_STUBS)) 186 187# Check for SupplementalApi module. 188ifeq ($(wildcard packages/modules/SupplementalApi),) 189$(call add_soong_config_var_value,ANDROID,include_nonpublic_framework_api,false) 190else 191$(call add_soong_config_var_value,ANDROID,include_nonpublic_framework_api,true) 192endif 193 194# Add crashrecovery build flag to soong 195$(call soong_config_set,ANDROID,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE)) 196# Add crashrecovery file move flags to soong, for both platform and module 197ifeq (true,$(RELEASE_CRASHRECOVERY_FILE_MOVE)) 198 $(call soong_config_set,ANDROID,crashrecovery_files_in_module,true) 199 $(call soong_config_set,ANDROID,crashrecovery_files_in_platform,false) 200else 201 $(call soong_config_set,ANDROID,crashrecovery_files_in_module,false) 202 $(call soong_config_set,ANDROID,crashrecovery_files_in_platform,true) 203endif 204# Required as platform_bootclasspath is using this namespace 205$(call soong_config_set,bootclasspath,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE)) 206 207 208# Add ondeviceintelligence module build flag to soong 209ifeq (true,$(RELEASE_ONDEVICE_INTELLIGENCE_MODULE)) 210 $(call soong_config_set,ANDROID,release_ondevice_intelligence_module,true) 211 # Required as platform_bootclasspath is using this namespace 212 $(call soong_config_set,bootclasspath,release_ondevice_intelligence_module,true) 213 214else 215 $(call soong_config_set,ANDROID,release_ondevice_intelligence_platform,true) 216 $(call soong_config_set,bootclasspath,release_ondevice_intelligence_platform,true) 217 218endif 219 220# Add uprobestats build flag to soong 221$(call soong_config_set,ANDROID,release_uprobestats_module,$(RELEASE_UPROBESTATS_MODULE)) 222# Add uprobestats file move flags to soong, for both platform and module 223ifeq (true,$(RELEASE_UPROBESTATS_FILE_MOVE)) 224 $(call soong_config_set,ANDROID,uprobestats_files_in_module,true) 225 $(call soong_config_set,ANDROID,uprobestats_files_in_platform,false) 226else 227 $(call soong_config_set,ANDROID,uprobestats_files_in_module,false) 228 $(call soong_config_set,ANDROID,uprobestats_files_in_platform,true) 229endif 230 231# Enable Profiling module. Also used by platform_bootclasspath. 232$(call soong_config_set,ANDROID,release_package_profiling_module,$(RELEASE_PACKAGE_PROFILING_MODULE)) 233$(call soong_config_set,bootclasspath,release_package_profiling_module,$(RELEASE_PACKAGE_PROFILING_MODULE)) 234 235# Add perf-setup build flag to soong 236# Note: BOARD_PERFSETUP_SCRIPT location must be under platform_testing/scripts/perf-setup/. 237ifdef BOARD_PERFSETUP_SCRIPT 238 $(call soong_config_set,perf,board_perfsetup_script,$(notdir $(BOARD_PERFSETUP_SCRIPT))) 239endif 240 241# Add target_use_pan_display flag for hardware/libhardware:gralloc.default 242$(call soong_config_set_bool,gralloc,target_use_pan_display,$(if $(filter true,$(TARGET_USE_PAN_DISPLAY)),true,false)) 243 244# Add use_camera_v4l2_hal flag for hardware/libhardware/modules/camera/3_4:camera.v4l2 245$(call soong_config_set_bool,camera,use_camera_v4l2_hal,$(if $(filter true,$(USE_CAMERA_V4L2_HAL)),true,false)) 246 247# Add audioserver_multilib flag for hardware/interfaces/soundtrigger/2.0/default:[email protected] 248ifneq ($(strip $(AUDIOSERVER_MULTILIB)),) 249 $(call soong_config_set,soundtrigger,audioserver_multilib,$(AUDIOSERVER_MULTILIB)) 250endif 251 252# Add sim_count, disable_rild_oem_hook, and use_aosp_rild flag for ril related modules 253$(call soong_config_set,ril,sim_count,$(SIM_COUNT)) 254ifneq ($(DISABLE_RILD_OEM_HOOK), false) 255 $(call soong_config_set_bool,ril,disable_rild_oem_hook,true) 256endif 257ifneq ($(ENABLE_VENDOR_RIL_SERVICE), true) 258 $(call soong_config_set_bool,ril,use_aosp_rild,true) 259endif 260 261# Export target_board_platform to soong for hardware/google/graphics/common/libmemtrack:memtrack.$(TARGET_BOARD_PLATFORM) 262$(call soong_config_set,ANDROID,target_board_platform,$(TARGET_BOARD_PLATFORM)) 263 264# Export board_uses_scaler_m2m1shot and board_uses_align_restriction to soong for hardware/google/graphics/common/libscaler:libexynosscaler 265$(call soong_config_set_bool,google_graphics,board_uses_scaler_m2m1shot,$(if $(filter true,$(BOARD_USES_SCALER_M2M1SHOT)),true,false)) 266$(call soong_config_set_bool,google_graphics,board_uses_align_restriction,$(if $(filter true,$(BOARD_USES_ALIGN_RESTRICTION)),true,false)) 267 268# Export related variables to soong for hardware/google/graphics/common/libacryl:libacryl 269ifdef BOARD_LIBACRYL_DEFAULT_COMPOSITOR 270 $(call soong_config_set,acryl,libacryl_default_compositor,$(BOARD_LIBACRYL_DEFAULT_COMPOSITOR)) 271endif 272ifdef BOARD_LIBACRYL_DEFAULT_SCALER 273 $(call soong_config_set,acryl,libacryl_default_scaler,$(BOARD_LIBACRYL_DEFAULT_SCALER)) 274endif 275ifdef BOARD_LIBACRYL_DEFAULT_BLTER 276 $(call soong_config_set,acryl,libacryl_default_blter,$(BOARD_LIBACRYL_DEFAULT_BLTER)) 277endif 278ifdef BOARD_LIBACRYL_G2D_HDR_PLUGIN 279 #BOARD_LIBACRYL_G2D_HDR_PLUGIN is set in each board config 280 $(call soong_config_set_bool,acryl,libacryl_use_g2d_hdr_plugin,true) 281endif 282 283# Export related variables to soong for hardware/google/graphics/common/BoardConfigCFlags.mk 284$(call soong_config_set_bool,google_graphics,hwc_no_support_skip_validate,$(if $(filter true,$(HWC_NO_SUPPORT_SKIP_VALIDATE)),true,false)) 285$(call soong_config_set_bool,google_graphics,hwc_support_color_transform,$(if $(filter true,$(HWC_SUPPORT_COLOR_TRANSFORM)),true,false)) 286$(call soong_config_set_bool,google_graphics,hwc_support_render_intent,$(if $(filter true,$(HWC_SUPPORT_RENDER_INTENT)),true,false)) 287$(call soong_config_set_bool,google_graphics,board_uses_virtual_display,$(if $(filter true,$(BOARD_USES_VIRTUAL_DISPLAY)),true,false)) 288$(call soong_config_set_bool,google_graphics,board_uses_dt,$(if $(filter true,$(BOARD_USES_DT)),true,false)) 289$(call soong_config_set_bool,google_graphics,board_uses_decon_64bit_address,$(if $(filter true,$(BOARD_USES_DECON_64BIT_ADDRESS)),true,false)) 290$(call soong_config_set_bool,google_graphics,board_uses_hdrui_gles_conversion,$(if $(filter true,$(BOARD_USES_HDRUI_GLES_CONVERSION)),true,false)) 291$(call soong_config_set_bool,google_graphics,uses_idisplay_intf_sec,$(if $(filter true,$(USES_IDISPLAY_INTF_SEC)),true,false)) 292 293# Variables for fs_config 294$(call soong_config_set_bool,fs_config,vendor,$(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),true,false)) 295$(call soong_config_set_bool,fs_config,oem,$(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),true,false)) 296$(call soong_config_set_bool,fs_config,odm,$(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),true,false)) 297$(call soong_config_set_bool,fs_config,vendor_dlkm,$(if $(BOARD_USES_VENDOR_DLKMIMAGE)$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),true,false)) 298$(call soong_config_set_bool,fs_config,odm_dlkm,$(if $(BOARD_USES_ODM_DLKMIMAGE)$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),true,false)) 299$(call soong_config_set_bool,fs_config,system_dlkm,$(if $(BOARD_USES_SYSTEM_DLKMIMAGE)$(BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE),true,false)) 300 301# Variables for telephony 302$(call soong_config_set_bool,telephony,sec_cp_secure_boot,$(if $(filter true,$(SEC_CP_SECURE_BOOT)),true,false)) 303$(call soong_config_set_bool,telephony,cbd_protocol_sit,$(if $(filter true,$(CBD_PROTOCOL_SIT)),true,false)) 304$(call soong_config_set_bool,telephony,use_radioexternal_hal_aidl,$(if $(filter true,$(USE_RADIOEXTERNAL_HAL_AIDL)),true,false)) 305