Commit 5fb697d1 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7920115 from 7afca1af to mainline-tzdata3-release

Change-Id: Ie93cb51113cb9d8a3d11d1d512c486b76b4a37c5
parents c9119d6b 7afca1af
...@@ -45,6 +45,17 @@ package { ...@@ -45,6 +45,17 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"], default_applicable_licenses: ["Android-Apache-2.0"],
} }
// Defaults to enable/disable java targets that depend on
// NetworkStackNext, which uses development APIs. "enabled" may
// have a different value depending on the branch.
java_defaults {
name: "NetworkStackNextEnableDefaults",
enabled: true,
}
// This is a placeholder comment to avoid merge conflicts
// as the above target may have different "enabled" values
// depending on the branch
java_defaults { java_defaults {
name: "NetworkStackDevApiLevel", name: "NetworkStackDevApiLevel",
min_sdk_version: "29", min_sdk_version: "29",
...@@ -68,7 +79,7 @@ java_defaults { ...@@ -68,7 +79,7 @@ java_defaults {
name: "NetworkStackShimsDefaults", name: "NetworkStackShimsDefaults",
libs: [ libs: [
"androidx.annotation_annotation", "androidx.annotation_annotation",
"networkstack-client", "networkstack-aidl-latest",
], ],
static_libs : [ static_libs : [
"modules-utils-build_system" "modules-utils-build_system"
...@@ -215,6 +226,8 @@ java_defaults { ...@@ -215,6 +226,8 @@ java_defaults {
static_libs: [ static_libs: [
"androidx.annotation_annotation", "androidx.annotation_annotation",
"modules-utils-build_system", "modules-utils-build_system",
"modules-utils-preconditions",
"modules-utils-statemachine",
"netd_aidl_interface-lateststable-java", "netd_aidl_interface-lateststable-java",
"networkstack-client", "networkstack-client",
"net-utils-framework-common", "net-utils-framework-common",
...@@ -231,7 +244,11 @@ java_defaults { ...@@ -231,7 +244,11 @@ java_defaults {
// The versions of the android library containing network stack code compiled for each SDK variant. // The versions of the android library containing network stack code compiled for each SDK variant.
android_library { android_library {
name: "NetworkStackApiCurrentLib", name: "NetworkStackApiCurrentLib",
defaults: ["NetworkStackDevApiLevel", "NetworkStackAndroidLibraryDefaults"], defaults: [
"NetworkStackDevApiLevel",
"NetworkStackAndroidLibraryDefaults",
"NetworkStackNextEnableDefaults",
],
srcs: [ srcs: [
"src/**/*.java", "src/**/*.java",
":statslog-networkstack-java-gen-current" ":statslog-networkstack-java-gen-current"
...@@ -245,9 +262,7 @@ android_library { ...@@ -245,9 +262,7 @@ android_library {
"//packages/modules/NetworkStack/tests/unit", "//packages/modules/NetworkStack/tests/unit",
"//packages/modules/NetworkStack/tests/integration", "//packages/modules/NetworkStack/tests/integration",
], ],
lint: { lint: { strict_updatability_linting: true },
baseline_filename: "lint-baseline-current-lib.xml",
},
} }
android_library { android_library {
...@@ -268,9 +283,7 @@ android_library { ...@@ -268,9 +283,7 @@ android_library {
"//packages/modules/NetworkStack/tests/unit", "//packages/modules/NetworkStack/tests/unit",
"//packages/modules/NetworkStack/tests/integration", "//packages/modules/NetworkStack/tests/integration",
], ],
lint: { lint: { strict_updatability_linting: true },
baseline_filename: "lint-baseline-stable-lib.xml",
},
} }
filegroup { filegroup {
...@@ -304,7 +317,11 @@ java_defaults { ...@@ -304,7 +317,11 @@ java_defaults {
// Non-updatable network stack running in the system server process for devices not using the module // Non-updatable network stack running in the system server process for devices not using the module
android_app { android_app {
name: "InProcessNetworkStack", name: "InProcessNetworkStack",
defaults: [ "NetworkStackAppDefaults", "NetworkStackDevApiLevel"], defaults: [
"NetworkStackAppDefaults",
"NetworkStackDevApiLevel",
"NetworkStackNextEnableDefaults",
],
static_libs: ["NetworkStackApiCurrentLib"], static_libs: ["NetworkStackApiCurrentLib"],
certificate: "platform", certificate: "platform",
manifest: "AndroidManifest_InProcess.xml", manifest: "AndroidManifest_InProcess.xml",
...@@ -322,7 +339,11 @@ android_app { ...@@ -322,7 +339,11 @@ android_app {
// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top // Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
android_library { android_library {
name: "NetworkStackNextManifestBase", name: "NetworkStackNextManifestBase",
defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], defaults: [
"NetworkStackAppDefaults",
"NetworkStackDevApiLevel",
"NetworkStackNextEnableDefaults",
],
static_libs: ["NetworkStackApiCurrentLib"], static_libs: ["NetworkStackApiCurrentLib"],
manifest: "AndroidManifest.xml" manifest: "AndroidManifest.xml"
} }
...@@ -330,7 +351,11 @@ android_library { ...@@ -330,7 +351,11 @@ android_library {
// NetworkStack build targeting the current API release, for testing on in-development SDK // NetworkStack build targeting the current API release, for testing on in-development SDK
android_app { android_app {
name: "NetworkStackNext", name: "NetworkStackNext",
defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], defaults: [
"NetworkStackAppDefaults",
"NetworkStackDevApiLevel",
"NetworkStackNextEnableDefaults",
],
static_libs: ["NetworkStackNextManifestBase"], static_libs: ["NetworkStackNextManifestBase"],
certificate: "networkstack", certificate: "networkstack",
manifest: "AndroidManifest_Next.xml", manifest: "AndroidManifest_Next.xml",
...@@ -339,6 +364,7 @@ android_app { ...@@ -339,6 +364,7 @@ android_app {
"NetworkPermissionConfig", "NetworkPermissionConfig",
"privapp_whitelist_com.android.networkstack", "privapp_whitelist_com.android.networkstack",
], ],
lint: { strict_updatability_linting: true },
} }
// Updatable network stack for finalized API // Updatable network stack for finalized API
...@@ -354,6 +380,7 @@ android_app { ...@@ -354,6 +380,7 @@ android_app {
"privapp_whitelist_com.android.networkstack", "privapp_whitelist_com.android.networkstack",
], ],
updatable: true, updatable: true,
lint: { strict_updatability_linting: true },
} }
cc_library_shared { cc_library_shared {
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
package com.android.networkstack.apishim.api29; package com.android.networkstack.apishim.api29;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import com.android.networkstack.apishim.common.CaptivePortalDataShim; import com.android.networkstack.apishim.common.CaptivePortalDataShim;
...@@ -33,6 +35,7 @@ import org.json.JSONObject; ...@@ -33,6 +35,7 @@ import org.json.JSONObject;
* <p>Use {@link com.android.networkstack.apishim.CaptivePortalDataShimImpl} instead of this * <p>Use {@link com.android.networkstack.apishim.CaptivePortalDataShimImpl} instead of this
* fallback implementation. * fallback implementation.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim { public abstract class CaptivePortalDataShimImpl implements CaptivePortalDataShim {
protected CaptivePortalDataShimImpl() {} protected CaptivePortalDataShimImpl() {}
......
...@@ -25,9 +25,11 @@ import android.net.ConnectivityManager; ...@@ -25,9 +25,11 @@ import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback; import android.net.ConnectivityManager.NetworkCallback;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.ConnectivityManagerShim; import com.android.networkstack.apishim.common.ConnectivityManagerShim;
import com.android.networkstack.apishim.common.UnsupportedApiLevelException; import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
...@@ -35,6 +37,7 @@ import com.android.networkstack.apishim.common.UnsupportedApiLevelException; ...@@ -35,6 +37,7 @@ import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
/** /**
* Implementation of {@link ConnectivityManagerShim} for API 29. * Implementation of {@link ConnectivityManagerShim} for API 29.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public class ConnectivityManagerShimImpl implements ConnectivityManagerShim { public class ConnectivityManagerShimImpl implements ConnectivityManagerShim {
protected final ConnectivityManager mCm; protected final ConnectivityManager mCm;
protected ConnectivityManagerShimImpl(Context context) { protected ConnectivityManagerShimImpl(Context context) {
......
...@@ -20,10 +20,11 @@ import android.net.IpPrefix; ...@@ -20,10 +20,11 @@ import android.net.IpPrefix;
import android.net.LinkProperties; import android.net.LinkProperties;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.CaptivePortalDataShim; import com.android.networkstack.apishim.common.CaptivePortalDataShim;
import com.android.networkstack.apishim.common.NetworkInformationShim; import com.android.networkstack.apishim.common.NetworkInformationShim;
...@@ -36,6 +37,7 @@ import java.net.Inet4Address; ...@@ -36,6 +37,7 @@ import java.net.Inet4Address;
* <p>Use {@link com.android.networkstack.apishim.NetworkInformationShimImpl} instead of this * <p>Use {@link com.android.networkstack.apishim.NetworkInformationShimImpl} instead of this
* fallback implementation. * fallback implementation.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public class NetworkInformationShimImpl implements NetworkInformationShim { public class NetworkInformationShimImpl implements NetworkInformationShim {
protected NetworkInformationShimImpl() {} protected NetworkInformationShimImpl() {}
...@@ -49,22 +51,6 @@ public class NetworkInformationShimImpl implements NetworkInformationShim { ...@@ -49,22 +51,6 @@ public class NetworkInformationShimImpl implements NetworkInformationShim {
return new NetworkInformationShimImpl(); return new NetworkInformationShimImpl();
} }
/**
* Indicates whether the shim can use APIs above the Q SDK.
*/
@VisibleForTesting
public static boolean useApiAboveQ() {
return false;
}
/**
* Indicates whether the shim can use APIs above the R SDK.
*/
@VisibleForTesting
public static boolean useApiAboveR() {
return false;
}
@Nullable @Nullable
@Override @Override
public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) { public Uri getCaptivePortalApiUrl(@Nullable LinkProperties lp) {
......
...@@ -17,10 +17,12 @@ ...@@ -17,10 +17,12 @@
package com.android.networkstack.apishim.api29; package com.android.networkstack.apishim.api29;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.os.Build;
import android.util.Range; import android.util.Range;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.NetworkRequestShim; import com.android.networkstack.apishim.common.NetworkRequestShim;
import com.android.networkstack.apishim.common.UnsupportedApiLevelException; import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
...@@ -30,6 +32,7 @@ import java.util.Set; ...@@ -30,6 +32,7 @@ import java.util.Set;
/** /**
* Implementation of {@link NetworkRequestShim} for API 29. * Implementation of {@link NetworkRequestShim} for API 29.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public class NetworkRequestShimImpl implements NetworkRequestShim { public class NetworkRequestShimImpl implements NetworkRequestShim {
protected NetworkRequestShimImpl() {} protected NetworkRequestShimImpl() {}
......
...@@ -17,14 +17,17 @@ ...@@ -17,14 +17,17 @@
package com.android.networkstack.apishim.api29; package com.android.networkstack.apishim.api29;
import android.net.Network; import android.net.Network;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.NetworkShim; import com.android.networkstack.apishim.common.NetworkShim;
import com.android.networkstack.apishim.common.UnsupportedApiLevelException; import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
/** /**
* Implementation of NetworkShim for API 29. * Implementation of NetworkShim for API 29.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public class NetworkShimImpl implements NetworkShim { public class NetworkShimImpl implements NetworkShim {
@NonNull @NonNull
protected final Network mNetwork; protected final Network mNetwork;
......
/*
* Copyright (C) 2021 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.os.Build;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.SettingsShim;
/**
* Implementation of {@link SettingsShim} for API 29.
*/
@RequiresApi(Build.VERSION_CODES.Q)
public class SettingsShimImpl implements SettingsShim {
protected SettingsShimImpl() {}
/**
* Get a new instance of {@link SettingsShimImpl}.
*
* Use com.android.networkstack.apishim.SettingsShim#newInstance()
* (non-API29 version) instead, to use the correct shims depending on build SDK.
*/
public static SettingsShim newInstance() {
return new SettingsShimImpl();
}
}
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
package com.android.networkstack.apishim.api29; package com.android.networkstack.apishim.api29;
import android.net.util.SocketUtils; import android.net.util.SocketUtils;
import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.SocketUtilsShim; import com.android.networkstack.apishim.common.SocketUtilsShim;
...@@ -27,6 +29,7 @@ import java.net.SocketAddress; ...@@ -27,6 +29,7 @@ import java.net.SocketAddress;
/** /**
* Implementation of SocketUtilsShim for API 29. * Implementation of SocketUtilsShim for API 29.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public class SocketUtilsShimImpl implements SocketUtilsShim { public class SocketUtilsShimImpl implements SocketUtilsShim {
protected SocketUtilsShimImpl() {} protected SocketUtilsShimImpl() {}
......
...@@ -22,7 +22,9 @@ import android.net.Uri; ...@@ -22,7 +22,9 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.RemoteException; import android.os.RemoteException;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.CaptivePortalDataShim; import com.android.networkstack.apishim.common.CaptivePortalDataShim;
import com.android.networkstack.apishim.common.ShimUtils; import com.android.networkstack.apishim.common.ShimUtils;
...@@ -34,6 +36,7 @@ import org.json.JSONObject; ...@@ -34,6 +36,7 @@ import org.json.JSONObject;
/** /**
* Compatibility implementation of {@link CaptivePortalDataShim}. * Compatibility implementation of {@link CaptivePortalDataShim}.
*/ */
@RequiresApi(Build.VERSION_CODES.R)
public class CaptivePortalDataShimImpl public class CaptivePortalDataShimImpl
extends com.android.networkstack.apishim.api29.CaptivePortalDataShimImpl { extends com.android.networkstack.apishim.api29.CaptivePortalDataShimImpl {
@NonNull @NonNull
...@@ -52,6 +55,7 @@ public class CaptivePortalDataShimImpl ...@@ -52,6 +55,7 @@ public class CaptivePortalDataShimImpl
* @throws JSONException The JSON is not a representation of correct captive portal data. * @throws JSONException The JSON is not a representation of correct captive portal data.
* @throws UnsupportedApiLevelException CaptivePortalData is not available on this API level. * @throws UnsupportedApiLevelException CaptivePortalData is not available on this API level.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
@NonNull @NonNull
public static CaptivePortalDataShim fromJson(JSONObject obj) throws JSONException, public static CaptivePortalDataShim fromJson(JSONObject obj) throws JSONException,
UnsupportedApiLevelException { UnsupportedApiLevelException {
...@@ -77,6 +81,8 @@ public class CaptivePortalDataShimImpl ...@@ -77,6 +81,8 @@ public class CaptivePortalDataShimImpl
.build()); .build());
} }
@RequiresApi(Build.VERSION_CODES.Q)
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R)
public static boolean isSupported() { public static boolean isSupported() {
return ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q); return ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q);
} }
......
...@@ -16,14 +16,18 @@ ...@@ -16,14 +16,18 @@
package com.android.networkstack.apishim.api30; package com.android.networkstack.apishim.api30;
import static com.android.modules.utils.build.SdkLevel.isAtLeastR;
import android.os.Build; import android.os.Build;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.NetworkRequestShim; import com.android.networkstack.apishim.common.NetworkRequestShim;
import com.android.networkstack.apishim.common.ShimUtils;
/** /**
* Implementation of {@link NetworkRequestShim} for API 30. * Implementation of {@link NetworkRequestShim} for API 30.
*/ */
@RequiresApi(Build.VERSION_CODES.R)
public class NetworkRequestShimImpl public class NetworkRequestShimImpl
extends com.android.networkstack.apishim.api29.NetworkRequestShimImpl { extends com.android.networkstack.apishim.api29.NetworkRequestShimImpl {
protected NetworkRequestShimImpl() { protected NetworkRequestShimImpl() {
...@@ -33,8 +37,9 @@ public class NetworkRequestShimImpl ...@@ -33,8 +37,9 @@ public class NetworkRequestShimImpl
/** /**
* Get a new instance of {@link NetworkRequestShim}. * Get a new instance of {@link NetworkRequestShim}.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public static NetworkRequestShim newInstance() { public static NetworkRequestShim newInstance() {
if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) { if (!isAtLeastR()) {
return com.android.networkstack.apishim.api29.NetworkRequestShimImpl return com.android.networkstack.apishim.api29.NetworkRequestShimImpl
.newInstance(); .newInstance();
} }
......
...@@ -16,17 +16,20 @@ ...@@ -16,17 +16,20 @@
package com.android.networkstack.apishim.api30; package com.android.networkstack.apishim.api30;
import static com.android.modules.utils.build.SdkLevel.isAtLeastR;
import android.net.Network; import android.net.Network;
import android.os.Build; import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.android.networkstack.apishim.common.NetworkShim; import com.android.networkstack.apishim.common.NetworkShim;
import com.android.networkstack.apishim.common.ShimUtils;
/** /**
* Implementation of {@link NetworkShim} for API 30. * Implementation of {@link NetworkShim} for API 30.
*/ */
@RequiresApi(Build.VERSION_CODES.R)
public class NetworkShimImpl extends com.android.networkstack.apishim.api29.NetworkShimImpl { public class NetworkShimImpl extends com.android.networkstack.apishim.api29.NetworkShimImpl {
protected NetworkShimImpl(@NonNull Network network) { protected NetworkShimImpl(@NonNull Network network) {
super(network); super(network);
...@@ -35,8 +38,9 @@ public class NetworkShimImpl extends com.android.networkstack.apishim.api29.Netw ...@@ -35,8 +38,9 @@ public class NetworkShimImpl extends com.android.networkstack.apishim.api29.Netw
/** /**
* Get a new instance of {@link NetworkShim}. * Get a new instance of {@link NetworkShim}.
*/ */
@RequiresApi(Build.VERSION_CODES.Q)
public static NetworkShim newInstance(@NonNull Network network) { public static NetworkShim newInstance(@NonNull Network network) {
if (!ShimUtils.isReleaseOrDevelopmentApiAbove(Build.VERSION_CODES.Q)) { if (!isAtLeastR()) {
return com.android.networkstack.apishim.api29.NetworkShimImpl.newInstance(network); return com.android.networkstack.apishim.api29.NetworkShimImpl.newInstance(network);
} }
return new NetworkShimImpl(network); return new NetworkShimImpl(network);
......
...@@ -16,27 +16,33 @@ ...@@ -16,27 +16,33 @@
package com.android.networkstack.apishim.api30; package com.android.networkstack.apishim.api30;
import static com.android.modules.utils.build.SdkLevel.isAtLeastR;
import android.content.Context; import android.content.Context;
import android.os.Build;