Merge "Include network type that caused broadcast." into jb-mr1-dev

This commit is contained in:
Jeff Sharkey
2012-08-06 13:40:44 -07:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 0 deletions

View File

@@ -89,10 +89,20 @@ public class ConnectivityManager {
* should always obtain network information through
* {@link #getActiveNetworkInfo()} or
* {@link #getAllNetworkInfo()}.
* @see #EXTRA_NETWORK_TYPE
*/
@Deprecated
public static final String EXTRA_NETWORK_INFO = "networkInfo";
/**
* 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)
*/
public static final String EXTRA_NETWORK_TYPE = "networkType";
/**
* The lookup key for a boolean that indicates whether a connect event
* is for a network to which the connectivity manager was failing over

View File

@@ -1612,6 +1612,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, info.getType());
if (info.isFailover()) {
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
info.setFailover(false);
@@ -1738,6 +1739,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private Intent makeGeneralIntent(NetworkInfo info, String bcastType) {
Intent intent = new Intent(bcastType);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, info.getType());
if (info.isFailover()) {
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
info.setFailover(false);
@@ -1788,6 +1790,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_INFO, info);
intent.putExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, info.getType());
if (getActiveNetworkInfo() == null) {
intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
}