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 BroadcastBehavior " + 23 "--hide CallbackInterface " + 24 "--hide DeprecationMismatch " + 25 "--hide HiddenSuperclass " + 26 "--hide HiddenTypedefConstant " + 27 "--hide HiddenTypeParameter " + 28 "--hide MissingPermission " + 29 "--hide RequiresPermission " + 30 "--hide SdkConstant " + 31 "--hide Todo " + 32 "--hide Typo " + 33 "--hide UnavailableSymbol " 34 35// TODO: modularize this so not every module has the same list 36framework_packages_to_document = [ 37 "android", 38 "dalvik", 39 "java", 40 "javax", 41 "junit", 42 "org.apache.http", 43 "org.json", 44 "org.w3c.dom", 45 "org.xml.sax", 46 "org.xmlpull", 47] 48 49// TODO: remove the hiding when server classes are cleaned up. 50mainline_framework_stubs_args = 51 mainline_stubs_args + 52 "--hide-package com.android.server " 53 54priv_apps = " " + 55 "--show-annotation android.annotation.SystemApi\\(" + 56 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + 57 "\\) " 58 59module_libs = " " + 60 " --show-annotation android.annotation.SystemApi\\(" + 61 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + 62 "\\)" + 63 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" + 64 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + 65 "\\) " 66 67mainline_service_stubs_args = 68 mainline_stubs_args + 69 "--show-annotation android.annotation.SystemApi\\(" + 70 "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" + 71 "\\) " + 72 "--hide-annotation android.annotation.Hide " + 73 "--hide InternalClasses " // com.android.* classes are okay in this interface 74 75// Defaults common to all mainline module java_sdk_library instances. 76java_defaults { 77 name: "framework-module-common-defaults", 78 79 // Additional annotations used for compiling both the implementation and the 80 // stubs libraries. 81 libs: ["framework-annotations-lib"], 82 83 // Framework modules are not generally shared libraries, i.e. they are not 84 // intended, and must not be allowed, to be used in a <uses-library> manifest 85 // entry. 86 shared_library: false, 87 88 // Prevent dependencies that do not specify an sdk_version from accessing the 89 // implementation library by default and force them to use stubs instead. 90 default_to_stubs: true, 91 92 // Enable api lint. This will eventually become the default for java_sdk_library 93 // but it cannot yet be turned on because some usages have not been cleaned up. 94 // TODO(b/156126315) - Remove when no longer needed. 95 api_lint: { 96 enabled: true, 97 }, 98 99 // The API scope specific properties. 100 public: { 101 enabled: true, 102 sdk_version: "module_current", 103 }, 104 105 // installable implies we'll create a non-apex (platform) variant, which 106 // we shouldn't ordinarily need (and it can create issues), so disable that. 107 installable: false, 108 109 // Configure framework module specific metalava options. 110 droiddoc_options: [mainline_stubs_args], 111 112 annotations_enabled: true, 113 114 // Allow access to the stubs from anywhere 115 visibility: ["//visibility:public"], 116 stubs_library_visibility: ["//visibility:public"], 117 118 // Hide impl library and stub sources 119 impl_library_visibility: [ 120 ":__pkg__", 121 "//frameworks/base", // For framework-all 122 ], 123 stubs_source_visibility: ["//visibility:private"], 124 125 defaults_visibility: ["//visibility:private"], 126 127 // Collates API usages from each module for further analysis. 128 plugins: ["java_api_finder"], 129 130 dist_group: "android", 131} 132 133// Defaults for mainline module provided java_sdk_library instances. 134java_defaults { 135 name: "framework-module-defaults", 136 defaults: ["framework-module-common-defaults"], 137 sdk_version: "module_current", 138 139 system: { 140 enabled: true, 141 sdk_version: "module_current", 142 }, 143 module_lib: { 144 enabled: true, 145 sdk_version: "module_current", 146 }, 147 defaults_visibility: [ 148 ":__subpackages__", 149 "//frameworks/base/apex:__subpackages__", 150 "//frameworks/base/libs/hwui", 151 // TODO: remove after moving connectivity to packages/modules 152 "//frameworks/base/packages/Connectivity:__subpackages__", 153 "//frameworks/base/wifi", 154 "//packages/modules:__subpackages__", 155 "//packages/providers/MediaProvider:__subpackages__", 156 ], 157} 158 159// Defaults for mainline module system server provided java_sdk_library instances. 160java_defaults { 161 name: "framework-system-server-module-defaults", 162 defaults: ["framework-module-common-defaults"], 163 sdk_version: "system_server_current", 164 165 system_server: { 166 enabled: true, 167 sdk_version: "system_server_current", 168 }, 169 defaults_visibility: [ 170 ":__subpackages__", 171 "//art/libartservice:__subpackages__", 172 "//frameworks/base/apex:__subpackages__", 173 "//packages/modules:__subpackages__", 174 ], 175} 176 177stubs_defaults { 178 name: "service-module-stubs-srcs-defaults", 179 args: mainline_service_stubs_args, 180 installable: false, 181 annotations_enabled: true, 182 merge_annotations_dirs: [ 183 "metalava-manual", 184 ], 185 filter_packages: ["com.android."], 186 check_api: { 187 current: { 188 api_file: "api/current.txt", 189 removed_api_file: "api/removed.txt", 190 }, 191 api_lint: { 192 enabled: true, 193 }, 194 }, 195 dist: { 196 targets: ["sdk", "win_sdk"], 197 dir: "apistubs/android/system-server/api", 198 }, 199} 200 201// Empty for now, but a convenient place to add rules for all 202// module java_library system_server stub libs. 203java_defaults { 204 name: "service-module-stubs-defaults", 205 dist: { 206 targets: ["sdk", "win_sdk"], 207 dir: "apistubs/android/system-server", 208 }, 209} 210