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

Commit 0f767978 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Revert "Telephony: update property in IccCardProxy""

parents 3a4d081e 1fb2684d
Loading
Loading
Loading
Loading
+1 −29
Original line number Original line Diff line number Diff line
@@ -34,7 +34,6 @@ import android.telephony.TelephonyManager;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyIntents;
@@ -47,9 +46,7 @@ import com.android.internal.telephony.uicc.IccCardStatus.CardState;
import com.android.internal.telephony.uicc.IccCardStatus.PinState;
import com.android.internal.telephony.uicc.IccCardStatus.PinState;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.RuimRecords;
import com.android.internal.telephony.uicc.RuimRecords;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;

import static com.android.internal.telephony.TelephonyProperties.PROPERTY_APN_SIM_OPERATOR_NUMERIC;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;


@@ -255,7 +252,6 @@ public class IccCardProxy extends Handler implements IccCard {
                setExternalState(State.READY);
                setExternalState(State.READY);
                break;
                break;
            case EVENT_RECORDS_LOADED:
            case EVENT_RECORDS_LOADED:
                updateproperty();
                broadcastIccStateChangedIntent(IccCardConstants.INTENT_VALUE_ICC_LOADED, null);
                broadcastIccStateChangedIntent(IccCardConstants.INTENT_VALUE_ICC_LOADED, null);
                break;
                break;
            case EVENT_IMSI_READY:
            case EVENT_IMSI_READY:
@@ -296,7 +292,6 @@ public class IccCardProxy extends Handler implements IccCard {
                mUiccCard = newCard;
                mUiccCard = newCard;
                mUiccApplication = newApp;
                mUiccApplication = newApp;
                mIccRecords = newRecords;
                mIccRecords = newRecords;
                updateproperty();
                registerUiccCardEvents();
                registerUiccCardEvents();
                updateActiveRecord();
                updateActiveRecord();
            }
            }
@@ -305,29 +300,6 @@ public class IccCardProxy extends Handler implements IccCard {
        }
        }
    }
    }


    /**
     * Multimode card will load multi sim records,  the later one will overwrite the property set
     * before, so better to set property after get EVENT_RECORDS_LOADED event, and new
     * IccRecords is available. Or else in some cards the operator numeric is updated wrongly.
     */
    protected void updateproperty(){
        if (mIccRecords == null) {
            log("updateproperty null mIccRecords");
        } else {
            String operator = mIccRecords.getOperatorNumeric();
            if (operator != null && mIccRecords.getRecordsLoaded()) {
                log("updateproperty operator =" + operator);
                String countryCode = operator.substring(0,3);
                SystemProperties.set(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
                        MccTable.countryCodeForMcc(Integer.parseInt(countryCode)));
                SystemProperties.set(PROPERTY_APN_SIM_OPERATOR_NUMERIC, operator);
                SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
            } else {
                loge("updateproperty Operator name = " + operator + ", loaded = "
                        + mIccRecords.getRecordsLoaded());
            }
        }
    }
    protected void HandleDetectedState() {
    protected void HandleDetectedState() {
        setExternalState(State.UNKNOWN);
        setExternalState(State.UNKNOWN);
    }
    }
+19 −0
Original line number Original line Diff line number Diff line
@@ -647,6 +647,25 @@ public final class RuimRecords extends IccRecords {
    protected void onAllRecordsLoaded() {
    protected void onAllRecordsLoaded() {
        if (DBG) log("record load complete");
        if (DBG) log("record load complete");


        // Further records that can be inserted are Operator/OEM dependent

        String operator = getOperatorNumeric();
        if (!TextUtils.isEmpty(operator)) {
            log("onAllRecordsLoaded set 'gsm.sim.operator.numeric' to operator='" +
                    operator + "'");
            setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
        } else {
            log("onAllRecordsLoaded empty 'gsm.sim.operator.numeric' skipping");
        }

        if (!TextUtils.isEmpty(mImsi)) {
            log("onAllRecordsLoaded set mcc imsi=" + mImsi);
            setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
                    MccTable.countryCodeForMcc(Integer.parseInt(mImsi.substring(0,3))));
        } else {
            log("onAllRecordsLoaded empty imsi skipping setting mcc");
        }

        setLocaleFromCsim();
        setLocaleFromCsim();
        mRecordsLoadedRegistrants.notifyRegistrants(
        mRecordsLoadedRegistrants.notifyRegistrants(
            new AsyncResult(null, null, null));
            new AsyncResult(null, null, null));
+17 −0
Original line number Original line Diff line number Diff line
@@ -1317,6 +1317,23 @@ public class SIMRecords extends IccRecords {
        // Some fields require more than one SIM record to set
        // Some fields require more than one SIM record to set


        String operator = getOperatorNumeric();
        String operator = getOperatorNumeric();
        if (!TextUtils.isEmpty(operator)) {
            log("onAllRecordsLoaded set 'gsm.sim.operator.numeric' to operator='" +
                    operator + "'");
            setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
            setSystemProperty(PROPERTY_APN_SIM_OPERATOR_NUMERIC, operator);
        } else {
            log("onAllRecordsLoaded empty 'gsm.sim.operator.numeric' skipping");
        }

        if (!TextUtils.isEmpty(mImsi)) {
            log("onAllRecordsLoaded set mcc imsi=" + mImsi);
            setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
                    MccTable.countryCodeForMcc(Integer.parseInt(mImsi.substring(0,3))));
        } else {
            log("onAllRecordsLoaded empty imsi skipping setting mcc");
        }

        setVoiceMailByCountry(operator);
        setVoiceMailByCountry(operator);
        setSpnFromConfig(operator);
        setSpnFromConfig(operator);