Merge "Fix Automated API Review issues."

This commit is contained in:
Paul Hu
2019-03-21 14:11:36 +00:00
committed by Gerrit Code Review
2 changed files with 20 additions and 13 deletions

View File

@@ -15,6 +15,7 @@
*/ */
package android.net; package android.net;
import android.annotation.NonNull;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.os.IBinder; import android.os.IBinder;
@@ -65,7 +66,7 @@ public class CaptivePortal implements Parcelable {
/** @hide */ /** @hide */
@SystemApi @SystemApi
@TestApi @TestApi
public CaptivePortal(IBinder binder) { public CaptivePortal(@NonNull IBinder binder) {
mBinder = binder; mBinder = binder;
} }
@@ -142,7 +143,7 @@ public class CaptivePortal implements Parcelable {
*/ */
@SystemApi @SystemApi
@TestApi @TestApi
public void logEvent(int eventId, String packageName) { public void logEvent(int eventId, @NonNull String packageName) {
try { try {
ICaptivePortal.Stub.asInterface(mBinder).logEvent(eventId, packageName); ICaptivePortal.Stub.asInterface(mBinder).logEvent(eventId, packageName);
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@@ -16,6 +16,8 @@
package android.net; package android.net;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.annotation.TestApi; import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage;
@@ -53,22 +55,26 @@ import java.util.Objects;
public final class StaticIpConfiguration implements Parcelable { public final class StaticIpConfiguration implements Parcelable {
/** @hide */ /** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
@Nullable
public LinkAddress ipAddress; public LinkAddress ipAddress;
/** @hide */ /** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
@Nullable
public InetAddress gateway; public InetAddress gateway;
/** @hide */ /** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
@NonNull
public final ArrayList<InetAddress> dnsServers; public final ArrayList<InetAddress> dnsServers;
/** @hide */ /** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
@Nullable
public String domains; public String domains;
public StaticIpConfiguration() { public StaticIpConfiguration() {
dnsServers = new ArrayList<InetAddress>(); dnsServers = new ArrayList<InetAddress>();
} }
public StaticIpConfiguration(StaticIpConfiguration source) { public StaticIpConfiguration(@Nullable StaticIpConfiguration source) {
this(); this();
if (source != null) { if (source != null) {
// All of these except dnsServers are immutable, so no need to make copies. // All of these except dnsServers are immutable, so no need to make copies.
@@ -86,38 +92,38 @@ public final class StaticIpConfiguration implements Parcelable {
domains = null; domains = null;
} }
public LinkAddress getIpAddress() { public @Nullable LinkAddress getIpAddress() {
return ipAddress; return ipAddress;
} }
public void setIpAddress(LinkAddress ipAddress) { public void setIpAddress(@Nullable LinkAddress ipAddress) {
this.ipAddress = ipAddress; this.ipAddress = ipAddress;
} }
public InetAddress getGateway() { public @Nullable InetAddress getGateway() {
return gateway; return gateway;
} }
public void setGateway(InetAddress gateway) { public void setGateway(@Nullable InetAddress gateway) {
this.gateway = gateway; this.gateway = gateway;
} }
public List<InetAddress> getDnsServers() { public @NonNull List<InetAddress> getDnsServers() {
return dnsServers; return dnsServers;
} }
public String getDomains() { public @Nullable String getDomains() {
return domains; return domains;
} }
public void setDomains(String newDomains) { public void setDomains(@Nullable String newDomains) {
domains = newDomains; domains = newDomains;
} }
/** /**
* Add a DNS server to this configuration. * Add a DNS server to this configuration.
*/ */
public void addDnsServer(InetAddress server) { public void addDnsServer(@NonNull InetAddress server) {
dnsServers.add(server); dnsServers.add(server);
} }
@@ -128,7 +134,7 @@ public final class StaticIpConfiguration implements Parcelable {
* route to the gateway as well. This configuration is arguably invalid, but it used to work * route to the gateway as well. This configuration is arguably invalid, but it used to work
* in K and earlier, and other OSes appear to accept it. * in K and earlier, and other OSes appear to accept it.
*/ */
public List<RouteInfo> getRoutes(String iface) { public @NonNull List<RouteInfo> getRoutes(String iface) {
List<RouteInfo> routes = new ArrayList<RouteInfo>(3); List<RouteInfo> routes = new ArrayList<RouteInfo>(3);
if (ipAddress != null) { if (ipAddress != null) {
RouteInfo connectedRoute = new RouteInfo(ipAddress, null, iface); RouteInfo connectedRoute = new RouteInfo(ipAddress, null, iface);
@@ -150,7 +156,7 @@ public final class StaticIpConfiguration implements Parcelable {
* IPv6 configuration) will not be included. * IPv6 configuration) will not be included.
* @hide * @hide
*/ */
public LinkProperties toLinkProperties(String iface) { public @NonNull LinkProperties toLinkProperties(String iface) {
LinkProperties lp = new LinkProperties(); LinkProperties lp = new LinkProperties();
lp.setInterfaceName(iface); lp.setInterfaceName(iface);
if (ipAddress != null) { if (ipAddress != null) {