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

Commit 446969a9 authored by Shishir Agrawal's avatar Shishir Agrawal Committed by Android Git Automerger
Browse files

am 062a2a38: Make UICC code subID-less.

* commit '062a2a38':
  Make UICC code subID-less.
parents 887d7c45 062a2a38
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1051,10 +1051,10 @@ public class IccSmsInterfaceManager {

    private void enforceCarrierPrivilege() {
        UiccController controller = UiccController.getInstance();
        if (controller == null || controller.getUiccCard() == null) {
        if (controller == null || controller.getUiccCard(mPhone.getPhoneId()) == null) {
            throw new SecurityException("No Carrier Privilege: No UICC");
        }
        if (controller.getUiccCard().getCarrierPrivilegeStatusForCurrentTransaction(
        if (controller.getUiccCard(mPhone.getPhoneId()).getCarrierPrivilegeStatusForCurrentTransaction(
                mContext.getPackageManager()) !=
                    TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
            throw new SecurityException("No Carrier Privilege.");
+1 −1
Original line number Diff line number Diff line
@@ -750,7 +750,7 @@ public abstract class InboundSmsHandler extends StateMachine {
        }

        List<String> carrierPackages = null;
        UiccCard card = UiccController.getInstance().getUiccCard();
        UiccCard card = UiccController.getInstance().getUiccCard(mPhone.getPhoneId());
        if (card != null) {
            carrierPackages = card.getCarrierPackageNamesForIntent(
                    mContext.getPackageManager(),
+1 −1
Original line number Diff line number Diff line
@@ -1729,7 +1729,7 @@ public abstract class SMSDispatcher extends Handler {
    }

    protected String getCarrierAppPackageName() {
        UiccCard card = UiccController.getInstance().getUiccCard();
        UiccCard card = UiccController.getInstance().getUiccCard(mPhone.getPhoneId());
        if (card == null) {
            return null;
        }
+6 −28
Original line number Diff line number Diff line
@@ -257,38 +257,12 @@ public abstract class ServiceStateTracker extends Handler {

                    mPhoneBase.notifyCallForwardingIndicator();

                    //store OperatorNumeric in case subId is not valid when EVENT_RECORDS_LOADED issued
                    int phoneId = mPhoneBase.getPhoneId();
                    PhoneProxy[] phoneProxys = (PhoneProxy[]) PhoneFactory.getPhones();
                    if(phoneProxys != null && phoneProxys.length > phoneId) {
                        PhoneProxy phoneProxy = phoneProxys[phoneId];
                        if(phoneProxy != null) {
                            IccCardProxy iccCardProxy = phoneProxy.getPhoneIccCardProxy();
                            if(iccCardProxy != null) {
                                iccCardProxy.saveOperatorNumeric();
                                // store alpha
                                if(iccCardProxy.getIccRecord() != null) {
                                    TelephonyManager.setTelephonyProperty(phoneId,
                                            PROPERTY_ICC_OPERATOR_ALPHA,
                                            iccCardProxy.getIccRecord().getServiceProviderName());
                                } else {
                                    Log.e(LOG_TAG,"IccRecord is null");
                                }
                            } else {
                                Log.e(LOG_TAG,"iccCardProxy is null");
                            }
                        } else {
                            Log.e(LOG_TAG, "Null phoneProxy");
                        }
                    } else {
                        Log.e(LOG_TAG, "invalid phoneProxy[] or PhoneId" + phoneId);
                    }
                    mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
                        ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology()));

                    if (mSpnUpdatePending) {
                        mSubscriptionController.setPlmnSpn(phoneId, mCurShowPlmn, mCurPlmn,
                                mCurShowSpn, mCurSpn);
                        mSubscriptionController.setPlmnSpn(mPhoneBase.getPhoneId(), mCurShowPlmn,
                                mCurPlmn, mCurShowSpn, mCurSpn);
                        mSpnUpdatePending = false;
                    }
                }
@@ -1048,4 +1022,8 @@ public abstract class ServiceStateTracker extends Handler {
    protected String getHomeOperatorNumeric() {
        return SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
    }

    protected int getPhoneId() {
        return mPhoneBase.getPhoneId();
    }
}
+27 −18
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ public class SubscriptionInfoUpdater extends Handler {
                return;
            }

            int slotId = intent.getIntExtra(PhoneConstants.SLOT_KEY,
            int slotId = intent.getIntExtra(PhoneConstants.PHONE_KEY,
                    SubscriptionManager.INVALID_SIM_SLOT_INDEX);
            logd("slotId: " + slotId);
            if (slotId == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
@@ -139,9 +139,7 @@ public class SubscriptionInfoUpdater extends Handler {
                        IccCardConstants.INTENT_KEY_LOCKED_REASON);
                    sendMessage(obtainMessage(EVENT_SIM_LOCKED, slotId, -1, reason));
                } else if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(simStatus)) {
                    int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
                            SubscriptionManager.INVALID_SUBSCRIPTION_ID);
                    sendMessage(obtainMessage(EVENT_SIM_LOADED, slotId, subId));
                    sendMessage(obtainMessage(EVENT_SIM_LOADED, slotId, -1));
                } else {
                    logd("Ignoring simStatus: " + simStatus);
                }
@@ -228,7 +226,7 @@ public class SubscriptionInfoUpdater extends Handler {
            }

           case EVENT_SIM_LOADED:
                handleSimLoaded(msg.arg1, msg.arg2);
                handleSimLoaded(msg.arg1);
                break;

            case EVENT_SIM_ABSENT:
@@ -279,8 +277,8 @@ public class SubscriptionInfoUpdater extends Handler {
        }
    }

    private void handleSimLoaded(int slotId, int subId) {
        logd("handleSimStateLoadedInternal: slotId: " + slotId + " subId: " + subId);
    private void handleSimLoaded(int slotId) {
        logd("handleSimStateLoadedInternal: slotId: " + slotId);

        // The SIM should be loaded at this state, but it is possible in cases such as SIM being
        // removed or a refresh RESET that the IccRecords could be null. The right behavior is to
@@ -300,9 +298,24 @@ public class SubscriptionInfoUpdater extends Handler {
            updateSubscriptionInfoByIccId();
        }

        int subId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
        int[] subIds = SubscriptionController.getInstance().getSubId(slotId);
        if (subIds != null) {   // Why an array?
            subId = subIds[0];
        }

        if (SubscriptionManager.isValidSubscriptionId(subId)) {
            String msisdn = TelephonyManager.getDefault()
                    .getLine1NumberForSubscriber(subId);
            String operator = records.getOperatorNumeric();
            if (operator != null) {
                if (subId == SubscriptionController.getInstance().getDefaultSubId()) {
                    MccTable.updateMccMncConfiguration(mContext, operator, false);
                }
                SubscriptionController.getInstance().setMccMnc(operator,subId);
            } else {
                logd("EVENT_RECORDS_LOADED Operator name is null");
            }

            String msisdn = TelephonyManager.getDefault().getLine1NumberForSubscriber(subId);
            ContentResolver contentResolver = mContext.getContentResolver();

            if (msisdn != null) {
@@ -313,18 +326,14 @@ public class SubscriptionInfoUpdater extends Handler {
                        + Long.toString(subId), null);
            }

            SubscriptionInfo subInfo =
                    mSubscriptionManager.getActiveSubscriptionInfo(subId);
            SubscriptionInfo subInfo = mSubscriptionManager.getActiveSubscriptionInfo(subId);
            String nameToSet;
            String CarrierName =
                    TelephonyManager.getDefault().getSimOperator(subId);
            String CarrierName = TelephonyManager.getDefault().getSimOperator(subId);
            logd("CarrierName = " + CarrierName);
            String simCarrierName =
                    TelephonyManager.getDefault().getSimOperatorName(subId);
            String simCarrierName = TelephonyManager.getDefault().getSimOperatorName(subId);
            ContentValues name = new ContentValues(1);

            if (subInfo != null
                    && subInfo.getNameSource() !=
            if (subInfo != null && subInfo.getNameSource() !=
                    SubscriptionManager.NAME_SOURCE_USER_INPUT) {
                if (!TextUtils.isEmpty(simCarrierName)) {
                    nameToSet = simCarrierName;
@@ -354,7 +363,7 @@ public class SubscriptionInfoUpdater extends Handler {
                // Set the modem network mode
                mPhone[slotId].setPreferredNetworkType(networkType, null);
                Settings.Global.putInt(mPhone[slotId].getContext().getContentResolver(),
                        Settings.Global.PREFERRED_NETWORK_MODE + mPhone[slotId].getSubId(),
                        Settings.Global.PREFERRED_NETWORK_MODE + subId,
                        networkType);

                // Only support automatic selection mode on SIM change.
Loading