Merge "Add OTADM feature for Verizon requirement. - GsmDataConnectionTracker.java <in function createApnList> : modify parameter type for new ApnSetting. (carrierEnabled has changed to boolean from integer, BEARER has changed to integer from string). <in function createAllApnList> : modify telephony db query statement using carrierEnabled. (carrier_enabled: 1 enable apn, 0: disabled apn) <in function buildWaitingApns> : modify apn management code when current RAT (radio access technology) is LTE or EHRPD. add internal function named needToCheckApnBearer to check current RAT is LTE or EHRPD. - ApnSetting.java : add two member variable (carrierEnabled: apn enable/disable , bearer : Radio Access Technology) - Telephony.java : add two static string CARRIER_ENABLED & BEARER. - ApnSettingTest.java : add two assertEquals in function assertApnSettingEqual. add CARRIER_ENABLED & BEARER parameters."
This commit is contained in:
committed by
Android (Google) Code Review
commit
11fed2b218
36
telephony/java/com/android/internal/telephony/ApnSetting.java
Normal file → Executable file
36
telephony/java/com/android/internal/telephony/ApnSetting.java
Normal file → Executable file
@@ -38,12 +38,24 @@ public class ApnSetting {
|
||||
public final String numeric;
|
||||
public final String protocol;
|
||||
public final String roamingProtocol;
|
||||
/**
|
||||
* Current status of APN
|
||||
* true : enabled APN, false : disabled APN.
|
||||
*/
|
||||
public final boolean carrierEnabled;
|
||||
/**
|
||||
* Radio Access Technology info
|
||||
* To check what values can hold, refer to ServiceState.java.
|
||||
* This should be spread to other technologies,
|
||||
* but currently only used for LTE(14) and EHRPD(13).
|
||||
*/
|
||||
public final int bearer;
|
||||
|
||||
public ApnSetting(int id, String numeric, String carrier, String apn,
|
||||
String proxy, String port,
|
||||
String mmsc, String mmsProxy, String mmsPort,
|
||||
String user, String password, int authType, String[] types,
|
||||
String protocol, String roamingProtocol) {
|
||||
String protocol, String roamingProtocol, boolean carrierEnabled, int bearer) {
|
||||
this.id = id;
|
||||
this.numeric = numeric;
|
||||
this.carrier = carrier;
|
||||
@@ -59,6 +71,8 @@ public class ApnSetting {
|
||||
this.types = types;
|
||||
this.protocol = protocol;
|
||||
this.roamingProtocol = roamingProtocol;
|
||||
this.carrierEnabled = carrierEnabled;
|
||||
this.bearer = bearer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,8 +90,8 @@ public class ApnSetting {
|
||||
*
|
||||
* v2 format:
|
||||
* [ApnSettingV2] <carrier>, <apn>, <proxy>, <port>, <mmsc>, <mmsproxy>,
|
||||
* <mmsport>, <user>, <password, <authtype>, <mcc>, <mnc>,
|
||||
* <type>[| <type>...], <protocol>, <roaming_protocol>
|
||||
* <mmsport>, <user>, <password>, <authtype>, <mcc>, <mnc>,
|
||||
* <type>[| <type>...], <protocol>, <roaming_protocol>, <carrierEnabled>, <bearer>
|
||||
*
|
||||
* Note that the strings generated by toString() do not contain the username
|
||||
* and password and thus cannot be read by this method.
|
||||
@@ -110,22 +124,32 @@ public class ApnSetting {
|
||||
|
||||
String[] typeArray;
|
||||
String protocol, roamingProtocol;
|
||||
boolean carrierEnabled;
|
||||
int bearer;
|
||||
if (version == 1) {
|
||||
typeArray = new String[a.length - 13];
|
||||
System.arraycopy(a, 13, typeArray, 0, a.length - 13);
|
||||
protocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
|
||||
roamingProtocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
|
||||
carrierEnabled = true;
|
||||
bearer = 0;
|
||||
} else {
|
||||
if (a.length < 16) {
|
||||
if (a.length < 18) {
|
||||
return null;
|
||||
}
|
||||
typeArray = a[13].split("\\s*\\|\\s*");
|
||||
protocol = a[14];
|
||||
roamingProtocol = a[15];
|
||||
try {
|
||||
carrierEnabled = Boolean.parseBoolean(a[16]);
|
||||
} catch (Exception e) {
|
||||
carrierEnabled = true;
|
||||
}
|
||||
bearer = Integer.parseInt(a[17]);
|
||||
}
|
||||
|
||||
return new ApnSetting(-1,a[10]+a[11],a[0],a[1],a[2],a[3],a[7],a[8],
|
||||
a[9],a[4],a[5],authType,typeArray,protocol,roamingProtocol);
|
||||
a[9],a[4],a[5],authType,typeArray,protocol,roamingProtocol,carrierEnabled,bearer);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
@@ -149,6 +173,8 @@ public class ApnSetting {
|
||||
}
|
||||
sb.append(", ").append(protocol);
|
||||
sb.append(", ").append(roamingProtocol);
|
||||
sb.append(", ").append(carrierEnabled);
|
||||
sb.append(", ").append(bearer);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
apnId = mDefaultApnId;
|
||||
}
|
||||
mActiveApn = new ApnSetting(apnId, "", "", "", "", "", "", "", "", "",
|
||||
"", 0, types, "IP", "IP");
|
||||
"", 0, types, "IP", "IP", true, 0);
|
||||
if (DBG) log("call conn.bringUp mActiveApn=" + mActiveApn);
|
||||
|
||||
Message msg = obtainMessage();
|
||||
|
||||
@@ -889,7 +889,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
types,
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROTOCOL)),
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(
|
||||
Telephony.Carriers.ROAMING_PROTOCOL)));
|
||||
Telephony.Carriers.ROAMING_PROTOCOL)),
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(
|
||||
Telephony.Carriers.CARRIER_ENABLED)) == 1,
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.BEARER)));
|
||||
result.add(apn);
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
@@ -1982,6 +1985,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
String operator = mPhone.mIccRecords.getOperatorNumeric();
|
||||
if (operator != null) {
|
||||
String selection = "numeric = '" + operator + "'";
|
||||
// query only enabled apn.
|
||||
// carrier_enabled : 1 means enabled apn, 0 disabled apn.
|
||||
selection += " and carrier_enabled = 1";
|
||||
if (DBG) log("createAllApnList: selection=" + selection);
|
||||
|
||||
Cursor cursor = mPhone.getContext().getContentResolver().query(
|
||||
@@ -2068,6 +2074,18 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check current radio access technology is LTE or EHRPD.
|
||||
*
|
||||
* @param integer value of radio access technology
|
||||
* @return true when current radio access technology is LTE or EHRPD
|
||||
* @ false when current radio access technology is not LTE or EHRPD
|
||||
*/
|
||||
private boolean needToCheckApnBearer(int radioTech) {
|
||||
return (radioTech == ServiceState.RADIO_TECHNOLOGY_LTE ||
|
||||
radioTech == ServiceState.RADIO_TECHNOLOGY_EHRPD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a list of APNs to be used to create PDP's.
|
||||
*
|
||||
@@ -2088,6 +2106,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
}
|
||||
|
||||
String operator = mPhone.mIccRecords.getOperatorNumeric();
|
||||
int radioTech = mPhone.getServiceState().getRadioTechnology();
|
||||
boolean needToCheckApnBearer = needToCheckApnBearer(radioTech);
|
||||
|
||||
if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
||||
if (canSetPreferApn && mPreferredApn != null) {
|
||||
if (DBG) {
|
||||
@@ -2095,9 +2116,15 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
+ mPreferredApn.numeric + ":" + mPreferredApn);
|
||||
}
|
||||
if (mPreferredApn.numeric.equals(operator)) {
|
||||
apnList.add(mPreferredApn);
|
||||
if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
|
||||
return apnList;
|
||||
if (!needToCheckApnBearer || mPreferredApn.bearer == radioTech) {
|
||||
apnList.add(mPreferredApn);
|
||||
if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
|
||||
return apnList;
|
||||
} else {
|
||||
if (DBG) log("buildWaitingApns: no preferred APN");
|
||||
setPreferredApn(-1);
|
||||
mPreferredApn = null;
|
||||
}
|
||||
} else {
|
||||
if (DBG) log("buildWaitingApns: no preferred APN");
|
||||
setPreferredApn(-1);
|
||||
@@ -2108,7 +2135,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
if (mAllApns != null) {
|
||||
for (ApnSetting apn : mAllApns) {
|
||||
if (apn.canHandleType(requestedApnType)) {
|
||||
apnList.add(apn);
|
||||
if (!needToCheckApnBearer || apn.bearer == radioTech) {
|
||||
if (DBG) log("apn info : " +apn.toString());
|
||||
apnList.add(apn);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user