FileDocCategorySizeDatePackage
CDMALTEPhone.javaAPI DocAndroid 5.1 API17088Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony.cdma

CDMALTEPhone

public class CDMALTEPhone extends CDMAPhone

Fields Summary
static final String
LOG_LTE_TAG
private static final boolean
DBG
private com.android.internal.telephony.uicc.SIMRecords
mSimRecords
CdmaLtePhone in addition to RuimRecords available from PhoneBase needs access to SIMRecords and IsimUiccRecords
private com.android.internal.telephony.uicc.IsimUiccRecords
mIsimUiccRecords
Constructors Summary
public CDMALTEPhone(android.content.Context context, com.android.internal.telephony.CommandsInterface ci, com.android.internal.telephony.PhoneNotifier notifier, int phoneId)


    // Constructors
          
              
        this(context, ci, notifier, false, phoneId);
    
public CDMALTEPhone(android.content.Context context, com.android.internal.telephony.CommandsInterface ci, com.android.internal.telephony.PhoneNotifier notifier, boolean unitTestMode, int phoneId)

        super(context, ci, notifier, phoneId);

        Rlog.d(LOG_TAG, "CDMALTEPhone: constructor: sub = " + mPhoneId);

        mDcTracker = new DcTracker(this);

    
Methods Summary
public voiddispose()

        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
            if (mSimRecords != null) {
                mSimRecords.unregisterForRecordsLoaded(this);
            }
            super.dispose();
        }
    
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        pw.println("CDMALTEPhone extends:");
        super.dump(fd, pw, args);
    
public voidgetAvailableNetworks(android.os.Message response)

        mCi.getAvailableNetworks(response);
    
public PhoneConstants.DataStategetDataConnectionState(java.lang.String apnType)

        PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;

        if (mSST == null) {
            // Radio Technology Change is ongoing, dispose() and
            // removeReferences() have already been called

            ret = PhoneConstants.DataState.DISCONNECTED;
        } else if (mDcTracker.isApnTypeEnabled(apnType) == false) {
            ret = PhoneConstants.DataState.DISCONNECTED;
        } else {
            switch (mDcTracker.getState(apnType)) {
                case RETRYING:
                case FAILED:
                case IDLE:
                    ret = PhoneConstants.DataState.DISCONNECTED;
                    break;

                case CONNECTED:
                case DISCONNECTING:
                    if (mCT.mState != PhoneConstants.State.IDLE &&
                            !mSST.isConcurrentVoiceAndDataAllowed()) {
                        ret = PhoneConstants.DataState.SUSPENDED;
                    } else {
                        ret = PhoneConstants.DataState.CONNECTED;
                    }
                    break;

                case CONNECTING:
                case SCANNING:
                    ret = PhoneConstants.DataState.CONNECTING;
                    break;
            }
        }

        log("getDataConnectionState apnType=" + apnType + " ret=" + ret);
        return ret;
    
public java.lang.StringgetDeviceSvn()

        return mImeiSv;
    
public java.lang.StringgetGroupIdLevel1()

        return (mSimRecords != null) ? mSimRecords.getGid1() : "";
    
public java.lang.StringgetImei()

        return mImei;
    
public com.android.internal.telephony.uicc.IsimRecordsgetIsimRecords()

        return mIsimUiccRecords;
    
public java.lang.StringgetMsisdn()

        return (mSimRecords != null) ? mSimRecords.getMsisdnNumber() : null;
    
public java.lang.StringgetOperatorNumeric()

return
operator numeric.

        String operatorNumeric = null;
        IccRecords curIccRecords = null;
        if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) {
            operatorNumeric = SystemProperties.get("ro.cdma.home.operator.numeric");
        } else if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_RUIM_SIM) {
            curIccRecords = mSimRecords;
            if (curIccRecords != null) {
                operatorNumeric = curIccRecords.getOperatorNumeric();
            } else {
                curIccRecords = mIccRecords.get();
                if (curIccRecords != null && (curIccRecords instanceof RuimRecords)) {
                    RuimRecords csim = (RuimRecords) curIccRecords;
                    operatorNumeric = csim.getRUIMOperatorNumeric();
                }
            }
        }
        if (operatorNumeric == null) {
            Rlog.e(LOG_TAG, "getOperatorNumeric: Cannot retrieve operatorNumeric:"
                    + " mCdmaSubscriptionSource = " + mCdmaSubscriptionSource + " mIccRecords = "
                    + ((curIccRecords != null) ? curIccRecords.getRecordsLoaded() : null));
        }

        Rlog.d(LOG_TAG, "getOperatorNumeric: mCdmaSubscriptionSource = " + mCdmaSubscriptionSource
                + " operatorNumeric = " + operatorNumeric);

        return operatorNumeric;
    
public java.lang.StringgetSubscriberId()

        return (mSimRecords != null) ? mSimRecords.getIMSI() : "";
    
public java.lang.StringgetSystemProperty(java.lang.String property, java.lang.String defValue)

        if(getUnitTestMode()) {
            return null;
        }
        return TelephonyManager.getTelephonyProperty(mPhoneId, property, defValue);
    
public voidhandleMessage(android.os.Message msg)

        AsyncResult ar;
        Message onComplete;

        // messages to be handled whether or not the phone is being destroyed
        // should only include messages which are being re-directed and do not use
        // resources of the phone being destroyed
        switch (msg.what) {
            // handle the select network completion callbacks.
            case EVENT_SET_NETWORK_MANUAL_COMPLETE:
            case EVENT_SET_NETWORK_AUTOMATIC_COMPLETE:
                super.handleMessage(msg);
                return;
        }

        if (!mIsTheCurrentActivePhone) {
            Rlog.e(LOG_TAG, "Received message " + msg +
                    "[" + msg.what + "] while being destroyed. Ignoring.");
            return;
        }
        switch(msg.what) {
            case EVENT_SIM_RECORDS_LOADED:
                mSimRecordsLoadedRegistrants.notifyRegistrants();
                break;

            default:
                super.handleMessage(msg);
        }
    
protected voidinit(android.content.Context context, com.android.internal.telephony.PhoneNotifier notifier)

        mCi.setPhoneType(PhoneConstants.PHONE_TYPE_CDMA);
        mCT = new CdmaCallTracker(this);
        mCdmaSSM = CdmaSubscriptionSourceManager.getInstance(context, mCi, this,
                EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
        mRuimPhoneBookInterfaceManager = new RuimPhoneBookInterfaceManager(this);
        mSubInfo = new PhoneSubInfo(this);
        mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);

        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
        mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
        mCi.registerForOn(this, EVENT_RADIO_ON, null);
        mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
        mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
        mCi.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
        mCi.registerForExitEmergencyCallbackMode(this, EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE,
                null);

        PowerManager pm
            = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,LOG_TAG);

        // This is needed to handle phone process crashes
        String inEcm = SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
        mIsPhoneInEcmState = inEcm.equals("true");
        if (mIsPhoneInEcmState) {
            // Send a message which will invoke handleExitEmergencyCallbackMode
            mCi.exitEmergencyCallbackMode(obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
        }

        // get the string that specifies the carrier OTA Sp number
        mCarrierOtaSpNumSchema = TelephonyManager.from(mContext).getOtaSpNumberSchemaForPhone(
                getPhoneId(), "");

        setProperties();
    
protected voidinitSstIcc()

        mSST = new CdmaLteServiceStateTracker(this);
    
protected voidlog(java.lang.String s)

            Rlog.d(LOG_LTE_TAG, s);
    
protected voidloge(java.lang.String s)

            Rlog.e(LOG_LTE_TAG, s);
    
protected voidloge(java.lang.String s, java.lang.Throwable e)

        Rlog.e(LOG_LTE_TAG, s, e);
    
protected voidonUpdateIccAvailability()

        if (mSimRecords != null) {
            mSimRecords.unregisterForRecordsLoaded(this);
        }

        if (mUiccController == null ) {
            return;
        }

        // Update IsimRecords
        UiccCardApplication newUiccApplication =
                mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_IMS);
        IsimUiccRecords newIsimUiccRecords = null;

        if (newUiccApplication != null) {
            newIsimUiccRecords = (IsimUiccRecords) newUiccApplication.getIccRecords();
        }
        mIsimUiccRecords = newIsimUiccRecords;

        // Update UsimRecords
        newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId,
                UiccController.APP_FAM_3GPP);
        SIMRecords newSimRecords = null;
        if (newUiccApplication != null) {
            newSimRecords = (SIMRecords) newUiccApplication.getIccRecords();
        }
        mSimRecords = newSimRecords;
        if (mSimRecords != null) {
            mSimRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
        }

        super.onUpdateIccAvailability();
    
public voidregisterForAllDataDisconnected(android.os.Handler h, int what, java.lang.Object obj)

        ((DcTracker)mDcTracker)
               .registerForAllDataDisconnected(h, what, obj);
    
public voidregisterForSimRecordsLoaded(android.os.Handler h, int what, java.lang.Object obj)

        mSimRecordsLoadedRegistrants.addUnique(h, what, obj);
    
public voidremoveReferences()

        super.removeReferences();
    
public voidsetInternalDataEnabled(boolean enable, android.os.Message onCompleteMsg)

        ((DcTracker)mDcTracker)
                .setInternalDataEnabled(enable, onCompleteMsg);
    
public booleansetInternalDataEnabledFlag(boolean enable)

       return ((DcTracker)mDcTracker)
                .setInternalDataEnabledFlag(enable);
    
private voidsetProperties()

        TelephonyManager tm = TelephonyManager.from(mContext);
        //Change the system property
        tm.setPhoneType(getPhoneId(), PhoneConstants.PHONE_TYPE_CDMA);
        // Sets operator alpha property by retrieving from build-time system property
        String operatorAlpha = SystemProperties.get("ro.cdma.home.operator.alpha");
        if (!TextUtils.isEmpty(operatorAlpha)) {
            tm.setSimOperatorNameForPhone(getPhoneId(), operatorAlpha);
        }

        // Sets operator numeric property by retrieving from build-time system property
        String operatorNumeric = SystemProperties.get(PROPERTY_CDMA_HOME_OPERATOR_NUMERIC);
        log("update icc_operator_numeric=" + operatorNumeric);
        if (!TextUtils.isEmpty(operatorNumeric)) {
            tm.setSimOperatorNumericForPhone(getPhoneId(), operatorNumeric);

            SubscriptionController.getInstance().setMccMnc(operatorNumeric, getSubId());
            // Sets iso country property by retrieving from build-time system property
            setIsoCountryProperty(operatorNumeric);
            // Updates MCC MNC device configuration information
            log("update mccmnc=" + operatorNumeric);
            MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false);
        }
        // Sets current entry in the telephony carrier table
        updateCurrentCarrierInProvider();
    
public voidsetSystemProperty(java.lang.String property, java.lang.String value)

        if(getUnitTestMode()) {
            return;
        }
        TelephonyManager.setTelephonyProperty(mPhoneId, property, value);
    
public voidunregisterForAllDataDisconnected(android.os.Handler h)

        ((DcTracker)mDcTracker)
                .unregisterForAllDataDisconnected(h);
    
public voidunregisterForSimRecordsLoaded(android.os.Handler h)

        mSimRecordsLoadedRegistrants.remove(h);
    
booleanupdateCurrentCarrierInProvider(java.lang.String operatorNumeric)
Sets the "current" field in the telephony provider according to the build-time operator numeric property

return
true for success; false otherwise.

        boolean retVal;
        if (mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP) == null) {
            if (DBG) log("updateCurrentCarrierInProvider APP_FAM_3GPP == null");
            retVal = super.updateCurrentCarrierInProvider(operatorNumeric);
        } else {
            if (DBG) log("updateCurrentCarrierInProvider not updated");
            retVal = true;
        }
        if (DBG) log("updateCurrentCarrierInProvider X retVal=" + retVal);
        return retVal;
    
public booleanupdateCurrentCarrierInProvider()

        long currentDds = SubscriptionManager.getDefaultDataSubId();
        String operatorNumeric = getOperatorNumeric();

        Rlog.d(LOG_TAG, "updateCurrentCarrierInProvider: mSubscription = " + getSubId()
                + " currentDds = " + currentDds + " operatorNumeric = " + operatorNumeric);

        if (!TextUtils.isEmpty(operatorNumeric) && (getSubId() == currentDds)) {
            try {
                Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
                ContentValues map = new ContentValues();
                map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
                mContext.getContentResolver().insert(uri, map);
                return true;
            } catch (SQLException e) {
                Rlog.e(LOG_TAG, "Can't store current operator", e);
            }
        }
        return false;
    
public voidupdateDataConnectionTracker()

        ((DcTracker)mDcTracker).update();