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

Commit 91e062f3 authored by Tom Taylor's avatar Tom Taylor Committed by Android (Google) Code Review
Browse files

Merge "Save mcc/mnc in SubInfoRecord" into lmp-dev

parents 2852a88a ab57aa5d
Loading
Loading
Loading
Loading
+37 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.telephony.Rlog;
@@ -226,9 +227,14 @@ public class SubscriptionController extends ISub.Stub {
                info.mSimIconRes[RES_TYPE_BACKGROUND_DARK] = sSimBackgroundDarkRes[info.mColor];
                info.mSimIconRes[RES_TYPE_BACKGROUND_LIGHT] = sSimBackgroundLightRes[info.mColor];
            }
            logd("[getSubInfoRecord] SubId:" + info.mSubId + " iccid:" + info.mIccId + " slotId:"
                    + info.mSlotId + " displayName:" + info.mDisplayName + " color:"
                    + info.mColor);
            info.mMcc = cursor.getInt(cursor.getColumnIndexOrThrow(
                    SubscriptionManager.MCC));
            info.mMnc = cursor.getInt(cursor.getColumnIndexOrThrow(
                    SubscriptionManager.MNC));

            logd("[getSubInfoRecord] SubId:" + info.mSubId + " iccid:" + info.mIccId + " slotId:" +
                    info.mSlotId + " displayName:" + info.mDisplayName + " color:" + info.mColor +
                    " mcc/mnc:" + info.mMcc + "/" + info.mMnc);

            return info;
    }
@@ -769,6 +775,34 @@ public class SubscriptionController extends ISub.Stub {
        return result;
    }

    /**
     * Set MCC/MNC by subscription ID
     * @param mccMnc MCC/MNC associated with the subscription
     * @param subId the unique SubInfoRecord index in database
     * @return the number of records updated
     */
    public int setMccMnc(String mccMnc, long subId) {
        int mcc = 0;
        int mnc = 0;
        try {
            mcc = Integer.parseInt(mccMnc.substring(0,3));
            mnc = Integer.parseInt(mccMnc.substring(3));
        } catch (NumberFormatException e) {
            logd("[setMccMnc] - couldn't parse mcc/mnc: " + mccMnc);
        }
        logd("[setMccMnc]+ mcc/mnc:" + mcc + "/" + mnc + " subId:" + subId);
        ContentValues value = new ContentValues(2);
        value.put(SubscriptionManager.MCC, mcc);
        value.put(SubscriptionManager.MNC, mnc);

        int result = mContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value,
                BaseColumns._ID + "=" + Long.toString(subId), null);
        broadcastSimInfoContentChanged(subId, SubscriptionManager.MCC, mcc, null);

        return result;
    }


    @Override
    public int getSlotId(long subId) {
        if (subId == SubscriptionManager.DEFAULT_SUB_ID) {
+5 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.Rlog;

import com.android.internal.telephony.CommandsInterface;

import android.telephony.TelephonyManager;

import com.android.internal.telephony.dataconnection.DcTracker;
@@ -49,6 +50,7 @@ import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.SMSDispatcher;
import com.android.internal.telephony.SmsBroadcastUndelivered;
import com.android.internal.telephony.Subscription;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.gsm.GsmSMSDispatcher;
import com.android.internal.telephony.gsm.SmsMessage;
import com.android.internal.telephony.uicc.IccRecords;
@@ -68,7 +70,6 @@ import java.io.PrintWriter;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;

import static com.android.internal.telephony.PhoneConstants.EVENT_SUBSCRIPTION_ACTIVATED;
import static com.android.internal.telephony.PhoneConstants.EVENT_SUBSCRIPTION_DEACTIVATED;

@@ -363,6 +364,8 @@ public class CDMALTEPhone extends CDMAPhone {
        log("update icc_operator_numeric=" + operatorNumeric);
        if (!TextUtils.isEmpty(operatorNumeric)) {
            setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, 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
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.android.internal.telephony.PhoneNotifier;
import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.PhoneSubInfo;
import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.UUSInfo;
@@ -221,6 +222,8 @@ public class CDMAPhone extends PhoneBase {
                log("init: set 'gsm.sim.operator.numeric' to operator='" + operatorNumeric + "'");
                log("update icc_operator_numeric=" + operatorNumeric);
                setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operatorNumeric);

                SubscriptionController.getInstance().setMccMnc(operatorNumeric, getSubId());
            }
            setIsoCountryProperty(operatorNumeric);
        }
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony.uicc;

import static android.Manifest.permission.READ_PHONE_STATE;

import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.Intent;
@@ -277,6 +278,7 @@ public class IccCardProxy extends Handler implements IccCard {
                            log("update mccmnc=" + operator + " config for default subscription.");
                            MccTable.updateMccMncConfiguration(mContext, operator, false);
                        }
                        SubscriptionController.getInstance().setMccMnc(operator, subId[0]);
                    } else {
                        loge("EVENT_RECORDS_LOADED Operator name is null");
                    }