Pass roaming info to ConnectivityService.
bug:5215657 Change-Id: I77024141a7bbaa47eae021009e16b283699be53e
This commit is contained in:
@@ -113,10 +113,15 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
|
||||
TelephonyManager telephony = TelephonyManager.getDefault();
|
||||
LinkProperties linkProperties = null;
|
||||
LinkCapabilities linkCapabilities = null;
|
||||
boolean roaming = false;
|
||||
|
||||
if (state == Phone.DataState.CONNECTED) {
|
||||
linkProperties = sender.getLinkProperties(apnType);
|
||||
linkCapabilities = sender.getLinkCapabilities(apnType);
|
||||
}
|
||||
ServiceState ss = sender.getServiceState();
|
||||
if (ss != null) roaming = ss.getRoaming();
|
||||
|
||||
try {
|
||||
mRegistry.notifyDataConnection(
|
||||
convertDataState(state),
|
||||
@@ -126,7 +131,8 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
|
||||
linkProperties,
|
||||
linkCapabilities,
|
||||
((telephony!=null) ? telephony.getNetworkType() :
|
||||
TelephonyManager.NETWORK_TYPE_UNKNOWN));
|
||||
TelephonyManager.NETWORK_TYPE_UNKNOWN),
|
||||
roaming);
|
||||
} catch (RemoteException ex) {
|
||||
// system process is dead
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ interface ITelephonyRegistry {
|
||||
void notifyDataActivity(int state);
|
||||
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||
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 notifyCellLocation(in Bundle cellLocation);
|
||||
void notifyOtaspChanged(in int otaspMode);
|
||||
|
||||
@@ -106,6 +106,7 @@ public interface Phone {
|
||||
|
||||
static final String DATA_IFACE_NAME_KEY = "iface";
|
||||
static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable";
|
||||
static final String DATA_NETWORK_ROAMING_KEY = "networkRoaming";
|
||||
static final String PHONE_IN_ECM_STATE = "phoneinECMState";
|
||||
|
||||
/**
|
||||
|
||||
@@ -582,7 +582,12 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
*/
|
||||
@Override
|
||||
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() {
|
||||
if (getDataOnRoamingEnabled()) {
|
||||
trySetupData(Phone.REASON_ROAMING_ON);
|
||||
notifyDataConnection(Phone.REASON_ROAMING_ON);
|
||||
} else {
|
||||
if (DBG) log("Tear down data connection on roaming.");
|
||||
cleanUpAllConnections(null);
|
||||
notifyDataAvailability(Phone.REASON_ROAMING_ON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1681,23 +1681,25 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
@Override
|
||||
protected void 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
|
||||
protected void onRoamingOn() {
|
||||
// Notify data availability so APN can be enabled.
|
||||
notifyDataAvailability(Phone.REASON_ROAMING_ON);
|
||||
|
||||
if (getDataOnRoamingEnabled()) {
|
||||
if (DBG) log("onRoamingOn: setup data on roaming");
|
||||
setupDataOnReadyApns(Phone.REASON_ROAMING_ON);
|
||||
notifyDataConnection(Phone.REASON_ROAMING_ON);
|
||||
} else {
|
||||
if (DBG) log("onRoamingOn: Tear down data connection on roaming.");
|
||||
cleanUpAllConnections(true, Phone.REASON_ROAMING_ON);
|
||||
notifyDataAvailability(Phone.REASON_ROAMING_ON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user