Merge "Address leftover comments on 923337 and 930217." am: b5db40605c am: 5d94f74e87

am: 426f2771e0

Change-Id: I75eadb66c81d72c768e77feddd383d60f8accd65
This commit is contained in:
Paul Hu 2019-04-02 01:29:08 -07:00 • committed by android-build-merger
commit 91252ebe9a
3 changed files with 83 additions and 20 deletions

View file

@ -3234,7 +3234,7 @@ public class ConnectivityManager {
*
* @hide
*/
public void onPreCheck(Network network) {}
public void onPreCheck(@NonNull Network network) {}
/**
* Called when the framework connects and has declared a new network ready for use.
@ -3247,8 +3247,9 @@ public class ConnectivityManager {
* @param blocked Whether access to the {@link Network} is blocked due to system policy.
* @hide
*/
public void onAvailable(Network network, NetworkCapabilities networkCapabilities,
LinkProperties linkProperties, boolean blocked) {
public void onAvailable(@NonNull Network network,
@NonNull NetworkCapabilities networkCapabilities,
@NonNull LinkProperties linkProperties, boolean blocked) {
// Internally only this method is called when a new network is available, and
// it calls the callback in the same way and order that older versions used
// to call so as not to change the behavior.
@ -3272,7 +3273,7 @@ public class ConnectivityManager {
*
* @param network The {@link Network} of the satisfying network.
*/
public void onAvailable(Network network) {}
public void onAvailable(@NonNull Network network) {}
/**
* Called when the network is about to be disconnected. Often paired with an
@ -3288,7 +3289,7 @@ public class ConnectivityManager {
* network connected. Note that the network may suffer a
* hard loss at any time.
*/
public void onLosing(Network network, int maxMsToLive) {}
public void onLosing(@NonNull Network network, int maxMsToLive) {}
/**
* Called when the framework has a hard loss of the network or when the
@ -3296,7 +3297,7 @@ public class ConnectivityManager {
*
* @param network The {@link Network} lost.
*/
public void onLost(Network network) {}
public void onLost(@NonNull Network network) {}
/**
* Called if no network is found in the timeout time specified in
@ -3316,8 +3317,8 @@ public class ConnectivityManager {
* @param networkCapabilities The new {@link android.net.NetworkCapabilities} for this
* network.
*/
public void onCapabilitiesChanged(Network network,
NetworkCapabilities networkCapabilities) {}
public void onCapabilitiesChanged(@NonNull Network network,
@NonNull NetworkCapabilities networkCapabilities) {}
/**
* Called when the network the framework connected to for this request
@ -3326,7 +3327,8 @@ public class ConnectivityManager {
* @param network The {@link Network} whose link properties have changed.
* @param linkProperties The new {@link LinkProperties} for this network.
*/
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {}
public void onLinkPropertiesChanged(@NonNull Network network,
@NonNull LinkProperties linkProperties) {}
/**
* Called when the network the framework connected to for this request
@ -3337,7 +3339,7 @@ public class ConnectivityManager {
* a tunnel, etc.
* @hide
*/
public void onNetworkSuspended(Network network) {}
public void onNetworkSuspended(@NonNull Network network) {}
/**
* Called when the network the framework connected to for this request
@ -3345,7 +3347,7 @@ public class ConnectivityManager {
* preceded by a matching {@link NetworkCallback#onNetworkSuspended} call.
* @hide
*/
public void onNetworkResumed(Network network) {}
public void onNetworkResumed(@NonNull Network network) {}
/**
* Called when access to the specified network is blocked or unblocked.

View file

@ -316,9 +316,6 @@ public final class LinkProperties implements Parcelable {
@SystemApi
@TestApi
public boolean removeLinkAddress(@NonNull LinkAddress toRemove) {
if (toRemove == null) {
return false;
}
int i = findLinkAddressIndex(toRemove);
if (i >= 0) {
mLinkAddresses.remove(i);
@ -391,10 +388,7 @@ public final class LinkProperties implements Parcelable {
@TestApi
@SystemApi
public boolean removeDnsServer(@NonNull InetAddress dnsServer) {
if (dnsServer != null) {
return mDnses.remove(dnsServer);
}
return false;
return mDnses.remove(dnsServer);
}
/**

View file

@ -17,6 +17,7 @@
package android.net;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.net.NetworkCapabilities.NetCapability;
@ -343,10 +344,14 @@ public class NetworkRequest implements Parcelable {
* current value. A value of {@code SIGNAL_STRENGTH_UNSPECIFIED} means no value when
* received and has no effect when requesting a callback.
*
* <p>This method requires the caller to hold the
* {@link android.Manifest.permission#NETWORK_SIGNAL_STRENGTH_WAKEUP} permission
*
* @param signalStrength the bearer-specific signal strength.
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP)
public @NonNull Builder setSignalStrength(int signalStrength) {
mNetworkCapabilities.setSignalStrength(signalStrength);
return this;