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

Commit 80915ad5 authored by Shishir Agrawal's avatar Shishir Agrawal
Browse files

Query voice radio tech when the SIMRecords finish loading.

This is required since the overlays may change once the SIMRecords have
finished loading and the overlays help determine the volte radio tech
replacement.

Bug: 18108765
Change-Id: Iebc17fda48cae28abb2e9658c4bb3b7d2ed18e60
parent 36785548
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ public class PhoneProxy extends Handler implements Phone {
    private static final int EVENT_REQUEST_VOICE_RADIO_TECH_DONE = 3;
    private static final int EVENT_RIL_CONNECTED = 4;
    private static final int EVENT_UPDATE_PHONE_OBJECT = 5;
    private static final int EVENT_SIM_RECORDS_LOADED = 6;

    private int mPhoneId = 0;

@@ -144,6 +145,16 @@ public class PhoneProxy extends Handler implements Phone {
            phoneObjectUpdater(msg.arg1);
            break;

        case EVENT_SIM_RECORDS_LOADED:
            // Only check for the voice radio tech if it not going to be updated by the voice
            // registration changes.
            if (!mActivePhone.getContext().getResources().getBoolean(
                    com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change)) {
                mCommandsInterface.getVoiceRadioTechnology(obtainMessage(
                        EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
            }
            break;

        default:
            loge("Error! This handler was not registered for this message type. Message: "
                    + msg.what);
@@ -264,12 +275,12 @@ public class PhoneProxy extends Handler implements Phone {

        if (oldPhone != null) {
            outgoingPhoneName = ((PhoneBase) oldPhone).getPhoneName();
            oldPhone.unregisterForSimRecordsLoaded(this);
        }

        logd("Switching Voice Phone : " + outgoingPhoneName + " >>> "
                + (ServiceState.isGsm(newVoiceRadioTech) ? "GSM" : "CDMA"));


        if (ServiceState.isCdma(newVoiceRadioTech)) {
            mActivePhone = PhoneFactory.getCdmaPhone(mPhoneId);
        } else if (ServiceState.isGsm(newVoiceRadioTech)) {
@@ -289,6 +300,7 @@ public class PhoneProxy extends Handler implements Phone {
            if (imsPhone != null) {
                mActivePhone.acquireOwnershipOfImsPhone(imsPhone);
            }
            mActivePhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
        }

        if (oldPhone != null) {
@@ -1291,6 +1303,9 @@ public class PhoneProxy extends Handler implements Phone {

    @Override
    public void dispose() {
        if (mActivePhone != null) {
            mActivePhone.unregisterForSimRecordsLoaded(this);
        }
        mCommandsInterface.unregisterForOn(this);
        mCommandsInterface.unregisterForVoiceRadioTechChanged(this);
        mCommandsInterface.unregisterForRilConnected(this);
+40 −0
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ public class CDMALTEPhone extends CDMAPhone {
    @Override
    public void dispose() {
        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
            if (mSimRecords != null) {
                mSimRecords.unregisterForRecordsLoaded(this);
            }
            super.dispose();
        }
    }
@@ -118,6 +121,25 @@ public class CDMALTEPhone extends CDMAPhone {
        super.removeReferences();
    }

    @Override
    public void handleMessage(Message msg) {
        AsyncResult ar;
        Message onComplete;

        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);
        }
    }
    @Override
    public PhoneConstants.DataState getDataConnectionState(String apnType) {
        PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;
@@ -239,6 +261,10 @@ public class CDMALTEPhone extends CDMAPhone {

    @Override
    protected void onUpdateIccAvailability() {
        if (mSimRecords != null) {
            mSimRecords.unregisterForRecordsLoaded(this);
        }

        if (mUiccController == null ) {
            return;
        }
@@ -261,6 +287,9 @@ public class CDMALTEPhone extends CDMAPhone {
            newSimRecords = (SIMRecords) newUiccApplication.getIccRecords();
        }
        mSimRecords = newSimRecords;
        if (mSimRecords != null) {
            mSimRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
        }

        super.onUpdateIccAvailability();
    }
@@ -401,6 +430,17 @@ public class CDMALTEPhone extends CDMAPhone {
                .unregisterForAllDataDisconnected(h);
    }

    @Override
    public void registerForSimRecordsLoaded(Handler h, int what, Object obj) {
        mSimRecordsLoadedRegistrants.addUnique(h, what, obj);
    }

    @Override
    public void unregisterForSimRecordsLoaded(Handler h) {
        mSimRecordsLoadedRegistrants.remove(h);
    }


    @Override
    protected void log(String s) {
            Rlog.d(LOG_LTE_TAG, s);
+10 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
    public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
        super(phone, new CellInfoLte());
        mCdmaLtePhone = phone;
        mCdmaLtePhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
        mCellInfoLte = (CellInfoLte) mCellInfo;

        ((CellInfoLte)mCellInfo).setCellSignalStrength(new CellSignalStrengthLte());
@@ -74,6 +75,12 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        if (DBG) log("CdmaLteServiceStateTracker Constructors");
    }

    @Override
    public void dispose() {
        mPhone.unregisterForSimRecordsLoaded(this);
        super.dispose();
    }

    @Override
    public void handleMessage(Message msg) {
        AsyncResult ar;
@@ -114,6 +121,9 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
            // the latest variables.
            pollState();
            break;
        case EVENT_SIM_RECORDS_LOADED:
            updatePhoneObject();
            break;
        case EVENT_ALL_DATA_DISCONNECTED:
            int dds = SubscriptionManager.getDefaultDataSubId();
            ProxyController.getInstance().unregisterForAllDataDisconnected(dds, this);