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

Commit 4430e317 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Pass the SubscriptionController instance from PhoneFactory" am: 6ecb63f1

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1131036

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2a720b9d002cfd16e777c7b8604fe304c76908a6
parents 795afd85 6ecb63f1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -221,7 +221,7 @@ public class PhoneFactory {
                sSubInfoRecordUpdater = TelephonyComponentFactory.getInstance().inject(
                sSubInfoRecordUpdater = TelephonyComponentFactory.getInstance().inject(
                        SubscriptionInfoUpdater.class.getName()).
                        SubscriptionInfoUpdater.class.getName()).
                        makeSubscriptionInfoUpdater(pfhandlerThread.
                        makeSubscriptionInfoUpdater(pfhandlerThread.
                        getLooper(), context, sCommandsInterfaces);
                        getLooper(), context, SubscriptionController.getInstance());


                // Only bring up IMS if the device supports having an IMS stack.
                // Only bring up IMS if the device supports having an IMS stack.
                if (context.getPackageManager().hasSystemFeature(
                if (context.getPackageManager().hasSystemFeature(
+42 −62
Original line number Original line Diff line number Diff line
@@ -108,6 +108,7 @@ public class SubscriptionInfoUpdater extends Handler {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)


    protected static String[] sIccId = new String[SUPPORTED_MODEM_COUNT];
    protected static String[] sIccId = new String[SUPPORTED_MODEM_COUNT];
    protected SubscriptionController mSubscriptionController = null;
    private static String[] sInactiveIccIds = new String[SUPPORTED_MODEM_COUNT];
    private static String[] sInactiveIccIds = new String[SUPPORTED_MODEM_COUNT];
    private static int[] sSimCardState = new int[SUPPORTED_MODEM_COUNT];
    private static int[] sSimCardState = new int[SUPPORTED_MODEM_COUNT];
    private static int[] sSimApplicationState = new int[SUPPORTED_MODEM_COUNT];
    private static int[] sSimApplicationState = new int[SUPPORTED_MODEM_COUNT];
@@ -134,14 +135,13 @@ public class SubscriptionInfoUpdater extends Handler {
        void run(boolean hasChanges);
        void run(boolean hasChanges);
    }
    }


    // TODO: The SubscriptionController instance should be passed in here from PhoneFactory
    @VisibleForTesting
    // rather than invoking the static getter all over the place.
    public SubscriptionInfoUpdater(Looper looper, Context context, SubscriptionController sc) {
    @VisibleForTesting public SubscriptionInfoUpdater(Looper looper, Context context,
            CommandsInterface[] ci) {
        logd("Constructor invoked");
        logd("Constructor invoked");
        mBackgroundHandler = new Handler(looper);
        mBackgroundHandler = new Handler(looper);


        sContext = context;
        sContext = context;
        mSubscriptionController = sc;
        mSubscriptionManager = SubscriptionManager.from(sContext);
        mSubscriptionManager = SubscriptionManager.from(sContext);
        mEuiccManager = (EuiccManager) sContext.getSystemService(Context.EUICC_SERVICE);
        mEuiccManager = (EuiccManager) sContext.getSystemService(Context.EUICC_SERVICE);


@@ -308,7 +308,7 @@ public class SubscriptionInfoUpdater extends Handler {
                cardIds.add(getCardIdFromPhoneId(msg.arg1));
                cardIds.add(getCardIdFromPhoneId(msg.arg1));
                updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
                updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
                    if (hasChanges) {
                    if (hasChanges) {
                        SubscriptionController.getInstance().notifySubscriptionInfoChanged();
                        mSubscriptionController.notifySubscriptionInfoChanged();
                    }
                    }
                });
                });
                handleSimNotReady(msg.arg1);
                handleSimNotReady(msg.arg1);
@@ -319,7 +319,7 @@ public class SubscriptionInfoUpdater extends Handler {
                Runnable r = (Runnable) msg.obj;
                Runnable r = (Runnable) msg.obj;
                updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
                updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
                    if (hasChanges) {
                    if (hasChanges) {
                        SubscriptionController.getInstance().notifySubscriptionInfoChanged();
                        mSubscriptionController.notifySubscriptionInfoChanged();
                    }
                    }
                    if (r != null) {
                    if (r != null) {
                        r.run();
                        r.run();
@@ -414,7 +414,7 @@ public class SubscriptionInfoUpdater extends Handler {
        cardIds.add(getCardIdFromPhoneId(phoneId));
        cardIds.add(getCardIdFromPhoneId(phoneId));
        updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
        updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
            if (hasChanges) {
            if (hasChanges) {
            SubscriptionController.getInstance().notifySubscriptionInfoChanged();
                mSubscriptionController.notifySubscriptionInfoChanged();
            }
            }
        });
        });
        broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null);
        broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null);
@@ -459,8 +459,9 @@ public class SubscriptionInfoUpdater extends Handler {
        // handleSimNotReady so this will be evaluated again.
        // handleSimNotReady so this will be evaluated again.
        UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(phoneId);
        UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(phoneId);
        if (slot == null || slot.getIccId() == null) return false;
        if (slot == null || slot.getIccId() == null) return false;
        SubscriptionInfo info = SubscriptionController.getInstance()
        SubscriptionInfo info =
                .getSubInfoForIccId(IccUtils.stripTrailingFs(slot.getIccId()));
                mSubscriptionController.getSubInfoForIccId(
                        IccUtils.stripTrailingFs(slot.getIccId()));
        return info != null && !info.areUiccApplicationsEnabled();
        return info != null && !info.areUiccApplicationsEnabled();
    }
    }


@@ -487,8 +488,8 @@ public class SubscriptionInfoUpdater extends Handler {
        sIccId[phoneId] = IccUtils.stripTrailingFs(records.getFullIccId());
        sIccId[phoneId] = IccUtils.stripTrailingFs(records.getFullIccId());


        updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */);
        updateSubscriptionInfoByIccId(phoneId, true /* updateEmbeddedSubs */);
        List<SubscriptionInfo> subscriptionInfos = SubscriptionController.getInstance()
        List<SubscriptionInfo> subscriptionInfos =
                .getSubInfoUsingSlotIndexPrivileged(phoneId);
                mSubscriptionController.getSubInfoUsingSlotIndexPrivileged(phoneId);
        if (subscriptionInfos == null || subscriptionInfos.isEmpty()) {
        if (subscriptionInfos == null || subscriptionInfos.isEmpty()) {
            loge("empty subinfo for phoneId: " + phoneId + "could not update ContentResolver");
            loge("empty subinfo for phoneId: " + phoneId + "could not update ContentResolver");
        } else {
        } else {
@@ -499,10 +500,10 @@ public class SubscriptionInfoUpdater extends Handler {
                String operator = tm.getSimOperatorNumeric(subId);
                String operator = tm.getSimOperatorNumeric(subId);


                if (!TextUtils.isEmpty(operator)) {
                if (!TextUtils.isEmpty(operator)) {
                    if (subId == SubscriptionController.getInstance().getDefaultSubId()) {
                    if (subId == mSubscriptionController.getDefaultSubId()) {
                        MccTable.updateMccMncConfiguration(sContext, operator);
                        MccTable.updateMccMncConfiguration(sContext, operator);
                    }
                    }
                    SubscriptionController.getInstance().setMccMnc(operator, subId);
                    mSubscriptionController.setMccMnc(operator, subId);
                } else {
                } else {
                    logd("EVENT_RECORDS_LOADED Operator name is null");
                    logd("EVENT_RECORDS_LOADED Operator name is null");
                }
                }
@@ -510,25 +511,25 @@ public class SubscriptionInfoUpdater extends Handler {
                String iso = tm.getSimCountryIsoForPhone(phoneId);
                String iso = tm.getSimCountryIsoForPhone(phoneId);


                if (!TextUtils.isEmpty(iso)) {
                if (!TextUtils.isEmpty(iso)) {
                    SubscriptionController.getInstance().setCountryIso(iso, subId);
                    mSubscriptionController.setCountryIso(iso, subId);
                } else {
                } else {
                    logd("EVENT_RECORDS_LOADED sim country iso is null");
                    logd("EVENT_RECORDS_LOADED sim country iso is null");
                }
                }


                String msisdn = tm.getLine1Number(subId);
                String msisdn = tm.getLine1Number(subId);
                if (msisdn != null) {
                if (msisdn != null) {
                    SubscriptionController.getInstance().setDisplayNumber(msisdn, subId);
                    mSubscriptionController.setDisplayNumber(msisdn, subId);
                }
                }


                String imsi = tm.createForSubscriptionId(subId).getSubscriberId();
                String imsi = tm.createForSubscriptionId(subId).getSubscriberId();
                if (imsi != null) {
                if (imsi != null) {
                    SubscriptionController.getInstance().setImsi(imsi, subId);
                    mSubscriptionController.setImsi(imsi, subId);
                }
                }


                String[] ehplmns = records.getEhplmns();
                String[] ehplmns = records.getEhplmns();
                String[] hplmns = records.getPlmnsFromHplmnActRecord();
                String[] hplmns = records.getPlmnsFromHplmnActRecord();
                if (ehplmns != null || hplmns != null) {
                if (ehplmns != null || hplmns != null) {
                    SubscriptionController.getInstance().setAssociatedPlmns(ehplmns, hplmns, subId);
                    mSubscriptionController.setAssociatedPlmns(ehplmns, hplmns, subId);
                }
                }


                /* Update preferred network type and network selection mode on SIM change.
                /* Update preferred network type and network selection mode on SIM change.
@@ -620,8 +621,8 @@ public class SubscriptionInfoUpdater extends Handler {
        if (!TextUtils.isEmpty(iccId)) {
        if (!TextUtils.isEmpty(iccId)) {
            // If iccId is new, add a subscription record in the db.
            // If iccId is new, add a subscription record in the db.
            String strippedIccId = IccUtils.stripTrailingFs(iccId);
            String strippedIccId = IccUtils.stripTrailingFs(iccId);
            if (SubscriptionController.getInstance().getSubInfoForIccId(strippedIccId) == null) {
            if (mSubscriptionController.getSubInfoForIccId(strippedIccId) == null) {
                SubscriptionController.getInstance().insertEmptySubInfoRecord(
                mSubscriptionController.insertEmptySubInfoRecord(
                        strippedIccId, "CARD", SubscriptionManager.INVALID_PHONE_INDEX,
                        strippedIccId, "CARD", SubscriptionManager.INVALID_PHONE_INDEX,
                        SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
                        SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
            }
            }
@@ -707,7 +708,7 @@ public class SubscriptionInfoUpdater extends Handler {
        // Clear phoneId only when sim absent is not enough. It's possible to switch SIM profile
        // Clear phoneId only when sim absent is not enough. It's possible to switch SIM profile
        // within the same slot. Need to clear the slot index of the previous sub. Thus always clear
        // within the same slot. Need to clear the slot index of the previous sub. Thus always clear
        // for the changing slot first.
        // for the changing slot first.
        SubscriptionController.getInstance().clearSubInfoRecord(phoneId);
        mSubscriptionController.clearSubInfoRecord(phoneId);


        // If SIM is not absent, insert new record or update existing record.
        // If SIM is not absent, insert new record or update existing record.
        if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId])) {
        if (!ICCID_STRING_FOR_NO_SIM.equals(sIccId[phoneId])) {
@@ -716,8 +717,8 @@ public class SubscriptionInfoUpdater extends Handler {
            mSubscriptionManager.addSubscriptionInfoRecord(sIccId[phoneId], phoneId);
            mSubscriptionManager.addSubscriptionInfoRecord(sIccId[phoneId], phoneId);
        }
        }


        List<SubscriptionInfo> subInfos = SubscriptionController.getInstance()
        List<SubscriptionInfo> subInfos =
                .getSubInfoUsingSlotIndexPrivileged(phoneId);
                mSubscriptionController.getSubInfoUsingSlotIndexPrivileged(phoneId);
        if (subInfos != null) {
        if (subInfos != null) {
            boolean changed = false;
            boolean changed = false;
            for (int i = 0; i < subInfos.size(); i++) {
            for (int i = 0; i < subInfos.size(); i++) {
@@ -736,7 +737,7 @@ public class SubscriptionInfoUpdater extends Handler {
            }
            }
            if (changed) {
            if (changed) {
                // refresh Cached Active Subscription Info List
                // refresh Cached Active Subscription Info List
                SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList();
                mSubscriptionController.refreshCachedActiveSubscriptionInfoList();
            }
            }
        }
        }


@@ -766,22 +767,22 @@ public class SubscriptionInfoUpdater extends Handler {
            }
            }
            updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
            updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
                if (hasChanges) {
                if (hasChanges) {
                    SubscriptionController.getInstance().notifySubscriptionInfoChanged();
                    mSubscriptionController.notifySubscriptionInfoChanged();
                }
                }
                if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete");
                if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete");
            });
            });
        }
        }


        SubscriptionController.getInstance().notifySubscriptionInfoChanged();
        mSubscriptionController.notifySubscriptionInfoChanged();
        if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete");
        if (DBG) logd("updateSubscriptionInfoByIccId: SubscriptionInfo update complete");
    }
    }


    private static void setSubInfoInitialized() {
    private void setSubInfoInitialized() {
        // Should only be triggered once.
        // Should only be triggered once.
        if (!sIsSubInfoInitialized) {
        if (!sIsSubInfoInitialized) {
            if (DBG) logd("SubInfo Initialized");
            if (DBG) logd("SubInfo Initialized");
            sIsSubInfoInitialized = true;
            sIsSubInfoInitialized = true;
            SubscriptionController.getInstance().notifySubInfoReady();
            mSubscriptionController.notifySubInfoReady();
            MultiSimSettingController.getInstance().notifyAllSubscriptionLoaded();
            MultiSimSettingController.getInstance().notifyAllSubscriptionLoaded();
        }
        }
    }
    }
@@ -891,8 +892,9 @@ public class SubscriptionInfoUpdater extends Handler {
        // Update or insert records for all embedded subscriptions (except non-removable ones if the
        // Update or insert records for all embedded subscriptions (except non-removable ones if the
        // current eUICC is non-removable, since we assume these are still accessible though not
        // current eUICC is non-removable, since we assume these are still accessible though not
        // returned by the eUICC controller).
        // returned by the eUICC controller).
        List<SubscriptionInfo> existingSubscriptions = SubscriptionController.getInstance()
        List<SubscriptionInfo> existingSubscriptions =
                .getSubscriptionInfoListForEmbeddedSubscriptionUpdate(embeddedIccids, isRemovable);
                mSubscriptionController.getSubscriptionInfoListForEmbeddedSubscriptionUpdate(
                        embeddedIccids, isRemovable);
        ContentResolver contentResolver = sContext.getContentResolver();
        ContentResolver contentResolver = sContext.getContentResolver();
        for (EuiccProfileInfo embeddedProfile : embeddedProfiles) {
        for (EuiccProfileInfo embeddedProfile : embeddedProfiles) {
            int index =
            int index =
@@ -901,7 +903,7 @@ public class SubscriptionInfoUpdater extends Handler {
            int nameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID;
            int nameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID;
            if (index < 0) {
            if (index < 0) {
                // No existing entry for this ICCID; create an empty one.
                // No existing entry for this ICCID; create an empty one.
                SubscriptionController.getInstance().insertEmptySubInfoRecord(
                mSubscriptionController.insertEmptySubInfoRecord(
                        embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED);
                        embeddedProfile.getIccid(), SubscriptionManager.SIM_NOT_INSERTED);
            } else {
            } else {
                nameSource = existingSubscriptions.get(index).getNameSource();
                nameSource = existingSubscriptions.get(index).getNameSource();
@@ -963,7 +965,7 @@ public class SubscriptionInfoUpdater extends Handler {
                    SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null);
                    SubscriptionManager.ICC_ID + "=\"" + embeddedProfile.getIccid() + "\"", null);


            // refresh Cached Active Subscription Info List
            // refresh Cached Active Subscription Info List
            SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList();
            mSubscriptionController.refreshCachedActiveSubscriptionInfoList();
        }
        }


        // Remove all remaining subscriptions which have embedded = true. We set embedded to false
        // Remove all remaining subscriptions which have embedded = true. We set embedded to false
@@ -991,7 +993,7 @@ public class SubscriptionInfoUpdater extends Handler {
            contentResolver.update(SubscriptionManager.CONTENT_URI, values, whereClause, null);
            contentResolver.update(SubscriptionManager.CONTENT_URI, values, whereClause, null);


            // refresh Cached Active Subscription Info List
            // refresh Cached Active Subscription Info List
            SubscriptionController.getInstance().refreshCachedActiveSubscriptionInfoList();
            mSubscriptionController.refreshCachedActiveSubscriptionInfoList();
        }
        }


        if (DBG) logd("updateEmbeddedSubscriptions done hasChanges=" + hasChanges);
        if (DBG) logd("updateEmbeddedSubscriptions done hasChanges=" + hasChanges);
@@ -1041,20 +1043,14 @@ public class SubscriptionInfoUpdater extends Handler {
            return;
            return;
        }
        }


        SubscriptionController sc = SubscriptionController.getInstance();
        int currentSubId = mSubscriptionController.getSubIdUsingPhoneId(phoneId);
        if (sc == null) {
            loge("SubscriptionController was null");
            return;
        }

        int currentSubId = sc.getSubIdUsingPhoneId(phoneId);
        if (!SubscriptionManager.isValidSubscriptionId(currentSubId)
        if (!SubscriptionManager.isValidSubscriptionId(currentSubId)
                || currentSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
                || currentSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
            if (DBG) logd("No subscription is active for phone being updated");
            if (DBG) logd("No subscription is active for phone being updated");
            return;
            return;
        }
        }


        SubscriptionInfo currentSubInfo = sc.getSubscriptionInfo(currentSubId);
        SubscriptionInfo currentSubInfo = mSubscriptionController.getSubscriptionInfo(currentSubId);
        if (currentSubInfo == null) {
        if (currentSubInfo == null) {
            loge("Couldn't retrieve subscription info for current subscription");
            loge("Couldn't retrieve subscription info for current subscription");
            return;
            return;
@@ -1098,8 +1094,8 @@ public class SubscriptionInfoUpdater extends Handler {
                            && currentSubInfo.getGroupUuid() != null) {
                            && currentSubInfo.getGroupUuid() != null) {
                        cv.put(SubscriptionManager.GROUP_UUID, (String) null);
                        cv.put(SubscriptionManager.GROUP_UUID, (String) null);
                        if (DBG) logd("Group Removed for" + currentSubId);
                        if (DBG) logd("Group Removed for" + currentSubId);
                    } else if (SubscriptionController.getInstance().canPackageManageGroup(groupUuid,
                    } else if (mSubscriptionController.canPackageManageGroup(
                        configPackageName)) {
                            groupUuid, configPackageName)) {
                        cv.put(SubscriptionManager.GROUP_UUID, groupUuid.toString());
                        cv.put(SubscriptionManager.GROUP_UUID, groupUuid.toString());
                        cv.put(SubscriptionManager.GROUP_OWNER, configPackageName);
                        cv.put(SubscriptionManager.GROUP_OWNER, configPackageName);
                        if (DBG) logd("Group Added for" + currentSubId);
                        if (DBG) logd("Group Added for" + currentSubId);
@@ -1114,8 +1110,8 @@ public class SubscriptionInfoUpdater extends Handler {
        }
        }
        if (cv.size() > 0 && sContext.getContentResolver().update(SubscriptionManager
        if (cv.size() > 0 && sContext.getContentResolver().update(SubscriptionManager
                    .getUriForSubscriptionId(currentSubId), cv, null, null) > 0) {
                    .getUriForSubscriptionId(currentSubId), cv, null, null) > 0) {
            sc.refreshCachedActiveSubscriptionInfoList();
            mSubscriptionController.refreshCachedActiveSubscriptionInfoList();
            sc.notifySubscriptionInfoChanged();
            mSubscriptionController.notifySubscriptionInfoChanged();
            MultiSimSettingController.getInstance().notifySubscriptionGroupChanged(groupUuid);
            MultiSimSettingController.getInstance().notifySubscriptionGroupChanged(groupUuid);
        }
        }
    }
    }
@@ -1129,22 +1125,6 @@ public class SubscriptionInfoUpdater extends Handler {
        return -1;
        return -1;
    }
    }


    private boolean isNewSim(String iccId, String decIccId, String[] oldIccId) {
        boolean newSim = true;
        for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
            if(iccId.equals(oldIccId[i])) {
                newSim = false;
                break;
            } else if (decIccId != null && decIccId.equals(oldIccId[i])) {
                newSim = false;
                break;
            }
        }
        logd("newSim = " + newSim);

        return newSim;
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    protected void broadcastSimStateChanged(int phoneId, String state, String reason) {
    protected void broadcastSimStateChanged(int phoneId, String state, String reason) {
        Intent i = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        Intent i = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
+2 −2
Original line number Original line Diff line number Diff line
@@ -443,7 +443,7 @@ public class TelephonyComponentFactory {
    }
    }


    public SubscriptionInfoUpdater makeSubscriptionInfoUpdater(Looper looper, Context context,
    public SubscriptionInfoUpdater makeSubscriptionInfoUpdater(Looper looper, Context context,
            CommandsInterface[] ci) {
            SubscriptionController sc) {
        return new SubscriptionInfoUpdater(looper, context, ci);
        return new SubscriptionInfoUpdater(looper, context, sc);
    }
    }
}
}
+5 −6
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.util.Log;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;


import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.SubscriptionInfoUpdater;
import com.android.internal.telephony.SubscriptionInfoUpdater;
@@ -49,10 +48,10 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater {
            .getSupportedModemCount();
            .getSupportedModemCount();


    static VendorSubscriptionInfoUpdater init(Looper looper, Context context,
    static VendorSubscriptionInfoUpdater init(Looper looper, Context context,
            CommandsInterface[] ci) {
            SubscriptionController sc) {
        synchronized (VendorSubscriptionInfoUpdater.class) {
        synchronized (VendorSubscriptionInfoUpdater.class) {
            if (sInstance == null) {
            if (sInstance == null) {
                sInstance = new VendorSubscriptionInfoUpdater(looper, context, ci);
                sInstance = new VendorSubscriptionInfoUpdater(looper, context, sc);
            } else {
            } else {
                Log.wtf(LOG_TAG, "init() called multiple times!  sInstance = " + sInstance);
                Log.wtf(LOG_TAG, "init() called multiple times!  sInstance = " + sInstance);
            }
            }
@@ -68,8 +67,8 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater {
    }
    }


    protected VendorSubscriptionInfoUpdater(Looper looper, Context context,
    protected VendorSubscriptionInfoUpdater(Looper looper, Context context,
            CommandsInterface[] ci) {
            SubscriptionController sc) {
        super(looper, context, ci);
        super(looper, context, sc);
        sContext = context;
        sContext = context;
        mIsRecordUpdateRequired = new boolean[SUPPORTED_MODEM_COUNT];
        mIsRecordUpdateRequired = new boolean[SUPPORTED_MODEM_COUNT];


@@ -105,7 +104,7 @@ public class VendorSubscriptionInfoUpdater extends SubscriptionInfoUpdater {
        cardIds.add(getCardIdFromPhoneId(phoneId));
        cardIds.add(getCardIdFromPhoneId(phoneId));
        updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
        updateEmbeddedSubscriptions(cardIds, (hasChanges) -> {
            if (hasChanges) {
            if (hasChanges) {
                SubscriptionController.getInstance().notifySubscriptionInfoChanged();
                mSubscriptionController.notifySubscriptionInfoChanged();
            }
            }
        });
        });
        broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null);
        broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_READY, null);
+2 −2
Original line number Original line Diff line number Diff line
@@ -162,8 +162,8 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest {
                .getActiveSubIdList(/*visibleOnly*/false);
                .getActiveSubIdList(/*visibleOnly*/false);
        mIccRecord = mUiccProfile.getIccRecords();
        mIccRecord = mUiccProfile.getIccRecords();


        mUpdater = new SubscriptionInfoUpdater(Looper.myLooper(), mContext,
        mUpdater =
            new CommandsInterface[]{mSimulatedCommands});
                new SubscriptionInfoUpdater(Looper.myLooper(), mContext, mSubscriptionController);
        processAllMessages();
        processAllMessages();


        assertFalse(mUpdater.isSubInfoInitialized());
        assertFalse(mUpdater.isSubInfoInitialized());