Merge "Pass roaming info to ConnectivityService."
This commit is contained in:
committed by
Android (Google) Code Review
commit
4ef6d2ea21
@@ -195,6 +195,8 @@ public class MobileDataStateTracker implements NetworkStateTracker {
|
|||||||
intent.getStringExtra(Phone.STATE_KEY));
|
intent.getStringExtra(Phone.STATE_KEY));
|
||||||
String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_KEY);
|
String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_KEY);
|
||||||
String apnName = intent.getStringExtra(Phone.DATA_APN_KEY);
|
String apnName = intent.getStringExtra(Phone.DATA_APN_KEY);
|
||||||
|
mNetworkInfo.setRoaming(intent.getBooleanExtra(Phone.DATA_NETWORK_ROAMING_KEY,
|
||||||
|
false));
|
||||||
|
|
||||||
mNetworkInfo.setIsAvailable(!intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,
|
mNetworkInfo.setIsAvailable(!intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,
|
||||||
false));
|
false));
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
|
|
||||||
public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||||
String reason, String apn, String apnType, LinkProperties linkProperties,
|
String reason, String apn, String apnType, LinkProperties linkProperties,
|
||||||
LinkCapabilities linkCapabilities, int networkType) {
|
LinkCapabilities linkCapabilities, int networkType, boolean roaming) {
|
||||||
if (!checkNotifyPermission("notifyDataConnection()" )) {
|
if (!checkNotifyPermission("notifyDataConnection()" )) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -437,7 +437,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
|
broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
|
||||||
apnType, linkProperties, linkCapabilities);
|
apnType, linkProperties, linkCapabilities, roaming);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyDataConnectionFailed(String reason, String apnType) {
|
public void notifyDataConnectionFailed(String reason, String apnType) {
|
||||||
@@ -596,7 +596,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
private void broadcastDataConnectionStateChanged(int state,
|
private void broadcastDataConnectionStateChanged(int state,
|
||||||
boolean isDataConnectivityPossible,
|
boolean isDataConnectivityPossible,
|
||||||
String reason, String apn, String apnType, LinkProperties linkProperties,
|
String reason, String apn, String apnType, LinkProperties linkProperties,
|
||||||
LinkCapabilities linkCapabilities) {
|
LinkCapabilities linkCapabilities, boolean roaming) {
|
||||||
// Note: not reporting to the battery stats service here, because the
|
// Note: not reporting to the battery stats service here, because the
|
||||||
// status bar takes care of that after taking into account all of the
|
// status bar takes care of that after taking into account all of the
|
||||||
// required info.
|
// required info.
|
||||||
@@ -618,6 +618,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
if (linkCapabilities != null) {
|
if (linkCapabilities != null) {
|
||||||
intent.putExtra(Phone.DATA_LINK_CAPABILITIES_KEY, linkCapabilities);
|
intent.putExtra(Phone.DATA_LINK_CAPABILITIES_KEY, linkCapabilities);
|
||||||
}
|
}
|
||||||
|
if (roaming) intent.putExtra(Phone.DATA_NETWORK_ROAMING_KEY, true);
|
||||||
|
|
||||||
intent.putExtra(Phone.DATA_APN_KEY, apn);
|
intent.putExtra(Phone.DATA_APN_KEY, apn);
|
||||||
intent.putExtra(Phone.DATA_APN_TYPE_KEY, apnType);
|
intent.putExtra(Phone.DATA_APN_TYPE_KEY, apnType);
|
||||||
mContext.sendStickyBroadcast(intent);
|
mContext.sendStickyBroadcast(intent);
|
||||||
|
|||||||
@@ -113,10 +113,15 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
|
|||||||
TelephonyManager telephony = TelephonyManager.getDefault();
|
TelephonyManager telephony = TelephonyManager.getDefault();
|
||||||
LinkProperties linkProperties = null;
|
LinkProperties linkProperties = null;
|
||||||
LinkCapabilities linkCapabilities = null;
|
LinkCapabilities linkCapabilities = null;
|
||||||
|
boolean roaming = false;
|
||||||
|
|
||||||
if (state == Phone.DataState.CONNECTED) {
|
if (state == Phone.DataState.CONNECTED) {
|
||||||
linkProperties = sender.getLinkProperties(apnType);
|
linkProperties = sender.getLinkProperties(apnType);
|
||||||
linkCapabilities = sender.getLinkCapabilities(apnType);
|
linkCapabilities = sender.getLinkCapabilities(apnType);
|
||||||
}
|
}
|
||||||
|
ServiceState ss = sender.getServiceState();
|
||||||
|
if (ss != null) roaming = ss.getRoaming();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mRegistry.notifyDataConnection(
|
mRegistry.notifyDataConnection(
|
||||||
convertDataState(state),
|
convertDataState(state),
|
||||||
@@ -126,7 +131,8 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
|
|||||||
linkProperties,
|
linkProperties,
|
||||||
linkCapabilities,
|
linkCapabilities,
|
||||||
((telephony!=null) ? telephony.getNetworkType() :
|
((telephony!=null) ? telephony.getNetworkType() :
|
||||||
TelephonyManager.NETWORK_TYPE_UNKNOWN));
|
TelephonyManager.NETWORK_TYPE_UNKNOWN),
|
||||||
|
roaming);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// system process is dead
|
// system process is dead
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ interface ITelephonyRegistry {
|
|||||||
void notifyDataActivity(int state);
|
void notifyDataActivity(int state);
|
||||||
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||||
String reason, String apn, String apnType, in LinkProperties linkProperties,
|
String reason, String apn, String apnType, in LinkProperties linkProperties,
|
||||||
in LinkCapabilities linkCapabilities, int networkType);
|
in LinkCapabilities linkCapabilities, int networkType, boolean roaming);
|
||||||
void notifyDataConnectionFailed(String reason, String apnType);
|
void notifyDataConnectionFailed(String reason, String apnType);
|
||||||
void notifyCellLocation(in Bundle cellLocation);
|
void notifyCellLocation(in Bundle cellLocation);
|
||||||
void notifyOtaspChanged(in int otaspMode);
|
void notifyOtaspChanged(in int otaspMode);
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ public interface Phone {
|
|||||||
|
|
||||||
static final String DATA_IFACE_NAME_KEY = "iface";
|
static final String DATA_IFACE_NAME_KEY = "iface";
|
||||||
static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable";
|
static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable";
|
||||||
|
static final String DATA_NETWORK_ROAMING_KEY = "networkRoaming";
|
||||||
static final String PHONE_IN_ECM_STATE = "phoneinECMState";
|
static final String PHONE_IN_ECM_STATE = "phoneinECMState";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -582,7 +582,12 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onRoamingOff() {
|
protected void onRoamingOff() {
|
||||||
trySetupData(Phone.REASON_ROAMING_OFF);
|
if (getDataOnRoamingEnabled() == false) {
|
||||||
|
notifyDataAvailability(Phone.REASON_ROAMING_OFF);
|
||||||
|
trySetupData(Phone.REASON_ROAMING_OFF);
|
||||||
|
} else {
|
||||||
|
notifyDataConnection(Phone.REASON_ROAMING_OFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -592,9 +597,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
protected void onRoamingOn() {
|
protected void onRoamingOn() {
|
||||||
if (getDataOnRoamingEnabled()) {
|
if (getDataOnRoamingEnabled()) {
|
||||||
trySetupData(Phone.REASON_ROAMING_ON);
|
trySetupData(Phone.REASON_ROAMING_ON);
|
||||||
|
notifyDataConnection(Phone.REASON_ROAMING_ON);
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("Tear down data connection on roaming.");
|
if (DBG) log("Tear down data connection on roaming.");
|
||||||
cleanUpAllConnections(null);
|
cleanUpAllConnections(null);
|
||||||
|
notifyDataAvailability(Phone.REASON_ROAMING_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1681,23 +1681,25 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
@Override
|
@Override
|
||||||
protected void onRoamingOff() {
|
protected void onRoamingOff() {
|
||||||
if (DBG) log("onRoamingOff");
|
if (DBG) log("onRoamingOff");
|
||||||
// Notify data availability so APN can be enabled.
|
|
||||||
notifyDataAvailability(Phone.REASON_ROAMING_OFF);
|
|
||||||
|
|
||||||
setupDataOnReadyApns(Phone.REASON_ROAMING_OFF);
|
if (getDataOnRoamingEnabled() == false) {
|
||||||
|
notifyDataAvailability(Phone.REASON_ROAMING_OFF);
|
||||||
|
setupDataOnReadyApns(Phone.REASON_ROAMING_OFF);
|
||||||
|
} else {
|
||||||
|
notifyDataConnection(Phone.REASON_ROAMING_OFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRoamingOn() {
|
protected void onRoamingOn() {
|
||||||
// Notify data availability so APN can be enabled.
|
|
||||||
notifyDataAvailability(Phone.REASON_ROAMING_ON);
|
|
||||||
|
|
||||||
if (getDataOnRoamingEnabled()) {
|
if (getDataOnRoamingEnabled()) {
|
||||||
if (DBG) log("onRoamingOn: setup data on roaming");
|
if (DBG) log("onRoamingOn: setup data on roaming");
|
||||||
setupDataOnReadyApns(Phone.REASON_ROAMING_ON);
|
setupDataOnReadyApns(Phone.REASON_ROAMING_ON);
|
||||||
|
notifyDataConnection(Phone.REASON_ROAMING_ON);
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("onRoamingOn: Tear down data connection on roaming.");
|
if (DBG) log("onRoamingOn: Tear down data connection on roaming.");
|
||||||
cleanUpAllConnections(true, Phone.REASON_ROAMING_ON);
|
cleanUpAllConnections(true, Phone.REASON_ROAMING_ON);
|
||||||
|
notifyDataAvailability(Phone.REASON_ROAMING_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user