Suppress incorrect lint warnings about new API
IpConfiguration and StaticIpConfiguration APIs were moved from SystemApi
to public (SDK) APIs. The linter incorrectly triggers on code which
built against the SystemApi as using new API.
Tracking bug b/193460475 - TODO to remove once fixed.
Bug: 209840828
Test: builds errorprone
Change-Id: I885c7f6da99134c0e9cda8ba054842cf05e9bf6c
diff --git a/common/networkstackclient/Android.bp b/common/networkstackclient/Android.bp
index 3c97dc2..73d9cf0 100644
--- a/common/networkstackclient/Android.bp
+++ b/common/networkstackclient/Android.bp
@@ -113,6 +113,9 @@
],
// this is part of updatable modules(NetworkStack) which targets 29(Q)
min_sdk_version: "29",
+ lint: {
+ enabled: false,
+ },
},
ndk: {
enabled: false,
diff --git a/src/android/net/DhcpResults.java b/src/android/net/DhcpResults.java
index 82ba156..413fdcf 100644
--- a/src/android/net/DhcpResults.java
+++ b/src/android/net/DhcpResults.java
@@ -17,6 +17,7 @@
package android.net;
import android.annotation.Nullable;
+import android.annotation.SuppressLint;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
@@ -79,6 +80,7 @@
/**
* Create a {@link StaticIpConfiguration} based on the DhcpResults.
*/
+ @SuppressLint("NewApi") // TODO: b/193460475 remove once fixed
public StaticIpConfiguration toStaticIpConfiguration() {
return new StaticIpConfiguration.Builder()
.setIpAddress(ipAddress)
@@ -88,6 +90,7 @@
.build();
}
+ @SuppressLint("NewApi") // TODO: b/193460475 remove once fixed
public DhcpResults(StaticIpConfiguration source) {
if (source != null) {
ipAddress = source.getIpAddress();
@@ -179,6 +182,7 @@
/**
* Implement the Parcelable interface
*/
+ @SuppressLint("NewApi") // TODO: b/193460475 remove once fixed
public static final @android.annotation.NonNull Creator<DhcpResults> CREATOR =
new Creator<DhcpResults>() {
public DhcpResults createFromParcel(Parcel in) {
@@ -206,6 +210,7 @@
return 0;
}
+ @SuppressLint("NewApi") // TODO: b/193460475 remove once fixed
private static DhcpResults readFromParcel(Parcel in) {
final StaticIpConfiguration s = StaticIpConfiguration.CREATOR.createFromParcel(in);
final DhcpResults dhcpResults = new DhcpResults(s);
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index b08e0b9..2ca26c1 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -40,6 +40,7 @@
import static com.android.net.module.util.NetworkStackConstants.VENDOR_SPECIFIC_IE_ID;
import static com.android.server.util.PermissionUtil.enforceNetworkStackCallingPermission;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.net.ConnectivityManager;
@@ -1872,6 +1873,7 @@
mCallback.onProvisioningFailure(mLinkProperties);
}
+ @SuppressLint("NewApi") // TODO: b/193460475 remove once fixed
private boolean startIPv4() {
// If we have a StaticIpConfiguration attempt to apply it and
// handle the result accordingly.