Merge "Deprecate getActiveLinkProperties."

This commit is contained in:
Treehugger Robot
2019-02-06 08:32:10 +00:00
committed by Gerrit Code Review

View File

@@ -177,10 +177,10 @@ public class ConnectivityManager {
* The lookup key for a {@link NetworkInfo} object. Retrieve with * The lookup key for a {@link NetworkInfo} object. Retrieve with
* {@link android.content.Intent#getParcelableExtra(String)}. * {@link android.content.Intent#getParcelableExtra(String)}.
* *
* @deprecated Since {@link NetworkInfo} can vary based on UID, applications * @deprecated The {@link NetworkInfo} object is deprecated, as many of its properties
* should always obtain network information through * can't accurately represent modern network characteristics.
* {@link #getActiveNetworkInfo()}. * Please obtain information about networks from the {@link NetworkCapabilities}
* @see #EXTRA_NETWORK_TYPE * or {@link LinkProperties} objects instead.
*/ */
@Deprecated @Deprecated
public static final String EXTRA_NETWORK_INFO = "networkInfo"; public static final String EXTRA_NETWORK_INFO = "networkInfo";
@@ -189,7 +189,11 @@ public class ConnectivityManager {
* Network type which triggered a {@link #CONNECTIVITY_ACTION} broadcast. * Network type which triggered a {@link #CONNECTIVITY_ACTION} broadcast.
* *
* @see android.content.Intent#getIntExtra(String, int) * @see android.content.Intent#getIntExtra(String, int)
* @deprecated The network type is not rich enough to represent the characteristics
* of modern networks. Please use {@link NetworkCapabilities} instead,
* in particular the transports.
*/ */
@Deprecated
public static final String EXTRA_NETWORK_TYPE = "networkType"; public static final String EXTRA_NETWORK_TYPE = "networkType";
/** /**
@@ -1243,9 +1247,13 @@ public class ConnectivityManager {
* is no current default network. * is no current default network.
* *
* {@hide} * {@hide}
* @deprecated please use {@link #getLinkProperties(Network)} on the return
* value of {@link #getActiveNetwork()} instead. In particular,
* this method will return non-null LinkProperties even if the
* app is blocked by policy from using this network.
*/ */
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 109783091)
public LinkProperties getActiveLinkProperties() { public LinkProperties getActiveLinkProperties() {
try { try {
return mService.getActiveLinkProperties(); return mService.getActiveLinkProperties();