Data call refactoring and hidlization
Jack Yu [Mon, 13 Feb 2017 19:20:41 +0000 (11:20 -0800)]
Support the new HIDL interface for data call APIs.
The affacted APIs are RIL_REQUEST_SETUP_DATA_CALL,
RIL_REQUEST_SET_DATA_PROFILE, RIL_REQUEST_SET_INITIAL_ATTACH_APN
More parameters are passing down to the modem to address some
issues we had earlier.

bug: 32224135, 30173958, 33561503, 30282096, 32020264
Test: Telephony sanity tests, unit tests

Change-Id: I239baa144bcee413f67e77c6b79b4ae5278077e8

19 files changed:
src/java/com/android/internal/telephony/CommandsInterface.java
src/java/com/android/internal/telephony/RIL.java
src/java/com/android/internal/telephony/RadioIndication.java
src/java/com/android/internal/telephony/RadioResponse.java
src/java/com/android/internal/telephony/dataconnection/ApnSetting.java
src/java/com/android/internal/telephony/dataconnection/DataCallResponse.java
src/java/com/android/internal/telephony/dataconnection/DataConnection.java
src/java/com/android/internal/telephony/dataconnection/DataProfile.java
src/java/com/android/internal/telephony/dataconnection/DcTracker.java
src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
src/java/com/android/internal/telephony/sip/SipCommandInterface.java
src/java/com/android/internal/telephony/test/SimulatedCommands.java
src/java/com/android/internal/telephony/test/SimulatedCommandsVerifier.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataProfileTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcControllerTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java
tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java

index 4b4ecc8..44cb606 100644 (file)
@@ -29,7 +29,6 @@ import com.android.internal.telephony.uicc.IccCardStatus;
 
 import java.util.List;
 
-
 /**
  * {@hide}
  */
@@ -1605,26 +1604,17 @@ public interface CommandsInterface {
      *
      * @param radioTechnology
      *            Radio technology to use. Values is one of RIL_RADIO_TECHNOLOGY_*
-     * @param profile
-     *            Profile Number. Values is one of DATA_PROFILE_*
-     * @param apn
-     *            the APN to connect to if radio technology is GSM/UMTS.
-     *            Otherwise null for CDMA.
-     * @param user
-     *            the username for APN, or NULL
-     * @param password
-     *            the password for APN, or NULL
-     * @param authType
-     *            the PAP / CHAP auth type. Values is one of SETUP_DATA_AUTH_*
-     * @param protocol
-     *            one of the PDP_type values in TS 27.007 section 10.1.1.
-     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
+     * @param dataProfile
+     *            Data profile for data call setup
+     * @param isRoaming
+     *            Device is roaming or not
+     * @param allowRoaming
+     *            Flag indicating data roaming is enabled or not
      * @param result
      *            Callback message
      */
-    public void setupDataCall(int radioTechnology, int profile,
-            String apn, String user, String password, int authType,
-            String protocol, Message result);
+    void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
+                       boolean allowRoaming, Message result);
 
     /**
      * Deactivate packet data connection
@@ -1764,33 +1754,26 @@ public interface CommandsInterface {
     /**
      * Set Initial Attach Apn
      *
-     * @param apn
-     *            the APN to connect to if radio technology is GSM/UMTS.
-     * @param protocol
-     *            one of the PDP_type values in TS 27.007 section 10.1.1.
-     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
-     * @param authType
-     *            authentication protocol used for this PDP context
-     *            (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
-     * @param username
-     *            the username for APN, or NULL
-     * @param password
-     *            the password for APN, or NULL
+     * @param dataProfile
+     *            data profile for initial APN attach
+     * @param isRoaming
+     *            indicating the device is roaming or not
      * @param result
      *            callback message contains the information of SUCCESS/FAILURE
      */
-    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
-            String password, Message result);
+    void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result);
 
     /**
      * Set data profiles in modem
      *
      * @param dps
      *            Array of the data profiles set to modem
+     * @param isRoaming
+     *            Indicating if the device is roaming or not
      * @param result
      *            callback message contains the information of SUCCESS/FAILURE
      */
-    public void setDataProfile(DataProfile[] dps, Message result);
+    void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result);
 
     /**
      * Notifiy that we are testing an emergency call
index e5a3597..9f12003 100644 (file)
@@ -21,12 +21,6 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.hardware.display.DisplayManager;
-import android.hardware.radio.deprecated.V1_0.IOemHook;
-import android.hardware.radio.V1_0.CellInfoCdma;
-import android.hardware.radio.V1_0.CellInfoGsm;
-import android.hardware.radio.V1_0.CellInfoLte;
-import android.hardware.radio.V1_0.CellInfoType;
-import android.hardware.radio.V1_0.CellInfoWcdma;
 import android.hardware.radio.V1_0.Carrier;
 import android.hardware.radio.V1_0.CarrierRestrictions;
 import android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo;
@@ -38,6 +32,7 @@ import android.hardware.radio.V1_0.CellInfoGsm;
 import android.hardware.radio.V1_0.CellInfoLte;
 import android.hardware.radio.V1_0.CellInfoType;
 import android.hardware.radio.V1_0.CellInfoWcdma;
+import android.hardware.radio.V1_0.DataProfileInfo;
 import android.hardware.radio.V1_0.Dial;
 import android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo;
 import android.hardware.radio.V1_0.GsmSmsMessage;
@@ -46,6 +41,7 @@ import android.hardware.radio.V1_0.IRadio;
 import android.hardware.radio.V1_0.IccIo;
 import android.hardware.radio.V1_0.ImsSmsMessage;
 import android.hardware.radio.V1_0.LceDataInfo;
+import android.hardware.radio.V1_0.MvnoType;
 import android.hardware.radio.V1_0.NvWriteItem;
 import android.hardware.radio.V1_0.RadioError;
 import android.hardware.radio.V1_0.RadioIndicationType;
@@ -56,6 +52,7 @@ import android.hardware.radio.V1_0.SetupDataCallResult;
 import android.hardware.radio.V1_0.SimApdu;
 import android.hardware.radio.V1_0.SmsWriteArgs;
 import android.hardware.radio.V1_0.UusInfo;
+import android.hardware.radio.deprecated.V1_0.IOemHook;
 import android.net.ConnectivityManager;
 import android.net.LocalSocket;
 import android.net.LocalSocketAddress;
@@ -92,7 +89,6 @@ import com.android.internal.telephony.cdma.CdmaInformationRecords;
 import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
 import com.android.internal.telephony.dataconnection.DataCallResponse;
 import com.android.internal.telephony.dataconnection.DataProfile;
-import com.android.internal.telephony.dataconnection.DcFailCause;
 import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
 import com.android.internal.telephony.gsm.SuppServiceNotification;
 import com.android.internal.telephony.metrics.TelephonyMetrics;
@@ -757,7 +753,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
 
                         //Rlog.v(RILJ_LOG_TAG, "Read packet: " + length + " bytes");
 
-                        processResponse(p);
+                        //processResponse(p);
                         p.recycle();
                     }
                 } catch (java.io.IOException ex) {
@@ -1594,57 +1590,97 @@ public final class RIL extends BaseCommands implements CommandsInterface {
         }
     }
 
+    /**
+     * Convert MVNO type string into MvnoType defined in types.hal.
+     * @param mvnoType MVNO type
+     * @return MVNO type in integer
+     */
+    private static int convertToHalMvnoType(String mvnoType) {
+        switch (mvnoType) {
+            case "imsi" : return MvnoType.IMSI;
+            case "gid" : return MvnoType.GID;
+            case "spn" : return MvnoType.SPN;
+            default: return MvnoType.NONE;
+        }
+    }
+
+    /**
+     * Convert to DataProfileInfo defined in types.hal
+     * @param dp Data profile
+     * @return A converted data profile
+     */
+    private static DataProfileInfo convertToHalDataProfile(DataProfile dp) {
+        DataProfileInfo dpi = new DataProfileInfo();
+
+        dpi.profileId = dp.profileId;
+        dpi.apn = dp.apn;
+        dpi.protocol = dp.protocol;
+        dpi.roamingProtocol = dp.roamingProtocol;
+        dpi.authType = dp.authType;
+        dpi.user = dp.user;
+        dpi.password = dp.password;
+        dpi.type = dp.type;
+        dpi.maxConnsTime = dp.maxConnsTime;
+        dpi.maxConns = dp.maxConns;
+        dpi.waitTime = dp.waitTime;
+        dpi.enabled = dp.enabled;
+        dpi.supportedApnTypesBitmap = dp.supportedApnTypesBitmap;
+        dpi.bearerBitmap = dp.bearerBitmap;
+        dpi.mtu = dp.mtu;
+        dpi.mvnoType = convertToHalMvnoType(dp.mvnoType);
+        dpi.mvnoMatchData = dp.mvnoMatchData;
+
+        return dpi;
+    }
+
+    /**
+     * Convert SetupDataCallResult defined in types.hal into DataCallResponse
+     * @param dcResult setup data call result
+     * @return converted DataCallResponse object
+     */
+    static DataCallResponse convertDataCallResult(SetupDataCallResult dcResult) {
+        return new DataCallResponse(dcResult.status,
+                dcResult.suggestedRetryTime,
+                dcResult.cid,
+                dcResult.active,
+                dcResult.type,
+                dcResult.ifname,
+                dcResult.addresses,
+                dcResult.dnses,
+                dcResult.gateways,
+                dcResult.pcscf,
+                dcResult.mtu
+        );
+    }
+
     @Override
-    public void setupDataCall(int radioTechnology, int profile, String apn,
-                              String user, String password, int authType, String protocol,
-                              Message result) {
-        /* todo: hidlize
+    public void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
+                              boolean allowRoaming, Message result) {
+
         IRadio radioProxy = getRadioProxy(result);
         if (radioProxy != null) {
+
             RILRequest rr = obtainRequest(RIL_REQUEST_SETUP_DATA_CALL, result,
                     mRILDefaultWorkSource);
 
+            // Convert to HAL data profile
+            DataProfileInfo dpi = convertToHalDataProfile(dataProfile);
+
             if (RILJ_LOGD) {
-                riljLog(rr.serialString() + "> "
-                        + requestToString(rr.mRequest) + " radioTechnology = " + radioTechnology
-                        + " profile = " + profile + " apn = " + apn + " user = " + user
-                        + " password = " + password + " authType = " + authType + " protocol = "
-                        + protocol);
+                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+                        + ",radioTechnology=" + radioTechnology + ",isRoaming="
+                        + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile);
             }
 
             try {
-                radioProxy.setupDataCall(rr.mSerial, radioTechnology + 2, profile,
-                        convertNullToEmptyString(apn), convertNullToEmptyString(user),
-                        convertNullToEmptyString(password), authType,
-                        convertNullToEmptyString(protocol));
-                mMetrics.writeRilSetupDataCall(mPhoneId, rr.mSerial,
-                        radioTechnology, profile, apn, authType, protocol);
+                radioProxy.setupDataCall(rr.mSerial, radioTechnology, dpi,
+                        dataProfile.modemCognitive, allowRoaming, isRoaming);
+                mMetrics.writeRilSetupDataCall(mPhoneId, rr.mSerial, radioTechnology, dpi.profileId,
+                        dpi.apn, dpi.authType, dpi.protocol);
             } catch (RemoteException | RuntimeException e) {
                 handleRadioProxyExceptionForRR(rr, "setupDataCall", e);
             }
-        } */
-        RILRequest rr
-                = RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result, mRILDefaultWorkSource);
-
-        rr.mParcel.writeInt(7);
-
-        rr.mParcel.writeString(Integer.toString(radioTechnology + 2));
-        rr.mParcel.writeString(Integer.toString(profile));
-        rr.mParcel.writeString(apn);
-        rr.mParcel.writeString(user);
-        rr.mParcel.writeString(password);
-        rr.mParcel.writeString(Integer.toString(authType));
-        rr.mParcel.writeString(protocol);
-
-        if (RILJ_LOGD) riljLog(rr.serialString() + "> "
-                + requestToString(rr.mRequest) + " " + radioTechnology + " "
-                + profile + " " + apn + " " + user + " "
-                + password + " " + authType + " " + protocol);
-
-        mMetrics.writeRilSetupDataCall(mPhoneId, rr.mSerial,
-                radioTechnology, profile, apn, authType, protocol);
-
-        send(rr);
+        }
     }
 
     @Override
@@ -3264,48 +3300,24 @@ public final class RIL extends BaseCommands implements CommandsInterface {
     }
 
     @Override
-    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
-                                    String password, Message result) {
-        /* todo: hidlize
+    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
+
         IRadio radioProxy = getRadioProxy(result);
         if (radioProxy != null) {
             RILRequest rr = obtainRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
                     mRILDefaultWorkSource);
 
             if (RILJ_LOGD) {
-                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
-                        + " apn = " + apn + " protocol = " + protocol + " authType = " + authType
-                        + " username = " + username + " password = " + password);
+                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + dataProfile);
             }
 
             try {
-                radioProxy.setInitialAttachApn(rr.mSerial,
-                        convertNullToEmptyString(apn),
-                        convertNullToEmptyString(protocol),
-                        authType,
-                        convertNullToEmptyString(username),
-                        convertNullToEmptyString(password));
+                radioProxy.setInitialAttachApn(rr.mSerial, convertToHalDataProfile(dataProfile),
+                        dataProfile.modemCognitive, isRoaming);
             } catch (RemoteException | RuntimeException e) {
                 handleRadioProxyExceptionForRR(rr, "setInitialAttachApn", e);
             }
         }
-        */
-        RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
-                mRILDefaultWorkSource);
-
-        if (RILJ_LOGD) riljLog("Set RIL_REQUEST_SET_INITIAL_ATTACH_APN");
-
-        rr.mParcel.writeString(apn);
-        rr.mParcel.writeString(protocol);
-        rr.mParcel.writeInt(authType);
-        rr.mParcel.writeString(username);
-        rr.mParcel.writeString(password);
-
-        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
-                + ", apn:" + apn + ", protocol:" + protocol + ", authType:" + authType
-                + ", username:" + username + ", password:" + password);
-
-        send(rr);
     }
 
     @Override
@@ -3669,8 +3681,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
     }
 
     @Override
-    public void setDataProfile(DataProfile[] dps, Message result) {
-        /* todo - hidlize
+    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
+
         IRadio radioProxy = getRadioProxy(result);
         if (radioProxy != null) {
             RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
@@ -3678,52 +3690,23 @@ public final class RIL extends BaseCommands implements CommandsInterface {
 
             if (RILJ_LOGD) {
                 riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
-                        + " with " + dps + " Data Profiles : ");
-                for (int i = 0; i < dps.length; i++) {
-                    riljLog(dps[i].toString());
+                        + " with data profiles : ");
+                for (DataProfile profile : dps) {
+                    riljLog(profile.toString());
                 }
             }
 
-            ArrayList<DataProfileInfo> dpInfos = new ArrayList<>();
-            DataProfileInfo info;
-
-            for (int i = 0; i < dps.length; i++) {
-                info = new DataProfileInfo();
-                info.profileId = dps[i].profileId;
-                info.apn = convertNullToEmptyString(dps[i].apn);
-                info.protocol = convertNullToEmptyString(dps[i].protocol);
-                info.authType = dps[i].authType;
-                info.user = convertNullToEmptyString(dps[i].user);
-                info.password = convertNullToEmptyString(dps[i].password);
-                info.type = dps[i].type;
-                info.maxConnsTime = dps[i].maxConnsTime;
-                info.maxConns = dps[i].maxConns;
-                info.waitTime = dps[i].waitTime;
-                info.enabled = dps[i].enabled;
-                dpInfos.add(info);
+            ArrayList<DataProfileInfo> dpis = new ArrayList<>();
+            for (DataProfile dp : dps) {
+                dpis.add(convertToHalDataProfile(dp));
             }
 
             try {
-                radioProxy.setDataProfile(rr.mSerial, dpInfos);
+                radioProxy.setDataProfile(rr.mSerial, dpis, isRoaming);
             } catch (RemoteException | RuntimeException e) {
                 handleRadioProxyExceptionForRR(rr, "setDataProfile", e);
             }
-        } */
-        if (RILJ_LOGD) riljLog("Set RIL_REQUEST_SET_DATA_PROFILE");
-
-        RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_DATA_PROFILE, null,
-                mRILDefaultWorkSource);
-        DataProfile.toParcel(rr.mParcel, dps);
-
-        if (RILJ_LOGD) {
-            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
-                    + " with " + dps + " Data Profiles : ");
-            for (int i = 0; i < dps.length; i++) {
-                riljLog(dps[i].toString());
-            }
         }
-
-        send(rr);
     }
 
     @Override
@@ -4411,39 +4394,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
         msg.sendToTarget();
     }
 
-    private void processResponse(Parcel p) {
-        int type;
-
-        type = p.readInt();
-
-        if (type == RESPONSE_SOLICITED || type == RESPONSE_SOLICITED_ACK_EXP) {
-            RILRequest rr = processSolicited (p, type);
-            if (rr != null) {
-                if (type == RESPONSE_SOLICITED) {
-                    decrementWakeLock(rr);
-                }
-                rr.release();
-                return;
-            }
-        } else if (type == RESPONSE_SOLICITED_ACK) {
-            int serial;
-            serial = p.readInt();
-
-            RILRequest rr;
-            synchronized (mRequestList) {
-                rr = mRequestList.get(serial);
-            }
-            if (rr == null) {
-                Rlog.w(RILJ_LOG_TAG, "Unexpected solicited ack response! sn: " + serial);
-            } else {
-                decrementWakeLock(rr);
-                if (RILJ_LOGD) {
-                    riljLog(rr.serialString() + " Ack < " + requestToString(rr.mRequest));
-                }
-            }
-        }
-    }
-
     /**
      * Release each request in mRequestList then clear the list
      * @param error is the RIL_Errno sent back
@@ -4500,130 +4450,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
         }
     }
 
-    private RILRequest processSolicited(Parcel p, int type) {
-        int serial, error;
-        boolean found = false;
-
-        serial = p.readInt();
-        error = p.readInt();
-
-        RILRequest rr;
-
-        rr = findAndRemoveRequestFromList(serial);
-
-        if (rr == null) {
-            Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: "
-                            + serial + " error: " + error);
-            return null;
-        }
-
-        // Time logging for RIL command and storing it in TelephonyHistogram.
-        addToRilHistogram(rr);
-
-        if (getRilVersion() >= 13 && type == RESPONSE_SOLICITED_ACK_EXP) {
-            Message msg;
-            RILRequest response = RILRequest.obtain(RIL_RESPONSE_ACKNOWLEDGEMENT, null,
-                    mRILDefaultWorkSource);
-            msg = mSender.obtainMessage(EVENT_SEND_ACK, response);
-            acquireWakeLock(rr, FOR_ACK_WAKELOCK);
-            msg.sendToTarget();
-            if (RILJ_LOGD) {
-                riljLog("Response received for " + rr.serialString() + " "
-                        + requestToString(rr.mRequest) + " Sending ack to ril.cpp");
-            }
-        }
-
-        Object ret = null;
-
-        if (error == 0 || p.dataAvail() > 0) {
-            // either command succeeds or command fails but with data payload
-            try {
-                switch (rr.mRequest) {
-                    // TODO : Remove all the code below later. Some of the RIL commands below
-                    // will be using same code as unsolicited ril commands which will be done in
-                    // separate CL. Other RIL commands below are deprecated and require framework
-                    // code to be modified to remove them completely.
-                    case RIL_REQUEST_SETUP_DATA_CALL: ret =  responseSetupDataCall(p); break;
-                    case RIL_REQUEST_SET_INITIAL_ATTACH_APN: ret = responseVoid(p); break;
-                    case RIL_REQUEST_SET_DATA_PROFILE: ret = responseVoid(p); break;
-                    default:
-                        throw new RuntimeException("Unrecognized solicited response: "
-                                + rr.mRequest);
-                }
-            } catch (Throwable tr) {
-                // Exceptions here usually mean invalid RIL responses
-
-                Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< "
-                        + requestToString(rr.mRequest)
-                        + " exception, possible invalid RIL response", tr);
-
-                if (rr.mResult != null) {
-                    AsyncResult.forMessage(rr.mResult, null, tr);
-                    rr.mResult.sendToTarget();
-                }
-                return rr;
-            }
-        }
-
-        if (rr.mRequest == RIL_REQUEST_SHUTDOWN) {
-            // Set RADIO_STATE to RADIO_UNAVAILABLE to continue shutdown process
-            // regardless of error code to continue shutdown procedure.
-            riljLog("Response to RIL_REQUEST_SHUTDOWN received. Error is "
-                    + error + " Setting Radio State to Unavailable regardless of error.");
-            setRadioState(RadioState.RADIO_UNAVAILABLE);
-        }
-
-        if (error != 0) {
-            switch (rr.mRequest) {
-                case RIL_REQUEST_SET_FACILITY_LOCK:
-                    if (mIccStatusChangedRegistrants != null) {
-                        if (RILJ_LOGD) {
-                            riljLog("ON some errors fakeSimStatusChanged: reg count="
-                                    + mIccStatusChangedRegistrants.size());
-                        }
-                        mIccStatusChangedRegistrants.notifyRegistrants();
-                    }
-                    break;
-                case RIL_REQUEST_GET_RADIO_CAPABILITY: {
-                    // Ideally RIL's would support this or at least give NOT_SUPPORTED
-                    // but the hammerhead RIL reports GENERIC :(
-                    // TODO - remove GENERIC_FAILURE catching: b/21079604
-                    if (REQUEST_NOT_SUPPORTED == error || GENERIC_FAILURE == error) {
-                        // we should construct the RAF bitmask the radio
-                        // supports based on preferred network bitmasks
-                        ret = makeStaticRadioCapability();
-                        error = 0;
-                    }
-                    break;
-                }
-                case RIL_REQUEST_GET_ACTIVITY_INFO:
-                    ret = new ModemActivityInfo(0, 0, 0,
-                            new int [ModemActivityInfo.TX_POWER_LEVELS], 0, 0);
-                    error = 0;
-                    break;
-            }
-
-            if (error != 0) rr.onError(error, ret);
-        }
-        if (error == 0) {
-
-            if (RILJ_LOGD) {
-                riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
-                        + " " + retToString(rr.mRequest, ret));
-            }
-
-            if (rr.mResult != null) {
-                AsyncResult.forMessage(rr.mResult, ret, null);
-                rr.mResult.sendToTarget();
-            }
-        }
-
-        mMetrics.writeOnRilSolicitedResponse(mPhoneId, rr.mSerial, error,
-                rr.mRequest, ret);
-
-        return rr;
-    }
-
     RadioCapability makeStaticRadioCapability() {
         // default to UNKNOWN so we fail fast.
         int raf = RadioAccessFamily.RAF_UNKNOWN;
@@ -4739,7 +4565,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
     }
 
     /**
-     * Notifiy all registrants that the ril has connected or disconnected.
+     * Notify all registrants that the ril has connected or disconnected.
      *
      * @param rilVer is the version of the ril or -1 if disconnected.
      */
@@ -4849,123 +4675,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
         return response;
     }
 
-    private DataCallResponse getDataCallResponse(Parcel p, int version) {
-        DataCallResponse dataCall = new DataCallResponse();
-
-        dataCall.version = version;
-        if (version < 5) {
-            dataCall.cid = p.readInt();
-            dataCall.active = p.readInt();
-            dataCall.type = p.readString();
-            String addresses = p.readString();
-            if (!TextUtils.isEmpty(addresses)) {
-                dataCall.addresses = addresses.split(" ");
-            }
-        } else {
-            dataCall.status = p.readInt();
-            dataCall.suggestedRetryTime = p.readInt();
-            dataCall.cid = p.readInt();
-            dataCall.active = p.readInt();
-            dataCall.type = p.readString();
-            dataCall.ifname = p.readString();
-            if ((dataCall.status == DcFailCause.NONE.getErrorCode())
-                    && TextUtils.isEmpty(dataCall.ifname)) {
-                throw new RuntimeException("getDataCallResponse, no ifname");
-            }
-            String addresses = p.readString();
-            if (!TextUtils.isEmpty(addresses)) {
-                dataCall.addresses = addresses.split(" ");
-            }
-            String dnses = p.readString();
-            if (!TextUtils.isEmpty(dnses)) {
-                dataCall.dnses = dnses.split(" ");
-            }
-            String gateways = p.readString();
-            if (!TextUtils.isEmpty(gateways)) {
-                dataCall.gateways = gateways.split(" ");
-            }
-            if (version >= 10) {
-                String pcscf = p.readString();
-                if (!TextUtils.isEmpty(pcscf)) {
-                    dataCall.pcscf = pcscf.split(" ");
-                }
-            }
-            if (version >= 11) {
-                dataCall.mtu = p.readInt();
-            }
-        }
-        return dataCall;
-    }
-
-    private Object responseDataCallList(Parcel p) {
-        ArrayList<DataCallResponse> response;
-
-        int ver = p.readInt();
-        int num = p.readInt();
-        riljLog("responseDataCallList ver=" + ver + " num=" + num);
-
-        response = new ArrayList<DataCallResponse>(num);
-        for (int i = 0; i < num; i++) {
-            response.add(getDataCallResponse(p, ver));
-        }
-
-
-        return response;
-    }
-
-    private Object responseSetupDataCall(Parcel p) {
-        int ver = p.readInt();
-        int num = p.readInt();
-        if (RILJ_LOGV) riljLog("responseSetupDataCall ver=" + ver + " num=" + num);
-
-        DataCallResponse dataCall;
-
-        if (ver < 5) {
-            dataCall = new DataCallResponse();
-            dataCall.version = ver;
-            dataCall.cid = Integer.parseInt(p.readString());
-            dataCall.ifname = p.readString();
-            if (TextUtils.isEmpty(dataCall.ifname)) {
-                throw new RuntimeException(
-                        "RIL_REQUEST_SETUP_DATA_CALL response, no ifname");
-            }
-            String addresses = p.readString();
-            if (!TextUtils.isEmpty(addresses)) {
-                dataCall.addresses = addresses.split(" ");
-            }
-            if (num >= 4) {
-                String dnses = p.readString();
-                if (RILJ_LOGD) riljLog("responseSetupDataCall got dnses=" + dnses);
-                if (!TextUtils.isEmpty(dnses)) {
-                    dataCall.dnses = dnses.split(" ");
-                }
-            }
-            if (num >= 5) {
-                String gateways = p.readString();
-                if (RILJ_LOGD) riljLog("responseSetupDataCall got gateways=" + gateways);
-                if (!TextUtils.isEmpty(gateways)) {
-                    dataCall.gateways = gateways.split(" ");
-                }
-            }
-            if (num >= 6) {
-                String pcscf = p.readString();
-                if (RILJ_LOGD) riljLog("responseSetupDataCall got pcscf=" + pcscf);
-                if (!TextUtils.isEmpty(pcscf)) {
-                    dataCall.pcscf = pcscf.split(" ");
-                }
-            }
-        } else {
-            if (num != 1) {
-                throw new RuntimeException(
-                        "RIL_REQUEST_SETUP_DATA_CALL response expecting 1 RIL_Data_Call_response_v5"
-                        + " got " + num);
-            }
-            dataCall = getDataCallResponse(p, ver);
-        }
-
-        return dataCall;
-    }
-
     private Object responseSignalStrength(Parcel p) {
         // Assume this is gsm, but doesn't matter as ServiceStateTracker
         // sets the proper value.
@@ -5605,52 +5314,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
         return ret;
     }
 
-    static DataCallResponse convertHalDc(SetupDataCallResult dc) {
-        DataCallResponse dcResponse = new DataCallResponse();
-        // todo: get rid of this version field?
-        // todo: create a DataCallResponse constructor that takes in these fields to make sure
-        // no fields are missing
-        dcResponse.version = 11;
-        dcResponse.status = dc.status;
-        dcResponse.suggestedRetryTime = dc.suggestedRetryTime;
-        dcResponse.cid = dc.cid;
-        dcResponse.active = dc.active;
-        dcResponse.type = dc.type;
-        dcResponse.ifname = dc.ifname;
-        if ((dcResponse.status == DcFailCause.NONE.getErrorCode()) &&
-                TextUtils.isEmpty(dcResponse.ifname)) {
-            throw new RuntimeException("getDataCallResponse, no ifname");
-        }
-        String addresses = dc.addresses;
-        if (!TextUtils.isEmpty(addresses)) {
-            dcResponse.addresses = addresses.split(" ");
-        }
-        String dnses = dc.dnses;
-        if (!TextUtils.isEmpty(dnses)) {
-            dcResponse.dnses = dnses.split(" ");
-        }
-        String gateways = dc.gateways;
-        if (!TextUtils.isEmpty(gateways)) {
-            dcResponse.gateways = gateways.split(" ");
-        }
-        String pcscf = dc.pcscf;
-        if (!TextUtils.isEmpty(pcscf)) {
-            dcResponse.pcscf = pcscf.split(" ");
-        }
-        dcResponse.mtu = dc.mtu;
-
-        return dcResponse;
-    }
-
-    static ArrayList<DataCallResponse> convertHalDcList(ArrayList<SetupDataCallResult> dcList) {
-        ArrayList<DataCallResponse> dcResponseList = new ArrayList<>(dcList.size());
-        for (SetupDataCallResult dc : dcList) {
-            DataCallResponse dcResponse = convertHalDc(dc);
-            dcResponseList.add(dcResponse);
-        }
-        return dcResponseList;
-    }
-
     static ArrayList<HardwareConfig> convertHalHwConfigList(
             ArrayList<android.hardware.radio.V1_0.HardwareConfig> hwListRil,
             RIL ril) {
index 9bf1d2d..6ec2d95 100644 (file)
@@ -231,7 +231,12 @@ public class RadioIndication extends IRadioIndication.Stub {
     public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) {
         mRil.processIndication(indicationType);
 
-        ArrayList<DataCallResponse> response = RIL.convertHalDcList(dcList);
+        ArrayList<DataCallResponse> response = new ArrayList<>();
+
+        for (SetupDataCallResult dcResult : dcList) {
+            response.add(RIL.convertDataCallResult(dcResult));
+        }
+
         if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_DATA_CALL_LIST_CHANGED, response);
 
         mRil.mDataCallListChangedRegistrants.notifyRegistrants(
index 86fc95b..bf5ab77 100644 (file)
@@ -328,9 +328,14 @@ public class RadioResponse extends IRadioResponse.Stub {
         responseSms(responseInfo, sms);
     }
 
+    /**
+     * @param responseInfo Response info struct containing response type, serial no. and error
+     * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in
+     *                            types.hal
+     */
     public void setupDataCallResponse(RadioResponseInfo responseInfo,
-                                      SetupDataCallResult dcResponse) {
-        responseSetupDataCall(responseInfo, dcResponse);
+                                      SetupDataCallResult setupDataCallResult) {
+        responseSetupDataCall(responseInfo, setupDataCallResult);
     }
 
     /**
@@ -551,9 +556,14 @@ public class RadioResponse extends IRadioResponse.Stub {
         responseInts(responseInfo, status);
     }
 
+    /**
+     * @param responseInfo Response info struct containing response type, serial no. and error
+     * @param dataCallResultList Response to get data call list as defined by setupDataCallResult in
+     *                           types.hal
+     */
     public void getDataCallListResponse(RadioResponseInfo responseInfo,
-                                        ArrayList<SetupDataCallResult> dcResponse) {
-        responseDataCallList(responseInfo, dcResponse);
+                                        ArrayList<SetupDataCallResult> dataCallResultList) {
+        responseDataCallList(responseInfo, dataCallResultList);
     }
 
     public void sendOemRilRequestRawResponse(RadioResponseInfo responseInfo,
@@ -1429,13 +1439,12 @@ public class RadioResponse extends IRadioResponse.Stub {
     }
 
     private void responseSetupDataCall(RadioResponseInfo responseInfo,
-                                       SetupDataCallResult dcResponse) {
+                                       SetupDataCallResult setupDataCallResult) {
         RILRequest rr = mRil.processResponse(responseInfo);
 
         if (rr != null) {
-            DataCallResponse ret = null;
+            DataCallResponse ret = RIL.convertDataCallResult(setupDataCallResult);
             if (responseInfo.error == RadioError.NONE) {
-                ret = RIL.convertHalDc(dcResponse);
                 sendMessageResponse(rr.mResult, ret);
             }
             mRil.processResponseDone(rr, responseInfo, ret);
@@ -1479,7 +1488,7 @@ public class RadioResponse extends IRadioResponse.Stub {
         }
     }
 
-    private String convertOpertatorInfoToString(int status) {
+    private static String convertOpertatorInfoToString(int status) {
         if (status == android.hardware.radio.V1_0.OperatorStatus.UNKNOWN) {
             return "unknown";
         } else if (status == android.hardware.radio.V1_0.OperatorStatus.AVAILABLE) {
@@ -1514,16 +1523,19 @@ public class RadioResponse extends IRadioResponse.Stub {
     }
 
     private void responseDataCallList(RadioResponseInfo responseInfo,
-                                      ArrayList<SetupDataCallResult> dcResponse) {
+                                      ArrayList<SetupDataCallResult> dataCallResultList) {
         RILRequest rr = mRil.processResponse(responseInfo);
 
         if (rr != null) {
-            ArrayList<DataCallResponse> ret = null;
+            ArrayList<DataCallResponse> dcResponseList = null;
             if (responseInfo.error == RadioError.NONE) {
-                ret = RIL.convertHalDcList(dcResponse);
-                sendMessageResponse(rr.mResult, ret);
+                dcResponseList = new ArrayList<>();
+                for (SetupDataCallResult dcResult : dataCallResultList) {
+                    dcResponseList.add(RIL.convertDataCallResult(dcResult));
+                }
+                sendMessageResponse(rr.mResult, dcResponseList);
             }
-            mRil.processResponseDone(rr, responseInfo, ret);
+            mRil.processResponseDone(rr, responseInfo, dcResponseList);
         }
     }
 
index ceb9eda..00c77bc 100644 (file)
@@ -17,6 +17,7 @@
 package com.android.internal.telephony.dataconnection;
 
 import android.content.Context;
+import android.hardware.radio.V1_0.ApnTypes;
 import android.os.PersistableBundle;
 import android.telephony.CarrierConfigManager;
 import android.telephony.Rlog;
@@ -29,10 +30,8 @@ import com.android.internal.telephony.uicc.IccRecords;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Locale;
 
 /**
  * This class represents a apn setting for create PDP link
@@ -57,6 +56,7 @@ public class ApnSetting {
     public final String password;
     public final int authType;
     public final String[] types;
+    public final int typesBitmap;
     public final int id;
     public final String numeric;
     public final String protocol;
@@ -113,12 +113,13 @@ public class ApnSetting {
     public boolean permanentFailed = false;
 
     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, boolean carrierEnabled, int bearer,
-            int bearerBitmask, int profileId, boolean modemCognitive, int maxConns, int waitTime,
-            int maxConnsTime, int mtu, String mvnoType, String mvnoMatchData) {
+                      String proxy, String port,
+                      String mmsc, String mmsProxy, String mmsPort,
+                      String user, String password, int authType, String[] types,
+                      String protocol, String roamingProtocol, boolean carrierEnabled, int bearer,
+                      int bearerBitmask, int profileId, boolean modemCognitive, int maxConns,
+                      int waitTime, int maxConnsTime, int mtu, String mvnoType,
+                      String mvnoMatchData) {
         this.id = id;
         this.numeric = numeric;
         this.carrier = carrier;
@@ -132,9 +133,12 @@ public class ApnSetting {
         this.password = password;
         this.authType = authType;
         this.types = new String[types.length];
+        int apnBitmap = 0;
         for (int i = 0; i < types.length; i++) {
-            this.types[i] = types[i].toLowerCase(Locale.ROOT);
+            this.types[i] = types[i].toLowerCase();
+            apnBitmap |= getApnBitmask(this.types[i]);
         }
+        this.typesBitmap = apnBitmap;
         this.protocol = protocol;
         this.roamingProtocol = roamingProtocol;
         this.carrierEnabled = carrierEnabled;
@@ -479,31 +483,50 @@ public class ApnSetting {
 
         ApnSetting other = (ApnSetting) o;
 
-        return carrier.equals(other.carrier) &&
-                id == other.id &&
-                numeric.equals(other.numeric) &&
-                apn.equals(other.apn) &&
-                proxy.equals(other.proxy) &&
-                mmsc.equals(other.mmsc) &&
-                mmsProxy.equals(other.mmsProxy) &&
-                TextUtils.equals(mmsPort, other.mmsPort) &&
-                port.equals(other.port) &&
-                TextUtils.equals(user, other.user) &&
-                TextUtils.equals(password, other.password) &&
-                authType == other.authType &&
-                Arrays.deepEquals(types, other.types) &&
-                protocol.equals(other.protocol) &&
-                roamingProtocol.equals(other.roamingProtocol) &&
-                carrierEnabled == other.carrierEnabled &&
-                bearer == other.bearer &&
-                bearerBitmask == other.bearerBitmask &&
-                profileId == other.profileId &&
-                modemCognitive == other.modemCognitive &&
-                maxConns == other.maxConns &&
-                waitTime == other.waitTime &&
-                maxConnsTime == other.maxConnsTime &&
-                mtu == other.mtu &&
-                mvnoType.equals(other.mvnoType) &&
-                mvnoMatchData.equals(other.mvnoMatchData);
+        return carrier.equals(other.carrier)
+                && id == other.id
+                && numeric.equals(other.numeric)
+                && apn.equals(other.apn)
+                && proxy.equals(other.proxy)
+                && mmsc.equals(other.mmsc)
+                && mmsProxy.equals(other.mmsProxy)
+                && TextUtils.equals(mmsPort, other.mmsPort)
+                && port.equals(other.port)
+                && TextUtils.equals(user, other.user)
+                && TextUtils.equals(password, other.password)
+                && authType == other.authType
+                && Arrays.deepEquals(types, other.types)
+                && typesBitmap == other.typesBitmap
+                && protocol.equals(other.protocol)
+                && roamingProtocol.equals(other.roamingProtocol)
+                && carrierEnabled == other.carrierEnabled
+                && bearer == other.bearer
+                && bearerBitmask == other.bearerBitmask
+                && profileId == other.profileId
+                && modemCognitive == other.modemCognitive
+                && maxConns == other.maxConns
+                && waitTime == other.waitTime
+                && maxConnsTime == other.maxConnsTime
+                && mtu == other.mtu
+                && mvnoType.equals(other.mvnoType)
+                && mvnoMatchData.equals(other.mvnoMatchData);
+    }
+
+    // Helper function to convert APN string into a 32-bit bitmask.
+    private static int getApnBitmask(String apn) {
+        switch (apn) {
+            case PhoneConstants.APN_TYPE_DEFAULT: return ApnTypes.DEFAULT;
+            case PhoneConstants.APN_TYPE_MMS: return ApnTypes.MMS;
+            case PhoneConstants.APN_TYPE_SUPL: return ApnTypes.SUPL;
+            case PhoneConstants.APN_TYPE_DUN: return ApnTypes.DUN;
+            case PhoneConstants.APN_TYPE_HIPRI: return ApnTypes.HIPRI;
+            case PhoneConstants.APN_TYPE_FOTA: return ApnTypes.FOTA;
+            case PhoneConstants.APN_TYPE_IMS: return ApnTypes.IMS;
+            case PhoneConstants.APN_TYPE_CBS: return ApnTypes.CBS;
+            case PhoneConstants.APN_TYPE_IA: return ApnTypes.IA;
+            case PhoneConstants.APN_TYPE_EMERGENCY: return ApnTypes.EMERGENCY;
+            case PhoneConstants.APN_TYPE_ALL: return ApnTypes.ALL;
+            default: return ApnTypes.NONE;
+        }
     }
 }
index 6934e9d..bc02b97 100644 (file)
@@ -23,9 +23,7 @@ import android.net.NetworkUtils;
 import android.net.RouteInfo;
 import android.os.SystemProperties;
 import android.telephony.Rlog;
-
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.dataconnection.DcFailCause;
+import android.text.TextUtils;
 
 import java.net.Inet4Address;
 import java.net.InetAddress;
@@ -38,18 +36,18 @@ public class DataCallResponse {
     private final boolean DBG = true;
     private final String LOG_TAG = "DataCallResponse";
 
-    public int version = 0;
-    public int status = 0;
-    public int cid = 0;
-    public int active = 0;
-    public String type = "";
-    public String ifname = "";
-    public String [] addresses = new String[0];
-    public String [] dnses = new String[0];
-    public String[] gateways = new String[0];
-    public int suggestedRetryTime = -1;
-    public String [] pcscf = new String[0];
-    public int mtu = PhoneConstants.UNSET_MTU;
+    public final int status;
+    public final int suggestedRetryTime;
+    public final int cid;
+    public final int active;
+    public final String type;
+    public final String ifname;
+    public final String [] addresses;
+    public final String [] dnses;
+    // TODO: Change this to final if possible.
+    public String[] gateways;
+    public final String [] pcscf;
+    public final int mtu;
 
     /**
      * Class returned by onSetupConnectionCompleted.
@@ -74,11 +72,29 @@ public class DataCallResponse {
         }
     }
 
+    public DataCallResponse(int status, int suggestedRetryTime, int cid, int active, String type,
+                            String ifname, String addresses, String dnses, String gateways,
+                            String pcscf, int mtu) {
+        this.status = status;
+        this.suggestedRetryTime = suggestedRetryTime;
+        this.cid = cid;
+        this.active = active;
+        this.type = (type == null) ? "" : type;
+        this.ifname = (ifname == null) ? "" : ifname;
+        if ((status == DcFailCause.NONE.getErrorCode()) && TextUtils.isEmpty(ifname)) {
+            throw new RuntimeException("DataCallResponse, no ifname");
+        }
+        this.addresses = TextUtils.isEmpty(addresses) ? new String[0] : addresses.split(" ");
+        this.dnses = TextUtils.isEmpty(dnses) ? new String[0] : dnses.split(" ");
+        this.gateways = TextUtils.isEmpty(gateways) ? new String[0] : gateways.split(" ");
+        this.pcscf = TextUtils.isEmpty(pcscf) ? new String[0] : pcscf.split(" ");
+        this.mtu = mtu;
+    }
+
     @Override
     public String toString() {
         StringBuffer sb = new StringBuffer();
         sb.append("DataCallResponse: {")
-           .append("version=").append(version)
            .append(" status=").append(status)
            .append(" retry=").append(suggestedRetryTime)
            .append(" cid=").append(cid)
@@ -242,11 +258,7 @@ public class DataCallResponse {
                 result = SetupResult.ERR_UnacceptableParameter;
             }
         } else {
-            if (version < 4) {
-                result = SetupResult.ERR_GetLastErrorFromRil;
-            } else {
-                result = SetupResult.ERR_RilError;
-            }
+            result = SetupResult.ERR_RilError;
         }
 
         // An error occurred so clear properties
index 24c5fff..c1995b1 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
-import com.android.internal.telephony.CallTracker;
-import com.android.internal.telephony.CarrierSignalAgent;
-import com.android.internal.telephony.CommandException;
-import com.android.internal.telephony.DctConstants;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.RILConstants;
-import com.android.internal.telephony.RetryManager;
-import com.android.internal.telephony.ServiceStateTracker;
-import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.util.AsyncChannel;
-import com.android.internal.util.Protocol;
-import com.android.internal.util.State;
-import com.android.internal.util.StateMachine;
-
 import android.app.PendingIntent;
 import android.content.Context;
 import android.net.ConnectivityManager;
@@ -53,15 +38,30 @@ import android.util.Pair;
 import android.util.Patterns;
 import android.util.TimeUtils;
 
+import com.android.internal.telephony.CallTracker;
+import com.android.internal.telephony.CarrierSignalAgent;
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.DctConstants;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.RILConstants;
+import com.android.internal.telephony.RetryManager;
+import com.android.internal.telephony.ServiceStateTracker;
+import com.android.internal.telephony.TelephonyIntents;
+import com.android.internal.util.AsyncChannel;
+import com.android.internal.util.Protocol;
+import com.android.internal.util.State;
+import com.android.internal.util.StateMachine;
+
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Locale;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.net.InetAddress;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Locale;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * {@hide}
@@ -440,20 +440,10 @@ public class DataConnection extends StateMachine {
 
         // Check if we should fake an error.
         if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter  > 0) {
-            DataCallResponse response = new DataCallResponse();
-            response.version = mPhone.mCi.getRilVersion();
-            response.status = mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause.getErrorCode();
-            response.cid = 0;
-            response.active = 0;
-            response.type = "";
-            response.ifname = "";
-            response.addresses = new String[0];
-            response.dnses = new String[0];
-            response.gateways = new String[0];
-            response.suggestedRetryTime =
-                    mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime;
-            response.pcscf = new String[0];
-            response.mtu = PhoneConstants.UNSET_MTU;
+            DataCallResponse response = new DataCallResponse(
+                    mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause.getErrorCode(),
+                    mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime, 0, 0, "", "",
+                    "", "", "", "", PhoneConstants.UNSET_MTU);
 
             Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
             AsyncResult.forMessage(msg, response, null);
@@ -474,25 +464,11 @@ public class DataConnection extends StateMachine {
         Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
         msg.obj = cp;
 
-        int authType = mApnSetting.authType;
-        if (authType == -1) {
-            authType = TextUtils.isEmpty(mApnSetting.user) ? RILConstants.SETUP_DATA_AUTH_NONE
-                    : RILConstants.SETUP_DATA_AUTH_PAP_CHAP;
-        }
-
-        String protocol;
-        if (mPhone.getServiceState().getDataRoamingFromRegistration()) {
-            protocol = mApnSetting.roamingProtocol;
-        } else {
-            protocol = mApnSetting.protocol;
-        }
+        DataProfile dp = new DataProfile(mApnSetting, cp.mProfileId);
 
-        mPhone.mCi.setupDataCall(
-                cp.mRilRat,
-                cp.mProfileId,
-                mApnSetting.apn, mApnSetting.user, mApnSetting.password,
-                authType,
-                protocol, msg);
+        mPhone.mCi.setupDataCall(cp.mRilRat, dp,
+                mPhone.getServiceState().getDataRoamingFromRegistration(),
+                mPhone.getDataRoamingEnabled(), msg);
     }
 
     /**
index 86beaad..48a8107 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
-import android.os.Parcel;
 import android.telephony.ServiceState;
+import android.text.TextUtils;
+
+import com.android.internal.telephony.RILConstants;
 
 public class DataProfile {
 
@@ -51,15 +53,37 @@ public class DataProfile {
     public final int waitTime;
     //true to enable the profile, false to disable
     public final boolean enabled;
-
+    //supported APN types bitmap. See RIL_ApnTypes for the value of each bit.
+    public final int supportedApnTypesBitmap;
+    //one of the PDP_type values in TS 27.007 section 10.1.1 used on roaming network.
+    //For example, "IP", "IPV6", "IPV4V6", or "PPP".
+    public final String roamingProtocol;
+    //The bearer bitmap. See RIL_RadioAccessFamily for the value of each bit.
+    public final int bearerBitmap;
+    //maximum transmission unit (MTU) size in bytes
+    public final int mtu;
+    //the MVNO type: possible values are "imsi", "gid", "spn"
+    public final String mvnoType;
+    //MVNO match data. For example, SPN: A MOBILE, BEN NL, ...
+    //IMSI: 302720x94, 2060188, ...
+    //GID: 4E, 33, ...
+    public final String mvnoMatchData;
+    //indicating the data profile was sent to the modem through setDataProfile earlier.
+    public final boolean modemCognitive;
 
     DataProfile(int profileId, String apn, String protocol, int authType,
-            String user, String password, int type, int maxConnsTime, int maxConns,
-            int waitTime, boolean enabled) {
+                String user, String password, int type, int maxConnsTime, int maxConns,
+                int waitTime, boolean enabled, int supportedApnTypesBitmap, String roamingProtocol,
+                int bearerBitmap, int mtu, String mvnoType, String mvnoMatchData,
+                boolean modemCognitive) {
 
         this.profileId = profileId;
         this.apn = apn;
         this.protocol = protocol;
+        if (authType == -1) {
+            authType = TextUtils.isEmpty(user) ? RILConstants.SETUP_DATA_AUTH_NONE
+                    : RILConstants.SETUP_DATA_AUTH_PAP_CHAP;
+        }
         this.authType = authType;
         this.user = user;
         this.password = password;
@@ -68,49 +92,42 @@ public class DataProfile {
         this.maxConns = maxConns;
         this.waitTime = waitTime;
         this.enabled = enabled;
+
+        this.supportedApnTypesBitmap = supportedApnTypesBitmap;
+        this.roamingProtocol = roamingProtocol;
+        this.bearerBitmap = bearerBitmap;
+        this.mtu = mtu;
+        this.mvnoType = mvnoType;
+        this.mvnoMatchData = mvnoMatchData;
+        this.modemCognitive = modemCognitive;
+    }
+
+    public DataProfile(ApnSetting apn) {
+        this(apn, apn.profileId);
     }
 
-    public DataProfile(ApnSetting apn, boolean isRoaming) {
-        this(apn.profileId, apn.apn, isRoaming? apn.roamingProtocol : apn.protocol,
+    public DataProfile(ApnSetting apn, int profileId) {
+        this(profileId, apn.apn, apn.protocol,
                 apn.authType, apn.user, apn.password, apn.bearerBitmask == 0
                         ? TYPE_COMMON : (ServiceState.bearerBitmapHasCdma(apn.bearerBitmask)
                         ? TYPE_3GPP2 : TYPE_3GPP),
-                apn.maxConnsTime, apn.maxConns, apn.waitTime, apn.carrierEnabled);
-    }
-
-    public static Parcel toParcel(Parcel pc, DataProfile[] dps) {
-
-        if(pc == null) {
-            return null;
-        }
-
-        pc.writeInt(dps.length);
-        for(int i = 0; i < dps.length; i++) {
-            pc.writeInt(dps[i].profileId);
-            pc.writeString(dps[i].apn);
-            pc.writeString(dps[i].protocol);
-            pc.writeInt(dps[i].authType);
-            pc.writeString(dps[i].user);
-            pc.writeString(dps[i].password);
-            pc.writeInt(dps[i].type);
-            pc.writeInt(dps[i].maxConnsTime);
-            pc.writeInt(dps[i].maxConns);
-            pc.writeInt(dps[i].waitTime);
-            pc.writeInt(dps[i].enabled ? 1 : 0);
-        }
-        return pc;
+                apn.maxConnsTime, apn.maxConns, apn.waitTime, apn.carrierEnabled, apn.typesBitmap,
+                apn.roamingProtocol, apn.bearerBitmask, apn.mtu, apn.mvnoType, apn.mvnoMatchData,
+                apn.modemCognitive);
     }
 
     @Override
     public String toString() {
-        return "DataProfile " + profileId + "/" + apn + "/" + protocol + "/" + authType
+        return "DataProfile=" + profileId + "/" + apn + "/" + protocol + "/" + authType
                 + "/" + user + "/" + password + "/" + type + "/" + maxConnsTime
-                + "/" + maxConns + "/" + waitTime + "/" + enabled;
+                + "/" + maxConns + "/" + waitTime + "/" + enabled + "/" + supportedApnTypesBitmap
+                + "/" + roamingProtocol + "/" + bearerBitmap + "/" + mtu + "/" + mvnoType + "/"
+                + mvnoMatchData + "/" + modemCognitive;
     }
 
     @Override
     public boolean equals(Object o) {
         if (o instanceof DataProfile == false) return false;
-        return (toString().equals(o.toString()));
+        return (o == this || toString().equals(o.toString()));
     }
 }
index 480d5eb..12c85c1 100644 (file)
@@ -2210,9 +2210,8 @@ public class DcTracker extends Handler {
         } else {
             if (DBG) log("setInitialAttachApn: X selected Apn=" + initialAttachApnSetting);
 
-            mPhone.mCi.setInitialAttachApn(initialAttachApnSetting.apn,
-                    initialAttachApnSetting.protocol, initialAttachApnSetting.authType,
-                    initialAttachApnSetting.user, initialAttachApnSetting.password, null);
+            mPhone.mCi.setInitialAttachApn(new DataProfile(initialAttachApnSetting),
+                    mPhone.getServiceState().getDataRoaming(), null);
         }
     }
 
@@ -2787,6 +2786,11 @@ public class DcTracker extends Handler {
     private void onRoamingOff() {
         if (DBG) log("onRoamingOff");
 
+        // TODO: Remove this once all old vendor RILs are gone. We don't need to send the
+        // data profile again as the modem should have both roaming and non-roaming protocol in
+        // place. Modem should choose the right protocol based on roaming condition.
+        setDataProfilesAsNeeded();
+
         if (!mDataEnabledSettings.isUserDataEnabled()) return;
 
         if (getDataOnRoamingEnabled() == false) {
@@ -2800,6 +2804,11 @@ public class DcTracker extends Handler {
     private void onRoamingOn() {
         if (DBG) log("onRoamingOn");
 
+        // TODO: Remove this once all old vendor RILs are gone. We don't need to send the
+        // data profile again as the modem should have both roaming and non-roaming protocol in
+        // place. Modem should choose the right protocol based on roaming condition.
+        setDataProfilesAsNeeded();
+
         if (!mDataEnabledSettings.isUserDataEnabled()) {
             if (DBG) log("data not enabled by user");
             return;
@@ -3326,22 +3335,15 @@ public class DcTracker extends Handler {
             ArrayList<DataProfile> dps = new ArrayList<DataProfile>();
             for (ApnSetting apn : mAllApnSettings) {
                 if (apn.modemCognitive) {
-                    DataProfile dp = new DataProfile(apn,
-                            mPhone.getServiceState().getDataRoaming());
-                    boolean isDup = false;
-                    for(DataProfile dpIn : dps) {
-                        if (dp.equals(dpIn)) {
-                            isDup = true;
-                            break;
-                        }
-                    }
-                    if (!isDup) {
+                    DataProfile dp = new DataProfile(apn);
+                    if (!dps.contains(dp)) {
                         dps.add(dp);
                     }
                 }
             }
-            if(dps.size() > 0) {
-                mPhone.mCi.setDataProfile(dps.toArray(new DataProfile[0]), null);
+            if (dps.size() > 0) {
+                mPhone.mCi.setDataProfile(dps.toArray(new DataProfile[0]),
+                        mPhone.getServiceState().getDataRoaming(), null);
             }
         }
     }
@@ -3352,7 +3354,7 @@ public class DcTracker extends Handler {
      */
     private void createAllApnList() {
         mMvnoMatched = false;
-        mAllApnSettings = new ArrayList<ApnSetting>();
+        mAllApnSettings = new ArrayList<>();
         IccRecords r = mIccRecords.get();
         String operator = (r != null) ? r.getOperatorNumeric() : "";
         if (operator != null) {
index 4b5b07f..cdea922 100644 (file)
@@ -258,9 +258,8 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
     }
 
     @Override
-    public void setupDataCall(int radioTechnology, int profile,
-            String apn, String user, String password, int authType,
-            String protocol, Message result) {
+    public void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
+                              boolean allowRoaming, Message result) {
     }
 
     @Override
@@ -551,12 +550,11 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
     }
 
     @Override
-    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
-            String password, Message result) {
+    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
     }
 
     @Override
-    public void setDataProfile(DataProfile[] dps, Message result) {
+    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
     }
 
     @Override
index 7e39e9d..470360f 100644 (file)
@@ -259,9 +259,8 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
     }
 
     @Override
-    public void setupDataCall(int radioTechnology, int profile,
-            String apn, String user, String password, int authType,
-            String protocol, Message result) {
+    public void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
+                              boolean allowRoaming, Message result) {
     }
 
     @Override
@@ -552,12 +551,11 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
     }
 
     @Override
-    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
-            String password, Message result) {
+    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
     }
 
     @Override
-    public void setDataProfile(DataProfile[] dps, Message result) {
+    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
     }
 
     @Override
index cf2e154..0425ace 100644 (file)
@@ -1086,26 +1086,15 @@ public class SimulatedCommands extends BaseCommands
     }
 
     @Override
-    public void setupDataCall(int radioTechnology, int profile,
-            String apn, String user, String password, int authType,
-            String protocol, Message result) {
-        SimulatedCommandsVerifier.getInstance().setupDataCall(radioTechnology, profile, apn, user,
-                password, authType, protocol, result);
+    public void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
+                              boolean allowRoaming, Message result) {
+
+        SimulatedCommandsVerifier.getInstance().setupDataCall(radioTechnology, dataProfile,
+                isRoaming, allowRoaming, result);
 
         if (mDcResponse == null) {
-            mDcResponse = new DataCallResponse();
-            mDcResponse.version = 11;
-            mDcResponse.status = 0;
-            mDcResponse.suggestedRetryTime = -1;
-            mDcResponse.cid = 1;
-            mDcResponse.active = 2;
-            mDcResponse.type = "IP";
-            mDcResponse.ifname = "rmnet_data7";
-            mDcResponse.mtu = 1440;
-            mDcResponse.addresses = new String[]{"12.34.56.78"};
-            mDcResponse.dnses = new String[]{"98.76.54.32"};
-            mDcResponse.gateways = new String[]{"11.22.33.44"};
-            mDcResponse.pcscf = new String[]{};
+            mDcResponse = new DataCallResponse(0, -1, 1, 2, "IP", "rmnet_data7",
+                    "12.34.56.78", "98.76.54.32", "11.22.33.44", "", 1440);
         }
 
         if (mDcSuccess) {
@@ -1837,12 +1826,11 @@ public class SimulatedCommands extends BaseCommands
     }
 
     @Override
-    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
-            String password, Message result) {
+    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
     }
 
     @Override
-    public void setDataProfile(DataProfile[] dps, Message result) {
+    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
     }
 
     public void setImsRegistrationState(int[] regState) {
index 5d2f945..3d09a35 100644 (file)
@@ -1139,9 +1139,8 @@ public class SimulatedCommandsVerifier implements CommandsInterface {
     }
 
     @Override
-    public void setupDataCall(int radioTechnology, int profile, String apn, String user,
-                              String password, int authType, String protocol, Message result) {
-
+    public void setupDataCall(int radioTechnology, DataProfile dataProfile, boolean isRoaming,
+                              boolean allowRoaming, Message result) {
     }
 
     @Override
@@ -1206,13 +1205,12 @@ public class SimulatedCommandsVerifier implements CommandsInterface {
     }
 
     @Override
-    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
-                                    String password, Message result) {
+    public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
 
     }
 
     @Override
-    public void setDataProfile(DataProfile[] dps, Message result) {
+    public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
 
     }
 
index 6a4616c..6a8a49a 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_ADDRESS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_DNS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_GATEWAY;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_IFNAME;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_PCSCF_ADDRESS;
+
+import static org.junit.Assert.assertEquals;
+
 import android.net.LinkProperties;
 import android.test.suitebuilder.annotation.SmallTest;
 
@@ -26,8 +34,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-
 public class DataCallResponseTest extends TelephonyTest {
 
     DataCallResponse mDcResponse;
@@ -35,19 +41,8 @@ public class DataCallResponseTest extends TelephonyTest {
     @Before
     public void setUp() throws Exception {
         super.setUp(getClass().getSimpleName());
-        mDcResponse = new DataCallResponse();
-        mDcResponse.version = 11;
-        mDcResponse.status = 0;
-        mDcResponse.suggestedRetryTime = -1;
-        mDcResponse.cid = 1;
-        mDcResponse.active = 2;
-        mDcResponse.type = "IP";
-        mDcResponse.ifname = "rmnet_data7";
-        mDcResponse.mtu = 1440;
-        mDcResponse.addresses = new String[]{"12.34.56.78"};
-        mDcResponse.dnses = new String[]{"98.76.54.32"};
-        mDcResponse.gateways = new String[]{"11.22.33.44"};
-        mDcResponse.pcscf = new String[]{};
+        mDcResponse = new DataCallResponse(0, -1, 1, 2, "IP", FAKE_IFNAME, FAKE_ADDRESS,
+                FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
     }
 
     @After
@@ -88,7 +83,9 @@ public class DataCallResponseTest extends TelephonyTest {
     @SmallTest
     public void testSetLinkPropertiesInvalidAddress() throws Exception {
 
-        mDcResponse.addresses = new String[]{"224.224.224.224"};
+        // 224.224.224.224 is an invalid address.
+        mDcResponse = new DataCallResponse(0, -1, 1, 2, "IP", FAKE_IFNAME, "224.224.224.224",
+                FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
 
         LinkProperties linkProperties = new LinkProperties();
         assertEquals(SetupResult.ERR_UnacceptableParameter,
index 5b02a38..21ba173 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
+import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_ADDRESS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_DNS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_GATEWAY;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_IFNAME;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_PCSCF_ADDRESS;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
 import android.os.AsyncResult;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Message;
-import android.platform.test.annotations.Postsubmit;
 import android.telephony.CarrierConfigManager;
 import android.telephony.ServiceState;
 import android.test.suitebuilder.annotation.SmallTest;
@@ -36,26 +51,15 @@ import com.android.internal.telephony.dataconnection.DataConnection.DisconnectPa
 import com.android.internal.util.IState;
 import com.android.internal.util.StateMachine;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
-import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
 public class DataConnectionTest extends TelephonyTest {
 
     @Mock
@@ -197,9 +201,12 @@ public class DataConnectionTest extends TelephonyTest {
         verify(mCT, times(1)).registerForVoiceCallEnded(any(Handler.class),
                 eq(DataConnection.EVENT_DATA_CONNECTION_VOICE_CALL_ENDED), eq(null));
 
+        ArgumentCaptor<DataProfile> dpCaptor = ArgumentCaptor.forClass(DataProfile.class);
         verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq("spmode.ne.jp"),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+
+        assertEquals("spmode.ne.jp", dpCaptor.getValue().apn);
 
         assertEquals("DcActiveState", getCurrentState().getName());
     }
@@ -221,38 +228,46 @@ public class DataConnectionTest extends TelephonyTest {
     @Test
     @SmallTest
     public void testModemSuggestRetry() throws Exception {
-        DataCallResponse response = new DataCallResponse();
-        response.suggestedRetryTime = 0;
+        DataCallResponse response = new DataCallResponse(0, 0, 1, 2, "IP",
+                FAKE_IFNAME, FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
         AsyncResult ar = new AsyncResult(null, response, null);
         assertEquals(response.suggestedRetryTime, getSuggestedRetryDelay(ar));
 
-        response.suggestedRetryTime = 1000;
+        response = new DataCallResponse(0, 1000, 1, 2, "IP",
+                FAKE_IFNAME, FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
+        ar = new AsyncResult(null, response, null);
         assertEquals(response.suggestedRetryTime, getSuggestedRetryDelay(ar));
 
-        response.suggestedRetryTime = 9999;
+        response = new DataCallResponse(0, 9999, 1, 2, "IP",
+                FAKE_IFNAME, FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
+        ar = new AsyncResult(null, response, null);
         assertEquals(response.suggestedRetryTime, getSuggestedRetryDelay(ar));
     }
 
     @Test
     @SmallTest
     public void testModemNotSuggestRetry() throws Exception {
-        DataCallResponse response = new DataCallResponse();
-        response.suggestedRetryTime = -1;
+        DataCallResponse response = new DataCallResponse(0, -1, 1, 2, "IP", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
         AsyncResult ar = new AsyncResult(null, response, null);
         assertEquals(RetryManager.NO_SUGGESTED_RETRY_DELAY, getSuggestedRetryDelay(ar));
 
-        response.suggestedRetryTime = -5;
+        response = new DataCallResponse(0, -5, 1, 2, "IP", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
+        ar = new AsyncResult(null, response, null);
         assertEquals(RetryManager.NO_SUGGESTED_RETRY_DELAY, getSuggestedRetryDelay(ar));
 
-        response.suggestedRetryTime = Integer.MIN_VALUE;
+        response = new DataCallResponse(0, Integer.MIN_VALUE, 1, 2, "IP", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
+        ar = new AsyncResult(null, response, null);
         assertEquals(RetryManager.NO_SUGGESTED_RETRY_DELAY, getSuggestedRetryDelay(ar));
     }
 
     @Test
     @SmallTest
     public void testModemSuggestNoRetry() throws Exception {
-        DataCallResponse response = new DataCallResponse();
-        response.suggestedRetryTime = Integer.MAX_VALUE;
+        DataCallResponse response = new DataCallResponse(0, Integer.MAX_VALUE, 1, 2, "IP",
+                FAKE_IFNAME, FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
         AsyncResult ar = new AsyncResult(null, response, null);
         assertEquals(RetryManager.NO_RETRY, getSuggestedRetryDelay(ar));
     }
index ccbd084..4df3693 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
-import android.os.Parcel;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import com.android.internal.telephony.RILConstants;
+
 import junit.framework.TestCase;
 
 public class DataProfileTest extends TestCase {
@@ -81,11 +82,11 @@ public class DataProfileTest extends TestCase {
 
     @SmallTest
     public void testCreateFromApnSetting() throws Exception {
-        DataProfile dp = new DataProfile(mApn1, false);
+        DataProfile dp = new DataProfile(mApn1);
         assertEquals(mApn1.profileId, dp.profileId);
         assertEquals(mApn1.apn, dp.apn);
         assertEquals(mApn1.protocol, dp.protocol);
-        assertEquals(mApn1.authType, dp.authType);
+        assertEquals(RILConstants.SETUP_DATA_AUTH_PAP_CHAP, dp.authType);
         assertEquals(mApn1.user, dp.user);
         assertEquals(mApn1.password, dp.password);
         assertEquals(0, dp.type);
@@ -96,41 +97,12 @@ public class DataProfileTest extends TestCase {
     }
 
     @SmallTest
-    public void testParcel() throws Exception {
-        Parcel p = Parcel.obtain();
-
-        DataProfile[] dps = new DataProfile[]{new DataProfile(mApn1, false),
-                new DataProfile(mApn1, false)};
-
-        DataProfile.toParcel(p, dps);
-        p.setDataPosition(0);
-
-        assertEquals(dps.length, p.readInt());
-        for (int i = 0; i < dps.length; i++) {
-            assertEquals("i = " + i, mApn1.profileId, p.readInt());
-            assertEquals("i = " + i, mApn1.apn, p.readString());
-            assertEquals("i = " + i, mApn1.protocol, p.readString());
-            assertEquals("i = " + i, mApn1.authType, p.readInt());
-            assertEquals("i = " + i, mApn1.user, p.readString());
-            assertEquals("i = " + i, mApn1.password, p.readString());
-            assertEquals("i = " + i, 0, p.readInt());
-            assertEquals("i = " + i, mApn1.maxConnsTime, p.readInt());
-            assertEquals("i = " + i, mApn1.maxConns, p.readInt());
-            assertEquals("i = " + i, mApn1.waitTime, p.readInt());
-            assertEquals("i = " + i, mApn1.carrierEnabled?1:0, p.readInt());
-        }
-    }
-
-    @SmallTest
     public void testEquals() throws Exception {
-        DataProfile dp1 = new DataProfile(mApn1, false);
-        DataProfile dp2 = new DataProfile(mApn1, false);
+        DataProfile dp1 = new DataProfile(mApn1);
+        DataProfile dp2 = new DataProfile(mApn1);
         assertEquals(dp1, dp2);
 
-        dp2 = new DataProfile(mApn1, true);
-        assertFalse(dp1.equals(dp2));
-
-        dp2 = new DataProfile(mApn2, false);
+        dp2 = new DataProfile(mApn2);
         assertFalse(dp1.equals(dp2));
     }
 }
index cb4232c..f2661f6 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
+import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_ADDRESS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_DNS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_GATEWAY;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_IFNAME;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_PCSCF_ADDRESS;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
 import android.net.LinkProperties;
 import android.os.AsyncResult;
 import android.os.Handler;
@@ -38,15 +53,6 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
 public class DcControllerTest extends TelephonyTest {
 
     private static final int DATA_CONNECTION_ACTIVE_PH_LINK_DORMANT = 1;
@@ -117,8 +123,9 @@ public class DcControllerTest extends TelephonyTest {
     public void testDataDormant() {
         assertEquals("DccDefaultState", getCurrentState().getName());
         ArrayList<DataCallResponse> l = new ArrayList<DataCallResponse>();
-        DataCallResponse dcResponse = DcTrackerTest.createDataCallResponse();
-        dcResponse.active = DATA_CONNECTION_ACTIVE_PH_LINK_DORMANT;
+        DataCallResponse dcResponse = new DataCallResponse(0, -1, 1,
+                DATA_CONNECTION_ACTIVE_PH_LINK_DORMANT, "IP", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
         l.add(dcResponse);
 
         mDc.mCid = 1;
index c3b0b80..51e0716 100644 (file)
 
 package com.android.internal.telephony.dataconnection;
 
+import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
 import android.app.AlarmManager;
 import android.app.PendingIntent;
 import android.content.ContentResolver;
@@ -32,7 +50,6 @@ import android.os.HandlerThread;
 import android.os.IBinder;
 import android.os.Message;
 import android.os.PersistableBundle;
-import android.platform.test.annotations.Postsubmit;
 import android.provider.Settings;
 import android.provider.Telephony;
 import android.telephony.CarrierConfigManager;
@@ -66,23 +83,6 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
 public class DcTrackerTest extends TelephonyTest {
 
     private final static String[] sNetworkAttributes = new String[]{
@@ -95,14 +95,14 @@ public class DcTrackerTest extends TelephonyTest {
     private final static List<String> sApnTypes = Arrays.asList(
             "default", "mms", "cbs", "fota", "supl", "ia", "emergency", "dun", "hipri", "ims");
 
-    private static final String FAKE_APN1 = "FAKE APN 1";
-    private static final String FAKE_APN2 = "FAKE APN 2";
-    private static final String FAKE_APN3 = "FAKE APN 3";
-    private static final String FAKE_IFNAME = "FAKE IFNAME";
-    private static final String FAKE_PCSCF_ADDRESS = "22.33.44.55";
-    private static final String FAKE_GATEWAY = "11.22.33.44";
-    private static final String FAKE_DNS = "55.66.77.88";
-    private static final String FAKE_ADDRESS = "99.88.77.66";
+    public static final String FAKE_APN1 = "FAKE APN 1";
+    public static final String FAKE_APN2 = "FAKE APN 2";
+    public static final String FAKE_APN3 = "FAKE APN 3";
+    public static final String FAKE_IFNAME = "FAKE IFNAME";
+    public static final String FAKE_PCSCF_ADDRESS = "22.33.44.55";
+    public static final String FAKE_GATEWAY = "11.22.33.44";
+    public static final String FAKE_DNS = "55.66.77.88";
+    public static final String FAKE_ADDRESS = "99.88.77.66";
 
     @Mock
     ISub mIsub;
@@ -252,7 +252,7 @@ public class DcTrackerTest extends TelephonyTest {
                             "",                     // mmsport
                             "",                     // user
                             "",                     // password
-                            3,                      // authtype
+                            -1,                     // authtype
                             "ims",                  // types
                             "IP",                   // protocol
                             "IP",                   // roaming_protocol
@@ -355,21 +355,30 @@ public class DcTrackerTest extends TelephonyTest {
     // Create a successful data response
     public static DataCallResponse createDataCallResponse() {
 
-        DataCallResponse dcResponse = new DataCallResponse();
-
-        dcResponse.version = 11;
-        dcResponse.status = 0;
-        dcResponse.suggestedRetryTime = -1; // No retry suggested by the modem
-        dcResponse.cid = 1;
-        dcResponse.active = 2;
-        dcResponse.type = "IP";
-        dcResponse.ifname = FAKE_IFNAME;
-        dcResponse.mtu = 1440;
-        dcResponse.addresses = new String[]{FAKE_ADDRESS};
-        dcResponse.dnses = new String[]{FAKE_DNS};
-        dcResponse.gateways = new String[]{FAKE_GATEWAY};
-        dcResponse.pcscf = new String[]{FAKE_PCSCF_ADDRESS};
-        return dcResponse;
+        return new DataCallResponse(0, -1, 1, 2, "IP", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
+    }
+
+    private void verifyDataProfile(DataProfile dp, String apn, int profileId,
+                                   int supportedApnTypesBitmap) {
+        assertEquals(profileId, dp.profileId);
+        assertEquals(apn, dp.apn);
+        assertEquals("IP", dp.protocol);
+        assertEquals(0, dp.authType);
+        assertEquals("", dp.user);
+        assertEquals("", dp.password);
+        assertEquals(0, dp.type);
+        assertEquals(0, dp.maxConnsTime);
+        assertEquals(0, dp.maxConns);
+        assertEquals(0, dp.waitTime);
+        assertTrue(dp.enabled);
+        assertEquals(supportedApnTypesBitmap, dp.supportedApnTypesBitmap);
+        assertEquals("IP", dp.roamingProtocol);
+        assertEquals(0, dp.bearerBitmap);
+        assertEquals(0, dp.mtu);
+        assertEquals("", dp.mvnoType);
+        assertEquals("", dp.mvnoMatchData);
+        assertFalse(dp.modemCognitive);
     }
 
     private void verifyDataConnected(final String apnSetting) {
@@ -458,10 +467,12 @@ public class DcTrackerTest extends TelephonyTest {
         allowed = isDataAllowed(failureReason);
         assertTrue(failureReason.getDataAllowFailReason(), allowed);
 
+        ArgumentCaptor<DataProfile> dpCaptor = new ArgumentCaptor<>();
         // Verify if RIL command was sent properly.
         verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN1),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 5);
 
         verifyDataConnected(FAKE_APN1);
     }
@@ -473,9 +484,9 @@ public class DcTrackerTest extends TelephonyTest {
 
         mDct.setDataEnabled(true);
 
-        DataCallResponse dcResponse = createDataCallResponse();
         // LOST_CONNECTION(0x10004) is a non-permanent failure, so we'll retry data setup later.
-        dcResponse.status = 0x10004;
+        DataCallResponse dcResponse = new DataCallResponse(0x10004, -1, 1, 2, "IP", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
         // Simulate RIL fails the data call setup
         mSimulatedCommands.setDataCallResponse(false, dcResponse);
 
@@ -522,10 +533,12 @@ public class DcTrackerTest extends TelephonyTest {
         allowed = isDataAllowed(failureReason);
         assertTrue(failureReason.getDataAllowFailReason(), allowed);
 
+        ArgumentCaptor<DataProfile> dpCaptor = new ArgumentCaptor<>();
         // Verify if RIL command was sent properly.
         verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN1),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 5);
 
         // Make sure we never notify connected because the data call setup is supposed to fail.
         verify(mPhone, never()).notifyDataConnection(eq(Phone.REASON_CONNECTED),
@@ -546,10 +559,12 @@ public class DcTrackerTest extends TelephonyTest {
         mContext.sendBroadcast(intent);
         waitForMs(200);
 
+        dpCaptor = new ArgumentCaptor<>();
         // Verify if RIL command was sent properly.
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN2),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
+        verify(mSimulatedCommandsVerifier, times(2)).setupDataCall(
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN2, 0, 5);
 
         // Verify connected with APN2 setting.
         verifyDataConnected(FAKE_APN2);
@@ -578,12 +593,11 @@ public class DcTrackerTest extends TelephonyTest {
         mDct.setDataEnabled(true);
 
         waitForMs(200);
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN1),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(2), eq(FAKE_APN3),
-                eq(""), eq(""), eq(3), eq("IP"), any(Message.class));
+        ArgumentCaptor<DataProfile> dpCaptor = new ArgumentCaptor<>();
+        verify(mSimulatedCommandsVerifier, times(2)).setupDataCall(
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 5);
 
         logd("Sending DATA_DISABLED_CMD");
         mDct.setDataEnabled(false);
@@ -629,13 +643,12 @@ public class DcTrackerTest extends TelephonyTest {
         logd("Sending DATA_ENABLED_CMD");
         mDct.setDataEnabled(true);
 
-        waitForMs(200);
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN1),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(2), eq(FAKE_APN3),
-                eq(""), eq(""), eq(3), eq("IP"), any(Message.class));
+        waitForMs(300);
+        ArgumentCaptor<DataProfile> dpCaptor = new ArgumentCaptor<>();
+        verify(mSimulatedCommandsVerifier, times(2)).setupDataCall(
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 5);
 
         //user is in roaming
         doReturn(true).when(mServiceState).getDataRoaming();
@@ -689,12 +702,11 @@ public class DcTrackerTest extends TelephonyTest {
         mDct.setDataEnabled(true);
 
         waitForMs(200);
-        verify(mSimulatedCommandsVerifier, times(0)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN1),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
+        ArgumentCaptor<DataProfile> dpCaptor = new ArgumentCaptor<>();
         verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(2), eq(FAKE_APN3),
-                eq(""), eq(""), eq(3), eq("IP"), any(Message.class));
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN3, 2, 64);
 
         assertEquals(DctConstants.State.CONNECTED, mDct.getOverallState());
         assertEquals(DctConstants.State.IDLE, mDct.getState(PhoneConstants.APN_TYPE_DEFAULT));
@@ -791,12 +803,11 @@ public class DcTrackerTest extends TelephonyTest {
         mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_CONNECTION_ATTACHED, null));
         waitForMs(200);
 
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(2), eq(FAKE_APN3),
-                eq(""), eq(""), eq(3), eq("IP"), any(Message.class));
-        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
-                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), eq(0), eq(FAKE_APN1),
-                eq(""), eq(""), eq(0), eq("IP"), any(Message.class));
+        ArgumentCaptor<DataProfile> dpCaptor = new ArgumentCaptor<>();
+        verify(mSimulatedCommandsVerifier, times(2)).setupDataCall(
+                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
+                eq(false), eq(false), any(Message.class));
+        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 5);
         assertEquals(DctConstants.State.CONNECTED, mDct.getOverallState());
 
         Message msg = mDct.obtainMessage(DctConstants.EVENT_SET_CARRIER_DATA_ENABLED);
index 8618628..7931df0 100644 (file)
@@ -22,6 +22,11 @@ import static android.telephony.ServiceState.ROAMING_TYPE_DOMESTIC;
 import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEACTIVATE_DATA_CALL;
 import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS;
 import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SETUP_DATA_CALL;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_ADDRESS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_DNS;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_GATEWAY;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_IFNAME;
+import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_PCSCF_ADDRESS;
 import static com.android.internal.telephony.nano.TelephonyProto.PdpType.PDP_TYPE_IPV4V6;
 
 import static org.junit.Assert.assertArrayEquals;
@@ -341,13 +346,8 @@ public class TelephonyMetricsTest extends TelephonyTest {
     @Test
     @SmallTest
     public void testWriteOnSetupDataCallResponse() throws Exception {
-        DataCallResponse response = new DataCallResponse();
-        response.status = 5;
-        response.suggestedRetryTime = 6;
-        response.cid = 7;
-        response.active = 8;
-        response.type = "IPV4V6";
-        response.ifname = "ifname";
+        DataCallResponse response = new DataCallResponse(5, 6, 7, 8, "IPV4V6", FAKE_IFNAME,
+                FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
 
         mMetrics.writeOnRilSolicitedResponse(mPhone.getPhoneId(), 1, 2,
                 RIL_REQUEST_SETUP_DATA_CALL, response);
@@ -364,7 +364,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
         assertEquals(6, respProto.suggestedRetryTimeMillis);
         assertEquals(7, respProto.call.cid);
         assertEquals(PDP_TYPE_IPV4V6, respProto.call.type);
-        assertEquals("ifname", respProto.call.iframe);
+        assertEquals(FAKE_IFNAME, respProto.call.iframe);
     }
 
     // Test write on deactivate data call response
@@ -523,7 +523,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
         assertEquals(1, log.events.length);
         assertEquals(0, log.callSessions.length);
         assertEquals(0, log.smsSessions.length);
-        
+
         assertFalse(log.eventsDropped);
 
         TelephonyEvent event = log.events[0];
@@ -564,7 +564,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
         assertEquals(1, log.events.length);
         assertEquals(0, log.callSessions.length);
         assertEquals(0, log.smsSessions.length);
-        
+
         assertFalse(log.eventsDropped);
 
         TelephonyEvent event = log.events[0];