Deprecate connectivity APIs relying on integer network types.

Recommend ConnectivityManager.getAllNetworks() and various state
inspection functions as a way forward.

Bug:19608294
Change-Id: Ibd53629995897047fc532ffa56f079dfba10a7c7
This commit is contained in:
Paul Jensen
2015-03-18 12:23:02 -04:00
parent b95d7950f5
commit dda8e59411

View File

@@ -115,8 +115,7 @@ public class ConnectivityManager {
* *
* @deprecated Since {@link NetworkInfo} can vary based on UID, applications * @deprecated Since {@link NetworkInfo} can vary based on UID, applications
* should always obtain network information through * should always obtain network information through
* {@link #getActiveNetworkInfo()} or * {@link #getActiveNetworkInfo()}.
* {@link #getAllNetworkInfo()}.
* @see #EXTRA_NETWORK_TYPE * @see #EXTRA_NETWORK_TYPE
*/ */
@Deprecated @Deprecated
@@ -124,8 +123,6 @@ public class ConnectivityManager {
/** /**
* Network type which triggered a {@link #CONNECTIVITY_ACTION} broadcast. * Network type which triggered a {@link #CONNECTIVITY_ACTION} broadcast.
* Can be used with {@link #getNetworkInfo(int)} to get {@link NetworkInfo}
* state based on the calling application.
* *
* @see android.content.Intent#getIntExtra(String, int) * @see android.content.Intent#getIntExtra(String, int)
*/ */
@@ -655,6 +652,10 @@ public class ConnectivityManager {
* *
* <p>This method requires the caller to hold the permission * <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
*
* @deprecated This method does not support multiple connected networks
* of the same type. Use {@link #getAllNetworks} and
* {@link #getNetworkInfo(android.net.Network)} instead.
*/ */
public NetworkInfo getNetworkInfo(int networkType) { public NetworkInfo getNetworkInfo(int networkType) {
try { try {
@@ -694,6 +695,10 @@ public class ConnectivityManager {
* *
* <p>This method requires the caller to hold the permission * <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
*
* @deprecated This method does not support multiple connected networks
* of the same type. Use {@link #getAllNetworks} and
* {@link #getNetworkInfo(android.net.Network)} instead.
*/ */
public NetworkInfo[] getAllNetworkInfo() { public NetworkInfo[] getAllNetworkInfo() {
try { try {
@@ -711,6 +716,9 @@ public class ConnectivityManager {
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
* *
* @hide * @hide
* @deprecated This method does not support multiple connected networks
* of the same type. Use {@link #getAllNetworks} and
* {@link #getNetworkInfo(android.net.Network)} instead.
*/ */
public Network getNetworkForType(int networkType) { public Network getNetworkForType(int networkType) {
try { try {
@@ -803,6 +811,10 @@ public class ConnectivityManager {
* <p>This method requires the caller to hold the permission * <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#ACCESS_NETWORK_STATE}. * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
* {@hide} * {@hide}
* @deprecated This method does not support multiple connected networks
* of the same type. Use {@link #getAllNetworks},
* {@link #getNetworkInfo(android.net.Network)}, and
* {@link #getLinkProperties(android.net.Network)} instead.
*/ */
public LinkProperties getLinkProperties(int networkType) { public LinkProperties getLinkProperties(int networkType) {
try { try {
@@ -1932,6 +1944,7 @@ public class ConnectivityManager {
* @param networkType * @param networkType
* *
* {@hide} * {@hide}
* @deprecated Doesn't properly deal with multiple connected networks of the same type.
*/ */
public void setProvisioningNotificationVisible(boolean visible, int networkType, public void setProvisioningNotificationVisible(boolean visible, int networkType,
String action) { String action) {