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

Commit 0e42864a authored by Yashdev Singh's avatar Yashdev Singh Committed by Etan Cohen
Browse files

Telephony: Implementation of IWLAN

- Allow registration polling in radio off state.
- Disable default APN if current RAT is IWLAN.
- Allow non-default PDP activation in radio off state provided
  current RAT is IWLAN.

Set data registration state in APM for IWLAN RAT
- APM causes data registration state to be POWER_OFF. Set it
  to IN_SERVICE for iwlan case
- In APM, UNSOL_VOICE_NETWORK_STATE_CHANGED resets data RAT and
  registration state to POWER_OFF. Ensure that this is done only
  when current RAT is not IWLAN or when iwlan feature is not
  available.

Change-Id: I419f3df987ef90bb5f31b0e381257a81dcc57c3b
parent 04b0216a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ public interface Phone {
    static final String REASON_CONNECTED = "connected";
    static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
    static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled";
    static final String REASON_IWLAN_AVAILABLE = "iwlanAvailable";

    // Used for band mode selection methods
    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
+25 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.util.TimeUtils;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.content.Context;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -1058,4 +1061,26 @@ public abstract class ServiceStateTracker extends Handler {
    protected int getPhoneId() {
        return mPhoneBase.getPhoneId();
    }

    /* Reset Service state when IWLAN is enabled as polling in airplane mode
     * causes state to go to OUT_OF_SERVICE state instead of STATE_OFF
     */
    protected void resetServiceStateInIwlanMode() {
        if (mCi.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
            boolean resetIwlanRatVal = false;
            log("set service state as POWER_OFF");
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        == mNewSS.getRilDataRadioTechnology()) {
                log("pollStateDone: mNewSS = " + mNewSS);
                log("pollStateDone: reset iwlan RAT value");
                resetIwlanRatVal = true;
            }
            mNewSS.setStateOff();
            if (resetIwlanRatVal) {
                mNewSS.setRilDataRadioTechnology(ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN);
                mNewSS.setDataRegState(ServiceState.STATE_IN_SERVICE);
                log("pollStateDone: mNewSS = " + mNewSS);
            }
        }
    }
}
+21 −4
Original line number Diff line number Diff line
@@ -25,7 +25,10 @@ import com.android.internal.telephony.uicc.RuimRecords;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.dataconnection.DcTrackerBase;
import com.android.internal.telephony.PhoneConstants;

import android.telephony.CellInfo;
import android.telephony.CellInfoLte;
@@ -276,8 +279,10 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
                setSignalStrengthDefaultValues();
                mGotCountryCode = false;

                if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        != mSS.getRilDataRadioTechnology()) {
                    pollStateDone();
                break;
                }

            default:
                // Issue all poll-related commands at once, then count
@@ -362,6 +367,8 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

        boolean hasLocationChanged = !mNewCellLoc.equals(mCellLoc);

        resetServiceStateInIwlanMode();

        boolean has4gHandoff =
                mNewSS.getDataRegState() == ServiceState.STATE_IN_SERVICE &&
                (((mSS.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
@@ -427,6 +434,11 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

        if (hasDataRadioTechnologyChanged) {
            tm.setDataNetworkTypeForPhone(mPhone.getPhoneId(), mSS.getRilDataRadioTechnology());
        
			if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        == mSS.getRilDataRadioTechnology()) {
                log("pollStateDone: IWLAN enabled");
            }
		}

        if (hasRegistered) {
@@ -538,8 +550,13 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

        if ((hasCdmaDataConnectionChanged || hasDataRadioTechnologyChanged)) {
            notifyDataRegStateRilRadioTechnologyChanged();
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        == mSS.getRilDataRadioTechnology()) {
                mPhone.notifyDataConnection(Phone.REASON_IWLAN_AVAILABLE);
            } else {
                mPhone.notifyDataConnection(null);
            }
        }

        if (hasVoiceRoamingOn) {
            mVoiceRoamingOnRegistrants.notifyRegistrants();
+17 −9
Original line number Diff line number Diff line
@@ -815,12 +815,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
                return;
            }

            if (!mCi.getRadioState().isOn()) {
                // Radio has crashed or turned off.
                cancelPollState();
                return;
            }

            if (err != CommandException.Error.OP_NOT_ALLOWED_BEFORE_REG_NW) {
                loge("handlePollStateResult: RIL returned an error where it must succeed"
                        + ar.exception);
@@ -1022,8 +1016,10 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            setSignalStrengthDefaultValues();
            mGotCountryCode = false;

            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        != mSS.getRilDataRadioTechnology()) {
                pollStateDone();
            break;
            }

        default:
            // Issue all poll-related commands at once, then count
@@ -1170,6 +1166,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {

        boolean hasLocationChanged = !mNewCellLoc.equals(mCellLoc);

		resetServiceStateInIwlanMode();

        TelephonyManager tm =
                (TelephonyManager) mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE);

@@ -1198,6 +1196,11 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {

        if (hasRilDataRadioTechnologyChanged) {
            tm.setDataNetworkTypeForPhone(mPhone.getPhoneId(), mSS.getRilDataRadioTechnology());

            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        == mSS.getRilDataRadioTechnology()) {
                log("pollStateDone: IWLAN enabled");
            }
        }

        if (hasRegistered) {
@@ -1283,8 +1286,13 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {

        if (hasCdmaDataConnectionChanged || hasRilDataRadioTechnologyChanged) {
            notifyDataRegStateRilRadioTechnologyChanged();
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
                        == mSS.getRilDataRadioTechnology()) {
                mPhone.notifyDataConnection(Phone.REASON_IWLAN_AVAILABLE);
            } else {
                mPhone.notifyDataConnection(null);
            }
        }

        if (hasVoiceRoamingOn) {
            mVoiceRoamingOnRegistrants.notifyRegistrants();
+3 −1
Original line number Diff line number Diff line
@@ -581,7 +581,9 @@ public final class DataConnection extends StateMachine {
                discReason = RILConstants.DEACTIVATE_REASON_PDP_RESET;
            }
        }
        if (mPhone.mCi.getRadioState().isOn()) {
        if (mPhone.mCi.getRadioState().isOn()
                || (mPhone.getServiceState().getRilDataRadioTechnology()
                        == ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN )) {
            if (DBG) log("tearDownData radio is on, call deactivateDataCall");
            mPhone.mCi.deactivateDataCall(mCid, discReason,
                    obtainMessage(EVENT_DEACTIVATE_DONE, mTag, 0, o));
Loading