diff options
author | sinikang <sinikang@samsung.com> | 2011-09-02 06:54:48 +0900 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2011-09-14 08:27:43 -0700 |
commit | 723facc20b6545b7ac4e65883be096d517fb3c10 (patch) | |
tree | efbe31d8b2c77639a3d28133e31e60776b9b6f18 /telephony | |
parent | 96cbcbfe176f3dc794fc9266c838ef71732e3e6c (diff) | |
download | frameworks_base-723facc20b6545b7ac4e65883be096d517fb3c10.zip frameworks_base-723facc20b6545b7ac4e65883be096d517fb3c10.tar.gz frameworks_base-723facc20b6545b7ac4e65883be096d517fb3c10.tar.bz2 |
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.
bug: 4991683
Change-Id: I9450c220009c3093b1e09e8ac9cd0faa0a975067
Diffstat (limited to 'telephony')
-rwxr-xr-x[-rw-r--r--] | telephony/java/com/android/internal/telephony/ApnSetting.java | 36 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 40 | ||||
-rwxr-xr-x[-rw-r--r--] | telephony/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java | 21 |
4 files changed, 78 insertions, 21 deletions
diff --git a/telephony/java/com/android/internal/telephony/ApnSetting.java b/telephony/java/com/android/internal/telephony/ApnSetting.java index b88bcf7..002ffad9 100644..100755 --- a/telephony/java/com/android/internal/telephony/ApnSetting.java +++ b/telephony/java/com/android/internal/telephony/ApnSetting.java @@ -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(); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index a728d0a..078e51d 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -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(); diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 4e43fcd..71e8d71 100644..100755 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -890,7 +890,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()); } @@ -1985,6 +1988,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( @@ -2072,6 +2078,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. * * @param requestedApnType @@ -2091,6 +2109,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) { @@ -2098,9 +2119,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); @@ -2111,7 +2138,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 { diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java index 1032074..ac8c4c1 100644..100755 --- a/telephony/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java +++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/ApnSettingTest.java @@ -44,6 +44,8 @@ public class ApnSettingTest extends TestCase { for (i = 0; i < a1.types.length; i++) { assertEquals(a1.types[i], a2.types[i]); } + assertEquals(a1.carrierEnabled, a2.carrierEnabled); + assertEquals(a1.bearer, a2.bearer); } @SmallTest @@ -58,21 +60,21 @@ public class ApnSettingTest extends TestCase { testString = "Vodafone IT,web.omnitel.it,,,,,,,,,222,10,,DUN"; expected_apn = new ApnSetting( -1, "22210", "Vodafone IT", "web.omnitel.it", "", "", - "", "", "", "", "", 0, dunTypes, "IP", "IP"); + "", "", "", "", "", 0, dunTypes, "IP", "IP",true,0); assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString)); // A v2 string. - testString = "[ApnSettingV2] Name,apn,,,,,,,,,123,45,,mms|*,IPV6,IP"; + testString = "[ApnSettingV2] Name,apn,,,,,,,,,123,45,,mms|*,IPV6,IP,true,14"; expected_apn = new ApnSetting( -1, "12345", "Name", "apn", "", "", - "", "", "", "", "", 0, mmsTypes, "IPV6", "IP"); + "", "", "", "", "", 0, mmsTypes, "IPV6", "IP",true,14); assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString)); // A v2 string with spaces. - testString = "[ApnSettingV2] Name,apn, ,,,,,,,,123,45,,mms|*,IPV4V6, IP"; + testString = "[ApnSettingV2] Name,apn, ,,,,,,,,123,45,,mms|*,IPV4V6, IP,true,14"; expected_apn = new ApnSetting( -1, "12345", "Name", "apn", "", "", - "", "", "", "", "", 0, mmsTypes, "IPV4V6", "IP"); + "", "", "", "", "", 0, mmsTypes, "IPV4V6", "IP",true,14); assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString)); // Return null if insufficient fields given. @@ -83,11 +85,11 @@ public class ApnSettingTest extends TestCase { assertEquals(null, ApnSetting.fromString(testString)); // Parse (incorrect) V2 format without the tag as V1. - testString = "Name,apn,,,,,,,,,123, 45,,mms|*,IPV6"; + testString = "Name,apn,,,,,,,,,123, 45,,mms|*,IPV6,true,14"; String[] incorrectTypes = {"mms|*", "IPV6"}; expected_apn = new ApnSetting( -1, "12345", "Name", "apn", "", "", - "", "", "", "", "", 0, incorrectTypes, "IP", "IP"); + "", "", "", "", "", 0, incorrectTypes, "IP", "IP",true,14); assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString)); } @@ -98,11 +100,10 @@ public class ApnSettingTest extends TestCase { ApnSetting apn = new ApnSetting( 99, "12345", "Name", "apn", "proxy", "port", "mmsc", "mmsproxy", "mmsport", "user", "password", 0, - types, "IPV4V6", "IP"); + types, "IPV4V6", "IP", true, 14); String expected = "[ApnSettingV2] Name, 99, 12345, apn, proxy, " + "mmsc, mmsproxy, mmsport, port, 0, default | *, " + - "IPV4V6, IP"; + "IPV4V6, IP, true, 14"; assertEquals(expected, apn.toString()); } } - |