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

Commit d8591020 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Add reason field to DEACTIVATE_DATA_CALL request."

parents eae7133b 6ef74b1b
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -951,22 +951,6 @@ public interface CommandsInterface {

    void writeSmsToRuim(int status, String pdu, Message response);

    /**
     * @param apn
     * @param user
     * @param password
     * @param response
     */
    @Deprecated
    void setupDefaultPDP(String apn, String user, String password, Message response);

    /**
     * @param cid
     * @param response
     */
    @Deprecated
    void deactivateDefaultPDP(int cid, Message response);

    void setRadioPower(boolean on, Message response);

    void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message response);
@@ -1354,10 +1338,12 @@ public interface CommandsInterface {
     *
     * @param cid
     *            The connection ID
     * @param reason
     *            Data disconnect reason.
     * @param result
     *            Callback message is empty on completion
     */
    public void deactivateDataCall(int cid, Message result);
    public void deactivateDataCall(int cid, int reason, Message result);

    /**
     * Activate or deactivate cell broadcast SMS for CDMA.
+12 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.net.LinkProperties;
import android.os.AsyncResult;
import android.os.Message;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.EventLog;

import java.net.InetAddress;
@@ -312,9 +313,19 @@ public abstract class DataConnection extends HierarchicalStateMachine {
     *          and is either a DisconnectParams or ConnectionParams.
     */
    private void tearDownData(Object o) {
        int discReason = RILConstants.DEACTIVATE_REASON_NONE;
        if ((o != null) && (o instanceof DisconnectParams)) {
            DisconnectParams dp = (DisconnectParams)o;
            Message m = dp.onCompletedMsg;
            if ((m != null) && (m.obj != null) && (m.obj instanceof String)) {
                String reason = (String)m.obj;
                if (TextUtils.equals(reason, Phone.REASON_RADIO_TURNED_OFF))
                    discReason = RILConstants.DEACTIVATE_REASON_RADIO_OFF;
            }
        }
        if (phone.mCM.getRadioState().isOn()) {
            if (DBG) log("tearDownData radio is on, call deactivateDataCall");
            phone.mCM.deactivateDataCall(cid, obtainMessage(EVENT_DEACTIVATE_DONE, o));
            phone.mCM.deactivateDataCall(cid, discReason, obtainMessage(EVENT_DEACTIVATE_DONE, o));
        } else {
            if (DBG) log("tearDownData radio is off sendMessage EVENT_DEACTIVATE_DONE immediately");
            AsyncResult ar = new AsyncResult(o, null, null);
+4 −30
Original line number Diff line number Diff line
@@ -1264,33 +1264,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        return 1;
    }

    /**
     * @deprecated
     */
    public void
    setupDefaultPDP(String apn, String user, String password, Message result) {
        int radioTechnology;
        int authType;
        String profile = ""; //profile number, NULL for GSM/UMTS

        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);

    }

    /**
     * @deprecated
     */
    public void
    deactivateDefaultPDP(int cid, Message result) {
        deactivateDataCall(cid, result);
    }

    /**
     * The preferred new alternative to setupDefaultPDP that is
     * CDMA-compatible.
@@ -1329,15 +1302,16 @@ public final class RIL extends BaseCommands implements CommandsInterface {
    }

    public void
    deactivateDataCall(int cid, Message result) {
    deactivateDataCall(int cid, int reason, Message result) {
        RILRequest rr
                = RILRequest.obtain(RIL_REQUEST_DEACTIVATE_DATA_CALL, result);

        rr.mp.writeInt(1);
        rr.mp.writeInt(2);
        rr.mp.writeString(Integer.toString(cid));
        rr.mp.writeString(Integer.toString(reason));

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " +
                requestToString(rr.mRequest) + " " + cid);
                requestToString(rr.mRequest) + " " + cid + " " + reason);

        send(rr);
    }
+4 −0
Original line number Diff line number Diff line
@@ -96,6 +96,10 @@ public interface RILConstants {
    int SETUP_DATA_AUTH_CHAP      = 2;
    int SETUP_DATA_AUTH_PAP_CHAP  = 3;

    /* Deactivate data call reasons */
    int DEACTIVATE_REASON_NONE = 0;
    int DEACTIVATE_REASON_RADIO_OFF = 1;

/*
cat include/telephony/ril.h | \
   egrep '^#define' | \
+17 −38
Original line number Diff line number Diff line
@@ -569,40 +569,20 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
        msg.obj = CDMAPhone.REASON_RADIO_TURNED_OFF;

        synchronized (this) {
            if (networkType == ServiceState.RADIO_TECHNOLOGY_1xRTT) {
                /*
                 * In 1x CDMA , during radio power off modem will disconnect the
                 * data call and sends the power down registration message along
                 * with the data call release message to the network
                 */

                msg.arg1 = 0; // tearDown is false since modem does it anyway for 1X
                dcTracker.sendMessage(msg);

                Log.w(LOG_TAG, "Turn off the radio right away");
                hangupAndPowerOff();
            } else {
            if (!mPendingRadioPowerOffAfterDataOff) {
                DataConnectionTracker.State currentState = dcTracker.getState();
                if (currentState != DataConnectionTracker.State.CONNECTED
                    && currentState != DataConnectionTracker.State.DISCONNECTING
                    && currentState != DataConnectionTracker.State.INITING) {

                    msg.arg1 = 0; // tearDown is false as it is not needed.
                    dcTracker.sendMessage(msg);

                        if (DBG)
                            log("Data disconnected, turn off radio right away.");
                    if (DBG) log("Data disconnected, turn off radio right away.");
                    hangupAndPowerOff();
                } else {
                        // clean data connection
                    msg.arg1 = 1; // tearDown is true
                    dcTracker.sendMessage(msg);

                    if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
                            if (DBG) {
                                log("Wait upto 30s for data to disconnect, then turn off radio.");
                            }
                        if (DBG) log("Wait upto 30s for data to disconnect, then turn off radio.");
                        mPendingRadioPowerOffAfterDataOff = true;
                    } else {
                        Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away.");
@@ -612,7 +592,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
            }
        }
    }
    }

    @Override
    protected void updateSpnDisplay() {
Loading