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

Commit 106d2714 authored by johnwang's avatar johnwang
Browse files

Add technology and authentication type in setupDataCall.

SetupDataCall needs radio technology parameter to identify CDMA and GSM type. 0 means CDMA and 1 means GSM. The values are different from GSM_PHONE and CDMA_PHONE. Add authType parameter to identify PAP/CHAP authentication. Currently the authType is set to use both PAP and CHAP in CDMA phone.

	modified:   telephony/java/com/android/internal/telephony/CommandsInterface.java
	modified:   telephony/java/com/android/internal/telephony/RIL.java
	modified:   telephony/java/com/android/internal/telephony/RILConstants.java
	modified:   telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java
	modified:   telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
	modified:   telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
parent 5190c492
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1300,11 +1300,13 @@ public interface CommandsInterface {
     *            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 result
     *            Callback message
     */
    public void setupDataCall(String radioTechnology, String profile, String apn,
            String user, String password, Message result);
            String user, String password, String authType, Message result);

    /**
     * Deactivate packet data connection
+17 −13
Original line number Diff line number Diff line
@@ -1237,10 +1237,17 @@ public final class RIL extends BaseCommands implements CommandsInterface {
     */
    public void
    setupDefaultPDP(String apn, String user, String password, Message result) {
        String radioTechnology = "1"; //0 for CDMA, 1 for GSM/UMTS
        int radioTechnology;
        int authType;
        String profile = ""; //profile number, NULL for GSM/UMTS
        setupDataCall(radioTechnology, profile, apn, user,
                password, result);

        radioTechnology = RILConstants.SETUP_DATA_TECH_GSM;
        //TODO(): Add to the APN database, AuthType is set to CHAP/PAP
        authType = (user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP
                : RILConstants.SETUP_DATA_AUTH_NONE;

        setupDataCall(Integer.toString(radioTechnology), profile, apn, user,
                password, Integer.toString(authType), result);

    }

@@ -1259,7 +1266,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
     */
    public void
    setupDataCall(String radioTechnology, String profile, String apn,
            String user, String password, Message result) {
            String user, String password, String authType, Message result) {
        RILRequest rr
                = RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result);

@@ -1270,15 +1277,12 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        rr.mp.writeString(apn);
        rr.mp.writeString(user);
        rr.mp.writeString(password);
        //TODO(): Add to the APN database, AuthType is set to CHAP/PAP
        // 0 => Neither PAP nor CHAP will be performed, 3 => PAP / CHAP will be performed.
        if (user != null)
            rr.mp.writeString("3");
        else
            rr.mp.writeString("0");

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " "
                + apn);
        rr.mp.writeString(authType);

        if (RILJ_LOGD) riljLog(rr.serialString() + "> "
                + requestToString(rr.mRequest) + " " + radioTechnology + " "
                + profile + " " + apn + " " + user + " "
                + password + " " + authType);

        send(rr);
    }
+8 −0
Original line number Diff line number Diff line
@@ -79,6 +79,14 @@ public interface RILConstants {
    int CDM_TTY_HCO_MODE = 2;
    int CDM_TTY_VCO_MODE = 3;

    /* Setup a packet data connection. See ril.h RIL_REQUEST_SETUP_DATA_CALL */
    int SETUP_DATA_TECH_CDMA      = 0;
    int SETUP_DATA_TECH_GSM       = 1;
    int SETUP_DATA_AUTH_NONE      = 0;
    int SETUP_DATA_AUTH_PAP       = 1;
    int SETUP_DATA_AUTH_CHAP      = 2;
    int SETUP_DATA_AUTH_PAP_CHAP  = 3;

/*
cat include/telephony/ril.h | \
   egrep '^#define' | \
+3 −2
Original line number Diff line number Diff line
@@ -143,9 +143,10 @@ public class CdmaDataConnection extends DataConnection {
        lastFailTime = -1;
        lastFailCause = FailCause.NONE;
        receivedDisconnectReq = false;
        phone.mCM.setupDataCall(Integer.toString(RILConstants.CDMA_PHONE),
        phone.mCM.setupDataCall(Integer.toString(RILConstants.SETUP_DATA_TECH_CDMA),
                Integer.toString(RILConstants.DATA_PROFILE_DEFAULT), null, null,
                null, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
                null, Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP),
                obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
    }

    private void tearDownData(Message msg) {
+6 −2
Original line number Diff line number Diff line
@@ -84,9 +84,13 @@ public class PdpConnection extends DataConnection {
        lastFailCause = FailCause.NONE;
        receivedDisconnectReq = false;

        phone.mCM.setupDataCall(Integer.toString(RILConstants.GSM_PHONE),
        int authType = (apn.user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP :
            RILConstants.SETUP_DATA_AUTH_NONE;

        phone.mCM.setupDataCall(Integer.toString(RILConstants.SETUP_DATA_TECH_GSM),
                Integer.toString(RILConstants.DATA_PROFILE_DEFAULT), apn.apn, apn.user,
                apn.password, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
                apn.password, Integer.toString(authType),
                obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
    }

    private void tearDownData(Message msg) {
Loading