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

Commit 48a95017 authored by Cristoforo Cataldo's avatar Cristoforo Cataldo
Browse files

Correctly provide the technology to setup data connection

This commit allows to correctly manage GSM data connection on legacy
RILs and provides a better readable method to get the technology that
will be used to setup data connection.

Change-Id: Ide4e5d193a35d6f02c5320fe8afe9a24659c97d9
parent 75f40a91
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -567,15 +567,30 @@ public final class DataConnection extends StateMachine {
        }

        mPhone.mCi.setupDataCall(
                Integer.toString((mPhone.mCi.getRilVersion() > 4) ? cp.mRilRat + 2
                        : ServiceState.isGsm(cp.mRilRat + 2) ? RILConstants.SETUP_DATA_TECH_GSM
                        : RILConstants.SETUP_DATA_TECH_CDMA),
                getDataTechnology(cp.mRilRat),
                Integer.toString(dataProfileId),
                mApnSetting.apn, mApnSetting.user, mApnSetting.password,
                Integer.toString(authType),
                protocol, msg);
    }

    /**
     * Get the technology that will be used to setup the data connection.
     *
     * @param radioTechnology is the ril radio technology.
     */
    private String getDataTechnology(int radioTechnology) {
        int dataTechnology = radioTechnology + 2;
        if (mPhone.mCi.getRilVersion() < 5) {
            if (ServiceState.isGsm(radioTechnology)) {
                dataTechnology = RILConstants.SETUP_DATA_TECH_GSM;
            } else if (ServiceState.isCdma(radioTechnology)) {
                dataTechnology = RILConstants.SETUP_DATA_TECH_CDMA;
            }
        }
        return Integer.toString(dataTechnology);
    }

    /**
     * TearDown the data connection when the deactivation is complete a Message with
     * msg.what == EVENT_DEACTIVATE_DONE and msg.obj == AsyncResult with AsyncResult.obj