Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11fed2b2 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Add OTADM feature for Verizon requirement. -...

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."
parents e5847ada 723facc2
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -1798,6 +1798,20 @@ public final class Telephony {
        public static final String ROAMING_PROTOCOL = "roaming_protocol";
        public static final String ROAMING_PROTOCOL = "roaming_protocol";


        public static final String CURRENT = "current";
        public static final String CURRENT = "current";

        /**
          * Current status of APN
          * true : enabled APN, false : disabled APN.
          */
        public static final String CARRIER_ENABLED = "carrier_enabled";

        /**
          * 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 static final String BEARER = "bearer";
    }
    }


    public static final class Intents {
    public static final class Intents {
+2 −3
Original line number Original line Diff line number Diff line
@@ -17,10 +17,9 @@
*/
*/
-->
-->


<!-- use empty string to specify no proxy or port -->


<!-- If you edit this version, also edit the version in the partner-supplied
<!-- If you edit this version, also edit the version in the partner-supplied
    apns-conf.xml configuration file -->
    apns-conf.xml configuration file -->
<apns version="6">
<apns version="7">


</apns>
</apns>
+31 −5
Original line number Original line Diff line number Diff line
@@ -38,12 +38,24 @@ public class ApnSetting {
    public final String numeric;
    public final String numeric;
    public final String protocol;
    public final String protocol;
    public final String roamingProtocol;
    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,
    public ApnSetting(int id, String numeric, String carrier, String apn,
            String proxy, String port,
            String proxy, String port,
            String mmsc, String mmsProxy, String mmsPort,
            String mmsc, String mmsProxy, String mmsPort,
            String user, String password, int authType, String[] types,
            String user, String password, int authType, String[] types,
            String protocol, String roamingProtocol) {
            String protocol, String roamingProtocol, boolean carrierEnabled, int bearer) {
        this.id = id;
        this.id = id;
        this.numeric = numeric;
        this.numeric = numeric;
        this.carrier = carrier;
        this.carrier = carrier;
@@ -59,6 +71,8 @@ public class ApnSetting {
        this.types = types;
        this.types = types;
        this.protocol = protocol;
        this.protocol = protocol;
        this.roamingProtocol = roamingProtocol;
        this.roamingProtocol = roamingProtocol;
        this.carrierEnabled = carrierEnabled;
        this.bearer = bearer;
    }
    }


    /**
    /**
@@ -76,8 +90,8 @@ public class ApnSetting {
     *
     *
     * v2 format:
     * v2 format:
     *   [ApnSettingV2] <carrier>, <apn>, <proxy>, <port>, <mmsc>, <mmsproxy>,
     *   [ApnSettingV2] <carrier>, <apn>, <proxy>, <port>, <mmsc>, <mmsproxy>,
     *   <mmsport>, <user>, <password, <authtype>, <mcc>, <mnc>,
     *   <mmsport>, <user>, <password>, <authtype>, <mcc>, <mnc>,
     *   <type>[| <type>...], <protocol>, <roaming_protocol>
     *   <type>[| <type>...], <protocol>, <roaming_protocol>, <carrierEnabled>, <bearer>
     *
     *
     * Note that the strings generated by toString() do not contain the username
     * Note that the strings generated by toString() do not contain the username
     * and password and thus cannot be read by this method.
     * and password and thus cannot be read by this method.
@@ -110,22 +124,32 @@ public class ApnSetting {


        String[] typeArray;
        String[] typeArray;
        String protocol, roamingProtocol;
        String protocol, roamingProtocol;
        boolean carrierEnabled;
        int bearer;
        if (version == 1) {
        if (version == 1) {
            typeArray = new String[a.length - 13];
            typeArray = new String[a.length - 13];
            System.arraycopy(a, 13, typeArray, 0, a.length - 13);
            System.arraycopy(a, 13, typeArray, 0, a.length - 13);
            protocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
            protocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
            roamingProtocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
            roamingProtocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
            carrierEnabled = true;
            bearer = 0;
        } else {
        } else {
            if (a.length < 16) {
            if (a.length < 18) {
                return null;
                return null;
            }
            }
            typeArray = a[13].split("\\s*\\|\\s*");
            typeArray = a[13].split("\\s*\\|\\s*");
            protocol = a[14];
            protocol = a[14];
            roamingProtocol = a[15];
            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],
        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() {
    public String toString() {
@@ -149,6 +173,8 @@ public class ApnSetting {
        }
        }
        sb.append(", ").append(protocol);
        sb.append(", ").append(protocol);
        sb.append(", ").append(roamingProtocol);
        sb.append(", ").append(roamingProtocol);
        sb.append(", ").append(carrierEnabled);
        sb.append(", ").append(bearer);
        return sb.toString();
        return sb.toString();
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -338,7 +338,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
            apnId = mDefaultApnId;
            apnId = mDefaultApnId;
        }
        }
        mActiveApn = new ApnSetting(apnId, "", "", "", "", "", "", "", "", "",
        mActiveApn = new ApnSetting(apnId, "", "", "", "", "", "", "", "", "",
                                    "", 0, types, "IP", "IP");
                                    "", 0, types, "IP", "IP", true, 0);
        if (DBG) log("call conn.bringUp mActiveApn=" + mActiveApn);
        if (DBG) log("call conn.bringUp mActiveApn=" + mActiveApn);


        Message msg = obtainMessage();
        Message msg = obtainMessage();
+35 −5
Original line number Original line Diff line number Diff line
@@ -889,7 +889,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                        types,
                        types,
                        cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROTOCOL)),
                        cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROTOCOL)),
                        cursor.getString(cursor.getColumnIndexOrThrow(
                        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);
                result.add(apn);
            } while (cursor.moveToNext());
            } while (cursor.moveToNext());
        }
        }
@@ -1982,6 +1985,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
        String operator = mPhone.mIccRecords.getOperatorNumeric();
        String operator = mPhone.mIccRecords.getOperatorNumeric();
        if (operator != null) {
        if (operator != null) {
            String selection = "numeric = '" + operator + "'";
            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);
            if (DBG) log("createAllApnList: selection=" + selection);


            Cursor cursor = mPhone.getContext().getContentResolver().query(
            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.
     * 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();
        String operator = mPhone.mIccRecords.getOperatorNumeric();
        int radioTech = mPhone.getServiceState().getRadioTechnology();
        boolean needToCheckApnBearer = needToCheckApnBearer(radioTech);

        if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
        if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
            if (canSetPreferApn && mPreferredApn != null) {
            if (canSetPreferApn && mPreferredApn != null) {
                if (DBG) {
                if (DBG) {
@@ -2095,6 +2116,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                        + mPreferredApn.numeric + ":" + mPreferredApn);
                        + mPreferredApn.numeric + ":" + mPreferredApn);
                }
                }
                if (mPreferredApn.numeric.equals(operator)) {
                if (mPreferredApn.numeric.equals(operator)) {
                    if (!needToCheckApnBearer || mPreferredApn.bearer == radioTech) {
                        apnList.add(mPreferredApn);
                        apnList.add(mPreferredApn);
                        if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
                        if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
                        return apnList;
                        return apnList;
@@ -2103,14 +2125,22 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                        setPreferredApn(-1);
                        setPreferredApn(-1);
                        mPreferredApn = null;
                        mPreferredApn = null;
                    }
                    }
                } else {
                    if (DBG) log("buildWaitingApns: no preferred APN");
                    setPreferredApn(-1);
                    mPreferredApn = null;
                }
            }
            }
        }
        }
        if (mAllApns != null) {
        if (mAllApns != null) {
            for (ApnSetting apn : mAllApns) {
            for (ApnSetting apn : mAllApns) {
                if (apn.canHandleType(requestedApnType)) {
                if (apn.canHandleType(requestedApnType)) {
                    if (!needToCheckApnBearer || apn.bearer == radioTech) {
                        if (DBG) log("apn info : " +apn.toString());
                        apnList.add(apn);
                        apnList.add(apn);
                    }
                    }
                }
                }
            }
        } else {
        } else {
            loge("mAllApns is empty!");
            loge("mAllApns is empty!");
        }
        }
Loading