1// Copyright (C) 2019 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 15package { 16 default_visibility: [":__subpackages__"], 17 default_applicable_licenses: ["Android-Apache-2.0"], 18} 19 20mainline_stubs_args = 21 "--error UnhiddenSystemApi " + 22 "--hide CallbackInterface " + 23 "--hide HiddenTypedefConstant " + 24 "--hide RequiresPermission " + 25 "--enhance-documentation " 26 27// TODO: remove the hiding when server classes are cleaned up. 28mainline_framework_stubs_args = 29 mainline_stubs_args + 30 "--hide-package com.android.server " 31 32priv_apps = " " + 33 "--show-annotation android.annotation.SystemApi\\(" + 34 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + 35 "\\) " 36 37module_libs = " " + 38 " --show-annotation android.annotation.SystemApi\\(" + 39 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + 40 "\\)" + 41 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" + 42 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + 43 "\\) " 44 45mainline_service_stubs_args = 46 mainline_stubs_args + 47 "--show-annotation android.annotation.SystemApi\\(" + 48 "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" + 49 "\\) " + 50 "--hide-annotation android.annotation.Hide " + 51 "--hide InternalClasses " // com.android.* classes are okay in this interface 52 53// Defaults common to all mainline module java_sdk_library instances. 54java_defaults { 55 name: "framework-module-common-defaults", 56 57 // Use the source of annotations that affect metalava doc generation, since 58 // the relevant generation instructions are themselves in javadoc, which is 59 // not present in class files. 60 api_srcs: [":framework-metalava-annotations"], 61 62 // Make the source retention annotations available on the classpath when compiling 63 // the implementation library. (This should be in impl_only_libs but some modules 64 // use these defaults for java_library, sigh.) 65 libs: ["framework-annotations-lib"], 66 67 // Framework modules are not generally shared libraries, i.e. they are not 68 // intended, and must not be allowed, to be used in a <uses-library> manifest 69 // entry. 70 shared_library: false, 71 72 // Prevent dependencies that do not specify an sdk_version from accessing the 73 // implementation library by default and force them to use stubs instead. 74 default_to_stubs: true, 75 76 // Enable api lint. This will eventually become the default for java_sdk_library 77 // but it cannot yet be turned on because some usages have not been cleaned up. 78 // TODO(b/156126315) - Remove when no longer needed. 79 api_lint: { 80 enabled: true, 81 }, 82 83 // The API scope specific properties. 84 public: { 85 enabled: true, 86 sdk_version: "module_current", 87 }, 88 89 // installable implies we'll create a non-apex (platform) variant, which 90 // we shouldn't ordinarily need (and it can create issues), so disable that. 91 installable: false, 92 93 // Configure framework module specific metalava options. 94 droiddoc_options: [mainline_stubs_args], 95 96 annotations_enabled: true, 97 98 // Allow access to the stubs from anywhere 99 visibility: ["//visibility:public"], 100 stubs_library_visibility: ["//visibility:public"], 101 102 // Hide impl library and stub sources 103 impl_library_visibility: [ 104 ":__pkg__", 105 "//frameworks/base/api", // For framework-all 106 ], 107 stubs_source_visibility: ["//visibility:private"], 108 109 defaults_visibility: ["//visibility:private"], 110 111 dist_group: "android", 112} 113 114// Defaults for the java_sdk_libraries of non-updatable modules. 115// java_sdk_libraries using these defaults should also add themselves to the 116// non_updatable_modules list in frameworks/base/api/api.go 117java_defaults { 118 name: "non-updatable-framework-module-defaults", 119 defaults: ["framework-module-common-defaults"], 120 121 system: { 122 enabled: true, 123 sdk_version: "module_current", 124 }, 125 module_lib: { 126 enabled: true, 127 sdk_version: "module_current", 128 }, 129 // Non-updatable modules are allowed to provide @TestApi 130 test: { 131 enabled: true, 132 sdk_version: "module_current", 133 }, 134 135 defaults_visibility: [ 136 "//packages/modules/Virtualization:__subpackages__", 137 ], 138} 139 140// Defaults for mainline module provided java_sdk_library instances. 141java_defaults { 142 name: "framework-module-defaults", 143 defaults: ["framework-module-common-defaults"], 144 sdk_version: "module_current", 145 146 system: { 147 enabled: true, 148 sdk_version: "module_current", 149 }, 150 module_lib: { 151 enabled: true, 152 sdk_version: "module_current", 153 }, 154 155 // Disallow disabling the NewApi lint check. 156 lint: { 157 strict_updatability_linting: true, 158 }, 159 160 defaults_visibility: [ 161 ":__subpackages__", 162 "//frameworks/base/apex:__subpackages__", 163 "//frameworks/base/libs/hwui", 164 "//frameworks/base/wifi", 165 "//packages/modules:__subpackages__", 166 "//packages/providers/MediaProvider:__subpackages__", 167 "//system/apex/apexd:__subpackages__", 168 ], 169} 170 171// Defaults for mainline module system server provided java_sdk_library instances. 172java_defaults { 173 name: "framework-system-server-module-defaults", 174 defaults: ["framework-module-common-defaults"], 175 sdk_version: "system_server_current", 176 177 system_server: { 178 enabled: true, 179 sdk_version: "system_server_current", 180 }, 181 182 // Disallow disabling the NewApi lint check. 183 lint: { 184 strict_updatability_linting: true, 185 }, 186 187 defaults_visibility: [ 188 ":__subpackages__", 189 "//art/libartservice:__subpackages__", 190 "//frameworks/base/apex:__subpackages__", 191 "//packages/modules:__subpackages__", 192 "//system/apex/apexd:__subpackages__", 193 ], 194} 195 196stubs_defaults { 197 name: "service-module-stubs-srcs-defaults", 198 args: mainline_service_stubs_args, 199 installable: false, 200 annotations_enabled: true, 201 merge_annotations_dirs: [ 202 "metalava-manual", 203 ], 204 filter_packages: ["com.android."], 205 check_api: { 206 current: { 207 api_file: "api/current.txt", 208 removed_api_file: "api/removed.txt", 209 }, 210 api_lint: { 211 enabled: true, 212 }, 213 }, 214 dist: { 215 targets: ["sdk"], 216 dir: "apistubs/android/system-server/api", 217 }, 218} 219 220// Empty for now, but a convenient place to add rules for all 221// module java_library system_server stub libs. 222java_defaults { 223 name: "service-module-stubs-defaults", 224 dist: { 225 targets: ["sdk"], 226 dir: "apistubs/android/system-server", 227 }, 228} 229 230filegroup_defaults { 231 name: "framework-sources-module-defaults", 232 visibility: [ 233 "//frameworks/base", 234 "//frameworks/base/api", 235 ], 236 defaults_visibility: ["//visibility:public"], 237} 238 239// These apex_defaults serve as a common place to add properties which should 240// affect all mainline modules. 241 242APEX_LOWEST_MIN_SDK_VERSION = "29" 243DCLA_MIN_SDK_VERSION = "31" 244 245apex_defaults { 246 name: "any-launched-apex-modules", 247 updatable: true, 248 defaults_visibility: ["//visibility:public"], 249} 250 251apex_defaults { 252 name: "q-launched-apex-module", 253 defaults: ["any-launched-apex-modules"], 254 min_sdk_version: "29", 255 defaults_visibility: ["//visibility:public"], 256} 257 258soong_config_module_type_import { 259 from: "system/apex/Android.bp", 260 module_types: [ 261 "library_linking_strategy_apex_defaults", 262 "library_linking_strategy_cc_defaults", 263 ], 264} 265 266library_linking_strategy_apex_defaults { 267 name: "q-launched-dcla-enabled-apex-module", 268 defaults_visibility: [ 269 "//external/conscrypt/apex", 270 "//packages/modules/DnsResolver/apex", 271 "//frameworks/av/apex" 272 ], 273 defaults: ["q-launched-apex-module"], 274 soong_config_variables: { 275 library_linking_strategy: { 276 // Use the Q min_sdk_version 277 prefer_static: {}, 278 // Override the Q min_sdk_version to min_sdk_version that supports dcla 279 conditions_default: { 280 min_sdk_version: DCLA_MIN_SDK_VERSION, 281 }, 282 }, 283 }, 284} 285 286apex_defaults { 287 name: "r-launched-apex-module", 288 defaults: ["any-launched-apex-modules"], 289 min_sdk_version: "30", 290 defaults_visibility: ["//visibility:public"], 291} 292 293library_linking_strategy_apex_defaults { 294 name: "r-launched-dcla-enabled-apex-module", 295 defaults_visibility: [ 296 "//packages/modules/adb:__subpackages__", 297 "//packages/modules/Connectivity/Tethering/apex", 298 ], 299 defaults: ["r-launched-apex-module"], 300 soong_config_variables: { 301 library_linking_strategy: { 302 // Use the R min_sdk_version 303 prefer_static: {}, 304 // Override the R min_sdk_version to min_sdk_version that supports dcla 305 conditions_default: { 306 min_sdk_version: DCLA_MIN_SDK_VERSION, 307 }, 308 }, 309 }, 310} 311 312apex_defaults { 313 name: "s-launched-apex-module", 314 defaults: ["any-launched-apex-modules"], 315 min_sdk_version: "31", 316 updatable: true, 317 // Indicates that pre-installed version of this apex can be compressed. 318 // Whether it actually will be compressed is controlled on per-device basis. 319 compressible:true, 320 defaults_visibility: [ 321 "//art:__subpackages__", 322 "//packages/modules:__subpackages__", 323 ], 324} 325 326apex_defaults { 327 name: "t-launched-apex-module", 328 defaults: ["any-launched-apex-modules"], 329 min_sdk_version: "Tiramisu", 330 // Indicates that pre-installed version of this apex can be compressed. 331 // Whether it actually will be compressed is controlled on per-device basis. 332 compressible: true, 333 defaults_visibility: ["//packages/modules:__subpackages__"], 334} 335 336 337apex_defaults { 338 name: "u-launched-apex-module", 339 defaults: ["any-launched-apex-modules"], 340 min_sdk_version: "UpsideDownCake", 341 // Indicates that pre-installed version of this apex can be compressed. 342 // Whether it actually will be compressed is controlled on per-device basis. 343 compressible: true, 344 defaults_visibility: ["//packages/modules:__subpackages__"], 345} 346 347library_linking_strategy_cc_defaults { 348 name: "apex-lowest-min-sdk-version", 349 defaults_visibility: [ 350 "//system/core/libutils", 351 ], 352 min_sdk_version: APEX_LOWEST_MIN_SDK_VERSION, 353 soong_config_variables: { 354 library_linking_strategy: { 355 prefer_static: { 356 min_sdk_version: "apex_inherit", 357 }, 358 }, 359 }, 360} 361