Commit 7bcb2f94 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6439596 from 268b5fa0 to qt-aml-tzdata-release

Change-Id: I6f532acbc05bdd74c75644f5f4fc76a1ce88a62d
parents dee50612 268b5fa0
......@@ -14,122 +14,81 @@
// limitations under the License.
//
// The network stack can be compiled using system_current (non-finalized) SDK, or finalized system_X
// SDK. There is also a variant that uses system_current SDK and runs in the system process
// (InProcessNetworkStack). The following structure is used to create the build rules:
//
// NetworkStackAndroidLibraryDefaults <-- common defaults for android libs
// / \
// +NetworkStackApiStableShims --> / \ <-- +NetworkStackApiCurrentShims
// +NetworkStackApiStableLevel / \ +NetworkStackApiCurrentLevel
// +jarjar apistub.api[latest].* / \ +module src/
// to apistub.* / \
// / \
// NetworkStackApiStableDependencies \
// / \ android libs w/ all code
// +module src/ --> / \ (also used in unit tests)
// / \ |
// NetworkStackApiStableLib NetworkStackApiCurrentLib <--*
// | |
// | <-- +NetworkStackAppDefaults --> |
// | (APK build params) |
// | |
// | <-- +NetworkStackApiStableLevel | <-- +NetworkStackApiCurrentLevel
// | |
// | |
// NetworkStackApiStable NetworkStack, InProcessNetworkStack, <-- APKs
// TestNetworkStack
// Common defaults to define SDK level
java_defaults {
name: "NetworkStackApiCurrentLevel",
java_library {
name: "captiveportal-lib",
srcs: ["common/**/*.java"],
libs: [
"androidx.annotation_annotation",
],
sdk_version: "system_current",
min_sdk_version: "28",
}
java_defaults {
name: "NetworkStackApiStableLevel",
sdk_version: "system_29",
name: "NetworkStackCommon",
sdk_version: "system_current",
min_sdk_version: "28",
}
// Filegroups for the API shims
filegroup {
name: "NetworkStackApiCurrentShims",
srcs: [
"apishim/common/**/*.java",
"apishim/29/**/*.java",
"apishim/current/**/*.java",
":net-module-utils-srcs",
],
}
// API stable shims only include the compat package, but it is jarjared to replace the non-compat
// package
filegroup {
name: "NetworkStackApiStableShims",
srcs: [
"apishim/common/**/*.java",
"apishim/29/**/*.java",
":net-module-utils-srcs",
],
}
// Common defaults for android libraries containing network stack code, used to compile variants of
// the network stack in the system process and in the network_stack process
java_defaults {
name: "NetworkStackAndroidLibraryDefaults",
// Library including the network stack, used to compile both variants of the network stack
android_library {
name: "NetworkStackBase",
defaults: ["NetworkStackCommon"],
srcs: [
"src/**/*.java",
":framework-networkstack-shared-srcs",
":services-networkstack-shared-srcs",
":statslog-networkstack-java-gen",
],
static_libs: [
"androidx.annotation_annotation",
"ipmemorystore-client",
"netd_aidl_interface-V2-java",
"networkstack-client",
"networkstack-aidl-interfaces-V3-java",
"datastallprotosnano",
"networkstackprotosnano",
"captiveportal-lib",
],
plugins: ["java_api_finder"],
}
// The versions of the android library containing network stack code compiled for each SDK variant
// API current uses the sources of the API current shims directly.
// This allows API current code to be treated identically to code in src/ (it will be moved
// there eventually), and to use the compat shim as fallback on older devices.
android_library {
name: "NetworkStackApiCurrentLib",
defaults: ["NetworkStackApiCurrentLevel", "NetworkStackAndroidLibraryDefaults"],
srcs: [":NetworkStackApiCurrentShims", "src/**/*.java"],
manifest: "AndroidManifestBase.xml",
plugins: ["java_api_finder"],
}
// For API stable, first build the dependencies using jarjar compat rules, then build the sources
// linking with the dependencies.
java_library {
name: "NetworkStackApiStableDependencies",
defaults: ["NetworkStackApiStableLevel", "NetworkStackAndroidLibraryDefaults"],
srcs: [":NetworkStackApiStableShims"],
jarjar_rules: "apishim/jarjar-rules-compat.txt",
}
cc_library_shared {
name: "libnetworkstackutilsjni",
srcs: [
"jni/network_stack_utils_jni.cpp"
],
sdk_version: "current",
shared_libs: [
"liblog",
"libnativehelper_compat_libc++",
],
android_library {
name: "NetworkStackApiStableLib",
defaults: ["NetworkStackApiStableLevel"],
srcs: ["src/**/*.java"],
// API stable uses a jarjared version of the shims
static_libs: [
"NetworkStackApiStableDependencies",
// We cannot use plain "libc++" here to link libc++ dynamically because it results in:
// java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
// even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
// build because soong complains of:
// module NetworkStack missing dependencies: libc++_shared
//
// So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
// we depend on do not dynamically link libc++. This is currently the case, because liblog is
// C-only and libnativehelper_compat_libc also uses stl: "c++_static".
//
// TODO: find a better solution for this in R.
stl: "c++_static",
cflags: [
"-Wall",
"-Werror",
"-Wno-unused-parameter",
],
manifest: "AndroidManifestBase.xml",
}
// Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries
java_defaults {
name: "NetworkStackAppDefaults",
name: "NetworkStackAppCommon",
defaults: ["NetworkStackCommon"],
privileged: true,
static_libs: [
"NetworkStackBase",
],
jni_libs: [
"libnativehelper_compat_libc++",
"libnetworkstackutilsjni",
......@@ -137,7 +96,6 @@ java_defaults {
// Resources already included in NetworkStackBase
resource_dirs: [],
jarjar_rules: "jarjar-rules-shared.txt",
use_embedded_native_libs: true,
optimize: {
proguard_flags_files: ["proguard.flags"],
},
......@@ -146,12 +104,11 @@ java_defaults {
// Non-updatable network stack running in the system server process for devices not using the module
android_app {
name: "InProcessNetworkStack",
defaults: [ "NetworkStackAppDefaults", "NetworkStackApiCurrentLevel"],
static_libs: ["NetworkStackApiCurrentLib"],
defaults: ["NetworkStackAppCommon"],
certificate: "platform",
manifest: "AndroidManifest_InProcess.xml",
// InProcessNetworkStack is a replacement for NetworkStack
overrides: ["NetworkStack", "NetworkStackNext"],
overrides: ["NetworkStack"],
// The permission configuration *must* be included to ensure security of the device
// The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
// the default CaptivePortalLogin.
......@@ -159,65 +116,16 @@ android_app {
}
// Updatable network stack packaged as an application
android_app {
name: "NetworkStackNext",
defaults: ["NetworkStackAppDefaults", "NetworkStackApiCurrentLevel"],
static_libs: ["NetworkStackApiCurrentLib"],
certificate: "networkstack",
manifest: "AndroidManifest.xml",
// The permission configuration *must* be included to ensure security of the device
required: ["NetworkPermissionConfig"],
}
// Updatable network stack for finalized API
android_app {
name: "NetworkStack",
defaults: ["NetworkStackAppDefaults", "NetworkStackApiStableLevel"],
static_libs: ["NetworkStackApiStableLib"],
defaults: ["NetworkStackAppCommon"],
certificate: "networkstack",
manifest: "AndroidManifest.xml",
use_embedded_native_libs: true,
// The permission configuration *must* be included to ensure security of the device
required: ["NetworkPermissionConfig"],
}
// Android library to derive test APKs for integration tests
android_library {
name: "TestNetworkStackLib",
defaults: ["NetworkStackAppDefaults", "NetworkStackApiCurrentLevel"],
static_libs: ["NetworkStackApiCurrentLib"],
manifest: "AndroidManifest.xml",
}
cc_library_shared {
name: "libnetworkstackutilsjni",
srcs: [
"jni/network_stack_utils_jni.cpp"
],
sdk_version: "current",
shared_libs: [
"liblog",
"libnativehelper_compat_libc++",
],
// We cannot use plain "libc++" here to link libc++ dynamically because it results in:
// java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
// even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
// build because soong complains of:
// module NetworkStack missing dependencies: libc++_shared
//
// So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
// we depend on do not dynamically link libc++. This is currently the case, because liblog is
// C-only and libnativehelper_compat_libc also uses stl: "c++_static".
//
// TODO: find a better solution for this in R.
stl: "c++_static",
cflags: [
"-Wall",
"-Werror",
"-Wno-unused-parameter",
],
}
genrule {
name: "statslog-networkstack-java-gen",
tools: ["stats-log-api-gen"],
......@@ -225,20 +133,3 @@ genrule {
" --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog",
out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
}
genrule {
name: "NetworkStackTestAndroidManifest",
srcs: ["AndroidManifest.xml"],
out: ["TestAndroidManifest.xml"],
cmd: "sed 's/versionCode=\".*\"/versionCode=\"300000000\"/' $(in) > $(out)",
}
android_app {
name: "TestNetworkStack",
defaults: ["NetworkStackAppDefaults", "NetworkStackApiCurrentLevel"],
static_libs: ["NetworkStackApiCurrentLib"],
certificate: "networkstack",
manifest: ":NetworkStackTestAndroidManifest",
// The permission configuration *must* be included to ensure security of the device
required: ["NetworkPermissionConfig"],
}
......@@ -43,10 +43,8 @@
<uses-permission android:name="android.permission.MAINLINE_NETWORK_STACK" />
<application
android:extractNativeLibs="false"
android:persistent="true"
android:process="com.android.networkstack.process">
<service android:name="com.android.server.NetworkStackService"
android:permission="android.permission.MAINLINE_NETWORK_STACK">
android:persistent="true">
<service android:name="com.android.server.NetworkStackService">
<intent-filter>
<action android:name="android.net.INetworkStackConnector"/>
</intent-filter>
......
......@@ -22,9 +22,7 @@
android:process="system">
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" />
<application>
<service android:name="com.android.server.NetworkStackService"
android:process="system"
android:permission="android.permission.MAINLINE_NETWORK_STACK">
<service android:name="com.android.server.NetworkStackService" android:process="system">
<intent-filter>
<action android:name="android.net.INetworkStackConnector.InProcess"/>
</intent-filter>
......
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# *****************************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THE BANNER
# *****************************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/CaptivePortalLogin)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/NetworkStack)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/NetworkStackApiStable)
# ******************************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
# ******************************************************************
codewiz@google.com
jchalard@google.com
junyulai@google.com
set noparent
lorenzo@google.com
reminv@google.com
satk@google.com
baligh@google.com
delphij@google.com
[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
ktlint_hook = ${REPO_ROOT}/prebuilts/ktlint/ktlint.py -f ${PREUPLOAD_FILES}
......@@ -2,17 +2,6 @@
"presubmit": [
{
"name": "NetworkStackTests"
},
{
"name": "NetworkStackNextTests"
}
],
"postsubmit": [
{
"name": "NetworkStackHostTests"
},
{
"name": "NetworkStackIntegrationTests"
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.networkstack.apishim.api29;
import android.net.util.SocketUtils;
import androidx.annotation.NonNull;
import com.android.networkstack.apishim.SocketUtilsShim;
import java.net.SocketAddress;
/**
* Implementation of SocketUtilsShim for API 29.
*/
public class SocketUtilsShimImpl implements SocketUtilsShim {
protected SocketUtilsShimImpl() {}
/**
* Get a new instance of {@link SocketUtilsShim}.
*
* Use com.android.networkstack.apishim.SocketUtilsShim#newInstance()
* (non-API29 version) instead, to use the correct shims depending on build SDK.
*/
public static SocketUtilsShim newInstance() {
return new SocketUtilsShimImpl();
}
@NonNull
@Override
public SocketAddress makePacketSocketAddress(
int protocol, int ifIndex, @NonNull byte[] hwAddr) {
// Not available for API <= 29: fallback to older behavior.
return SocketUtils.makePacketSocketAddress(ifIndex, hwAddr);
}
}
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.networkstack.apishim;
import android.net.util.SocketUtils;
import android.os.Build;
import androidx.annotation.NonNull;
import java.net.SocketAddress;
/**
* Implementation of {@link SocketUtilsShim} for API 30.
*/
public class SocketUtilsShimImpl
extends com.android.networkstack.apishim.api29.SocketUtilsShimImpl {
protected SocketUtilsShimImpl() {}
/**
* Get a new instance of {@link SocketUtilsShim}.
*/
public static SocketUtilsShim newInstance() {
if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) {
return com.android.networkstack.apishim.api29.SocketUtilsShimImpl.newInstance();
}
return new SocketUtilsShimImpl();
}
@NonNull
@Override
public SocketAddress makePacketSocketAddress(
int protocol, int ifIndex, @NonNull byte[] hwAddr) {
// TODO: use new API (which takes protocol, ifIndex, hwAddr) once implemented
return SocketUtils.makePacketSocketAddress(ifIndex, hwAddr);
}
}
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.networkstack.apishim;
import android.os.Build;
/**
* Utility class for API shims.
*/
public final class ShimUtils {
/**
* Check whether the device release or development API level is strictly higher than the passed
* in level.
*
* On a development build (codename != REL), the device will have the same API level as the
* last stable release, even though some additional APIs may be available. In this method the
* device API level is considered to be higher if the device supports a stable SDK with a higher
* version number, or if the device supports a development version of a SDK that has a higher
* version number.
*
* @return True if the device supports an SDK that has or will have a higher version number,
* even if still in development.
*/
public static boolean isReleaseOrDevelopmentApiAbove(int apiLevel) {
// In-development API n+1 will have SDK_INT == n and CODENAME != REL.
// Stable API n has SDK_INT == n and CODENAME == REL.
final int devApiLevel = Build.VERSION.SDK_INT
+ ("REL".equals(Build.VERSION.CODENAME) ? 0 : 1);
return devApiLevel > apiLevel;
}
}
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.networkstack.apishim;
import androidx.annotation.NonNull;
import java.net.SocketAddress;
/**
* Interface used to access API methods in {@link android.net.util.SocketUtils}, with appropriate
* fallbacks if the methods are not yet part of the released API.
*
* <p>This interface makes it easier for callers to use SocketUtilsShimImpl, as it's more obvious
* what methods must be implemented on each API level, and it abstracts from callers the need to
* reference classes that have different implementations (which also does not work well with IDEs).
*/
public interface SocketUtilsShim {
/**
* @see android.net.util.SocketUtils#makePacketSocketAddress(int, int, byte[])
*/
@NonNull
SocketAddress makePacketSocketAddress(int protocol, int ifIndex, @NonNull byte[] hwAddr);
}
# jarjar rules to use on API stable builds.
# Use the latest stable apishim package as the main apishim package, to replace and avoid building
# the unstable, non-compatibility shims.
# Once API 30 is stable, apishim/30/com.android.networkstack.apishim should be moved to the
# com.android.networkstack.apishim.api30 package, a new apishim/31/com.android.networkstack.apishim
# package should be created, and this rule should reference api30.
rule com.android.networkstack.apishim.api29.** com.android.networkstack.apishim.@1
\ No newline at end of file
//
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
java_library {
name: "captiveportal-lib",
srcs: ["src/**/*.java"],
libs: [
"androidx.annotation_annotation",
],
sdk_version: "system_current",
}
\ No newline at end of file
//
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and