Merge "Include network type that caused broadcast." into jb-mr1-dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user