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

Commit b8d6fafa authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Disable IccCardProxy and enable new code in UiccProfile.

Test: Basic telephony sanity with TMo, VZW, Fi SIMs; telephony unit tests
Bug: 64131518
Change-Id: I03e523bfebf731ad35018583c8ace12fa48ca397
parent 0b485b9d
Loading
Loading
Loading
Loading
+23 −17
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import com.android.internal.telephony.gsm.GsmMmiCode;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccCardProxy;
import com.android.internal.telephony.uicc.IccException;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.IccVmNotSupportedException;
@@ -88,6 +87,7 @@ import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccProfile;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -184,7 +184,6 @@ public class GsmCdmaPhone extends Phone {
    }

    private IccSmsInterfaceManager mIccSmsInterfaceManager;
    private IccCardProxy mIccCardProxy;

    private boolean mResetModemOnRadioTechnologyChange = false;

@@ -243,7 +242,6 @@ public class GsmCdmaPhone extends Phone {
                = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
        mIccSmsInterfaceManager = mTelephonyComponentFactory.makeIccSmsInterfaceManager(this);
        mIccCardProxy = mTelephonyComponentFactory.makeIccCardProxy(mContext, mCi, mPhoneId);

        mCi.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
        mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
@@ -287,10 +285,13 @@ public class GsmCdmaPhone extends Phone {
        logd("Precise phone type " + mPrecisePhoneType);

        TelephonyManager tm = TelephonyManager.from(mContext);
        UiccProfile uiccProfile = getUiccProfile();
        if (isPhoneTypeGsm()) {
            mCi.setPhoneType(PhoneConstants.PHONE_TYPE_GSM);
            tm.setPhoneType(getPhoneId(), PhoneConstants.PHONE_TYPE_GSM);
            mIccCardProxy.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
            if (uiccProfile != null) {
                uiccProfile.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
            }
        } else {
            mCdmaSubscriptionSource = mCdmaSSM.getCdmaSubscriptionSource();
            // This is needed to handle phone process crashes
@@ -303,7 +304,9 @@ public class GsmCdmaPhone extends Phone {

            mCi.setPhoneType(PhoneConstants.PHONE_TYPE_CDMA);
            tm.setPhoneType(getPhoneId(), PhoneConstants.PHONE_TYPE_CDMA);
            mIccCardProxy.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
            if (uiccProfile != null) {
                uiccProfile.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
            }
            // Sets operator properties by retrieving from build-time system property
            String operatorAlpha = SystemProperties.get("ro.cdma.home.operator.alpha");
            String operatorNumeric = SystemProperties.get(PROPERTY_CDMA_HOME_OPERATOR_NUMERIC);
@@ -2503,6 +2506,9 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    // todo: check if ICC availability needs to be handled here. mSimRecords should not be needed
    // now because APIs can be called directly on UiccProfile, and that should handle the requests
    // correctly based on supported apps, voice RAT, etc.
    @Override
    protected void onUpdateIccAvailability() {
        if (mUiccController == null ) {
@@ -3269,8 +3275,11 @@ public class GsmCdmaPhone extends Phone {
            mCi.setRadioPower(oldPowerState, null);
        }

        // update voice radio tech in icc card proxy
        mIccCardProxy.setVoiceRadioTech(newVoiceRadioTech);
        // update voice radio tech in UiccProfile
        UiccProfile uiccProfile = getUiccProfile();
        if (uiccProfile != null) {
            uiccProfile.setVoiceRadioTech(newVoiceRadioTech);
        }

        // Send an Intent to the PhoneApp that we had a radio technology change
        Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
@@ -3321,12 +3330,17 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public boolean getIccRecordsLoaded() {
        return mIccCardProxy.getIccRecordsLoaded();
        UiccProfile uiccProfile = getUiccProfile();
        return uiccProfile != null && uiccProfile.getIccRecordsLoaded();
    }

    @Override
    public IccCard getIccCard() {
        return mIccCardProxy;
        return UiccController.getInstance().getUiccProfileForPhone(mPhoneId);
    }

    private UiccProfile getUiccProfile() {
        return UiccController.getInstance().getUiccProfileForPhone(mPhoneId);
    }

    @Override
@@ -3358,14 +3372,6 @@ public class GsmCdmaPhone extends Phone {
        pw.println(" isCspPlmnEnabled()=" + isCspPlmnEnabled());
        pw.flush();
        pw.println("++++++++++++++++++++++++++++++++");

        try {
            mIccCardProxy.dump(fd, pw, args);
        } catch (Exception e) {
            e.printStackTrace();
        }
        pw.flush();
        pw.println("++++++++++++++++++++++++++++++++");
        pw.println("DeviceStateMonitor:");
        mDeviceStateMonitor.dump(fd, pw, args);
        pw.println("++++++++++++++++++++++++++++++++");
+1 −13
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.os.Message;

import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.uicc.IccCardApplicationStatus;
import com.android.internal.telephony.uicc.IccFileHandler;
import com.android.internal.telephony.uicc.IccRecords;

/**
@@ -44,16 +43,12 @@ public interface IccCard {
     */
    public State getState();

    // todo: delete
    /**
     * @return IccRecords object belonging to current UiccCardApplication
     */
    public IccRecords getIccRecords();

    /**
     * @return IccFileHandler object belonging to current UiccCardApplication
     */
    public IccFileHandler getIccFileHandler();

    /**
     * Notifies handler of any transition into IccCardConstants.State.NETWORK_LOCKED
     */
@@ -95,13 +90,6 @@ public interface IccCard {
     */
    public void supplyPuk2 (String puk2, String newPin2, Message onComplete);

    /**
     * Check whether fdn (fixed dialing number) service is available.
     * @return true if ICC fdn service available
     *         false if ICC fdn service not available
    */
    public boolean getIccFdnAvailable();

    /**
     * Supply Network depersonalization code to the RIL
     */
+2 −2
Original line number Diff line number Diff line
@@ -42,8 +42,8 @@ import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneFactory;
import com.android.internal.telephony.sip.SipPhone;
import com.android.internal.telephony.sip.SipPhoneFactory;
import com.android.internal.telephony.uicc.IccCardProxy;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.util.NotificationChannelController;
import com.android.internal.util.IndentingPrintWriter;

@@ -435,7 +435,7 @@ public class PhoneFactory {
            pw.println("++++++++++++++++++++++++++++++++");

            try {
                ((IccCardProxy)phone.getIccCard()).dump(fd, pw, args);
                ((UiccProfile) phone.getIccCard()).dump(fd, pw, args);
            } catch (Exception e) {
                e.printStackTrace();
            }
+4 −5
Original line number Diff line number Diff line
@@ -51,9 +51,9 @@ import android.text.TextUtils;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.euicc.EuiccController;
import com.android.internal.telephony.uicc.IccCardProxy;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.UiccProfile;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -131,8 +131,7 @@ public class SubscriptionInfoUpdater extends Handler {
        mEuiccManager = (EuiccManager) mContext.getSystemService(Context.EUICC_SERVICE);
        mPackageManager = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));

        IntentFilter intentFilter = new IntentFilter(
                IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED);
        IntentFilter intentFilter = new IntentFilter(UiccProfile.ACTION_INTERNAL_SIM_STATE_CHANGED);
        mContext.registerReceiver(sReceiver, intentFilter);

        mCarrierServiceBindHelper = new CarrierServiceBindHelper(mContext);
@@ -179,7 +178,7 @@ public class SubscriptionInfoUpdater extends Handler {
            String action = intent.getAction();
            logd("Action: " + action);

            if (!action.equals(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED)) {
            if (!action.equals(UiccProfile.ACTION_INTERNAL_SIM_STATE_CHANGED)) {
                return;
            }

@@ -194,7 +193,7 @@ public class SubscriptionInfoUpdater extends Handler {
            String simStatus = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
            logd("simStatus: " + simStatus);

            if (action.equals(IccCardProxy.ACTION_INTERNAL_SIM_STATE_CHANGED)) {
            if (action.equals(UiccProfile.ACTION_INTERNAL_SIM_STATE_CHANGED)) {
                if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus)) {
                    sendMessage(obtainMessage(EVENT_SIM_ABSENT, slotIndex, -1));
                } else if (IccCardConstants.INTENT_VALUE_ICC_UNKNOWN.equals(simStatus)) {
+11 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
import com.android.internal.telephony.uicc.IccCardProxy;
import com.android.internal.telephony.uicc.IccCardStatus;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccProfile;

/**
 * This class has one-line methods to instantiate objects only. The purpose is to make code
@@ -107,6 +110,14 @@ public class TelephonyComponentFactory {
        return new IccCardProxy(context, ci, phoneId);
    }

    /**
     * Create a new UiccProfile object.
     */
    public UiccProfile makeUiccProfile(Context context, CommandsInterface ci, IccCardStatus ics,
                                       int phoneId, UiccCard uiccCard) {
        return new UiccProfile(context, ci, ics, phoneId, uiccCard);
    }

    public EriManager makeEriManager(Phone phone, Context context, int eriFileSource) {
        return new EriManager(phone, context, eriFileSource);
    }
Loading