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

Commit 273124f2 authored by Sandeep Gutta's avatar Sandeep Gutta
Browse files

Create UiccController before SubscriptionController init

SubscriptionController internally using UiccController object,
hence making code changes to create UiccController object first
and then SubscriptionController.

Bug: 127765523
Change-Id: I35a2acc1458ce9756b3793cd77ea7d5ad359a36a
parent 8792c505
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -164,13 +164,14 @@ public class PhoneFactory {
                    sCommandsInterfaces[i] = new RIL(context, networkModes[i],
                            cdmaSubscription, i);
                }
                Rlog.i(LOG_TAG, "Creating SubscriptionController");
                SubscriptionController.init(context, sCommandsInterfaces);

                // Instantiate UiccController so that all other classes can just
                // call getInstance()
                sUiccController = UiccController.make(context, sCommandsInterfaces);

                Rlog.i(LOG_TAG, "Creating SubscriptionController");
                SubscriptionController.init(context, sCommandsInterfaces);

                if (context.getPackageManager().hasSystemFeature(
                        PackageManager.FEATURE_TELEPHONY_EUICC)) {
                    sEuiccController = EuiccController.init(context);
+11 −3
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ public class SubscriptionController extends ISub.Stub {
    @UnsupportedAppUsage
    protected Context mContext;
    protected TelephonyManager mTelephonyManager;
    protected UiccController mUiccController;

    private AppOpsManager mAppOps;

@@ -221,6 +222,13 @@ public class SubscriptionController extends ISub.Stub {
        mContext = c;
        mTelephonyManager = TelephonyManager.from(mContext);

        try {
            mUiccController = UiccController.getInstance();
        } catch(RuntimeException ex) {
            throw new RuntimeException(
                    "UiccController has to be initialised before SubscriptionController init");
        }

        mAppOps = (AppOpsManager)mContext.getSystemService(Context.APP_OPS_SERVICE);

        if(ServiceManager.getService("isub") == null) {
@@ -348,7 +356,7 @@ public class SubscriptionController extends ISub.Stub {
        String countryIso = cursor.getString(cursor.getColumnIndexOrThrow(
                SubscriptionManager.ISO_COUNTRY_CODE));
        // publicCardId is the publicly exposed int card ID
        int publicCardId = UiccController.getInstance().convertToPublicCardId(cardId);
        int publicCardId = mUiccController.convertToPublicCardId(cardId);
        boolean isEmbedded = cursor.getInt(cursor.getColumnIndexOrThrow(
                SubscriptionManager.IS_EMBEDDED)) == 1;
        int carrierId = cursor.getInt(cursor.getColumnIndexOrThrow(
@@ -1045,7 +1053,7 @@ public class SubscriptionController extends ISub.Stub {
                            value.put(SubscriptionManager.ICC_ID, uniqueId);
                        }

                        UiccCard card = UiccController.getInstance().getUiccCardForPhone(slotIndex);
                        UiccCard card = mUiccController.getUiccCardForPhone(slotIndex);
                        if (card != null) {
                            String cardId = card.getCardId();
                            if (cardId != null && cardId != oldCardId) {
@@ -1370,7 +1378,7 @@ public class SubscriptionController extends ISub.Stub {
        if (isSubscriptionForRemoteSim(subscriptionType)) {
            value.put(SubscriptionManager.DISPLAY_NAME, displayName);
        } else {
            UiccCard card = UiccController.getInstance().getUiccCardForPhone(slotIndex);
            UiccCard card = mUiccController.getUiccCardForPhone(slotIndex);
            if (card != null) {
                String cardId = card.getCardId();
                if (cardId != null) {