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));
|
||||
String reason = intent.getStringExtra(Phone.STATE_CHANGE_REASON_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,
|
||||
false));
|
||||
|
||||
@@ -383,7 +383,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
|
||||
public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||
String reason, String apn, String apnType, LinkProperties linkProperties,
|
||||
LinkCapabilities linkCapabilities, int networkType) {
|
||||
LinkCapabilities linkCapabilities, int networkType, boolean roaming) {
|
||||
if (!checkNotifyPermission("notifyDataConnection()" )) {
|
||||
return;
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
}
|
||||
broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
|
||||
apnType, linkProperties, linkCapabilities);
|
||||
apnType, linkProperties, linkCapabilities, roaming);
|
||||
}
|
||||
|
||||
public void notifyDataConnectionFailed(String reason, String apnType) {
|
||||
@@ -596,7 +596,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
private void broadcastDataConnectionStateChanged(int state,
|
||||
boolean isDataConnectivityPossible,
|
||||
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
|
||||
// status bar takes care of that after taking into account all of the
|
||||
// required info.
|
||||
@@ -618,6 +618,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
if (linkCapabilities != null) {
|
||||
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_TYPE_KEY, apnType);
|
||||
mContext.sendStickyBroadcast(intent);
|
||||
|
||||
@@ -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