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 15// 1. The "net-utils-framework-common" library is also compiled into the framework and placed on the 16// boot classpath. It uses jarjar rules so that anything outside the framework can use this 17// library directly. 18// 2. The "net-utils-services-common" library is for use by modules and frameworks/base/services. 19// It does not need to be jarjared because it is not placed on the bootclasspath. 20// 3. The "net-utils-telephony-common-srcs" filegroup is for use specifically by telephony, which 21// places many of its classes, even non-API service classes, on the boot classpath. Any file that 22// is added to this filegroup *must* have a corresponding jarjar rule in the telephony jarjar 23// rules file. Otherwise, it will end up on the boot classpath and other modules will not be able 24// to provide their own copy. 25 26// Note: all filegroups here must have the right path attribute because otherwise, if they are 27// included in the bootclasspath, they could incorrectly be included in the SDK documentation even 28// though they are not in the current.txt files. 29 30java_library { 31 name: "net-utils-device-common", 32 srcs: [ 33 "device/**/*.java", 34 // This library is used by system modules, for which the system health impact of Kotlin 35 // has not yet been evaluated. 36 // "src_devicecommon/**/*.kt", 37 ":framework-annotations", 38 ], 39 sdk_version: "system_current", 40 min_sdk_version: "29", 41 target_sdk_version: "30", 42 apex_available: [ 43 "//apex_available:anyapex", 44 "//apex_available:platform", 45 ], 46 visibility: [ 47 "//frameworks/base/packages/Tethering", 48 "//frameworks/opt/net/ike", 49 "//frameworks/opt/net/wifi/service", 50 "//frameworks/opt/net/telephony", 51 "//packages/modules/NetworkStack", 52 "//packages/modules/CaptivePortalLogin", 53 "//frameworks/libs/net/common/tests:__subpackages__", 54 ], 55 libs: [ 56 "androidx.annotation_annotation", 57 ], 58} 59 60java_library { 61 // Consider using net-tests-utils instead if writing device code. 62 // That library has a lot more useful tools into it for users that 63 // work on Android and includes this lib. 64 name: "net-tests-utils-host-device-common", 65 srcs: [ 66 "hostdevice/**/*.java", 67 "hostdevice/**/*.kt", 68 ], 69 host_supported: true, 70 visibility: [ 71 "//frameworks/libs/net/common/tests:__subpackages__", 72 ], 73 static_libs: [ 74 "kotlin-test" 75 ] 76} 77 78java_defaults { 79 name: "lib_mockito_extended", 80 static_libs: [ 81 "mockito-target-extended-minus-junit4" 82 ], 83 jni_libs: [ 84 "libdexmakerjvmtiagent", 85 "libstaticjvmtiagent", 86 ], 87} 88 89java_library { 90 name: "net-tests-utils", 91 srcs: [ 92 "devicetests/**/*.java", 93 "devicetests/**/*.kt", 94 ], 95 defaults: ["lib_mockito_extended"], 96 libs: [ 97 "androidx.annotation_annotation", 98 ], 99 static_libs: [ 100 "androidx.test.ext.junit", 101 "net-tests-utils-host-device-common", 102 "net-utils-device-common", 103 ], 104} 105 106filegroup { 107 name: "net-utils-framework-common-srcs", 108 srcs: ["framework/**/*.java"], 109 path: "framework", 110 visibility: ["//frameworks/base"], 111} 112 113java_library { 114 name: "net-utils-framework-common", 115 srcs: [ 116 ":net-utils-framework-common-srcs", 117 // TODO: avoid including all framework annotations as they end up in library users jars 118 // and need jarjaring 119 ":framework-annotations", 120 ], 121 sdk_version: "system_current", 122 jarjar_rules: "jarjar-rules-shared.txt", 123 visibility: [ 124 "//cts/tests/tests/net", 125 "//frameworks/base/packages/Tethering", 126 "//frameworks/opt/net/ike", 127 "//frameworks/opt/telephony", 128 "//packages/modules/NetworkStack:__subpackages__", 129 "//packages/modules/CaptivePortalLogin", 130 "//frameworks/libs/net/common/tests:__subpackages__", 131 ] 132} 133 134java_library { 135 name: "net-utils-services-common", 136 srcs: [ 137 "device/android/net/NetworkFactory.java", 138 ":framework-annotations", 139 ], 140 sdk_version: "system_current", 141 visibility: [ 142 "//frameworks/base/services/net", 143 ], 144} 145 146// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be 147// included either (some annotations would be duplicated on the bootclasspath). 148filegroup { 149 name: "net-utils-telephony-common-srcs", 150 srcs: [ 151 // Any class here *must* have a corresponding jarjar rule in the telephony build rules. 152 "device/android/net/NetworkFactory.java", 153 ], 154 path: "device", 155 visibility: [ 156 "//frameworks/opt/telephony", 157 ], 158} 159 160// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar 161// rules on the wifi side. 162// Any class here *must* have a corresponding jarjar rule in the wifi build rules. 163filegroup { 164 name: "net-utils-framework-wifi-common-srcs", 165 srcs: [ 166 "framework/android/net/util/nsd/DnsSdTxtRecord.java", 167 "framework/android/net/util/MacAddressUtils.java", 168 "framework/com/android/net/module/util/**/*.java", 169 ], 170 path: "framework", 171 visibility: [ 172 "//frameworks/base", 173 ], 174} 175 176// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar 177// rules on the wifi side. 178// Any class here *must* have a corresponding jarjar rule in the wifi build rules. 179filegroup { 180 name: "net-utils-wifi-service-common-srcs", 181 srcs: [ 182 "device/android/net/NetworkFactory.java", 183 "framework/android/net/util/NetUtils.java", 184 ], 185 visibility: [ 186 "//frameworks/opt/net/wifi/service", 187 ], 188} 189