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

Commit 169b2795 authored by Jack Yu's avatar Jack Yu
Browse files

Get rid of SIM record access in DcTracker

DcTracker uses several SIM related signals for different purposes.
Those signals include SIM record loaded/not-loaded, subscription
changed event, and carrier config changed event. Those signals
are slightly different but not that really important to DcTracker.
What DcTracker cares is
1. Whether SIM is inserted or not.
2. Whether configuration changes or not.

By listening to a single carrier config change event can handle
the cases above.

Removed all SIM record related places in DcTracker. SIM record should
not be accessed by anyone outside of UICC controller.

Test: Manual test + unit tests
Bug: 146168348
Change-Id: Ic8ab8e06e41fd34e19db666fe587a5cf1c29ed14
parent 5e8b54e0
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ import com.android.internal.telephony.dataconnection.TransportManager;
import com.android.internal.telephony.emergency.EmergencyNumberTracker;
import com.android.internal.telephony.gsm.GsmMmiCode;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.imsphone.ImsPhoneMmiCode;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccCardStatus;
@@ -106,7 +107,6 @@ import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.uicc.UiccSlot;
import com.android.internal.telephony.util.ArrayUtils;
import com.android.telephony.Rlog;
import com.android.internal.telephony.imsphone.ImsPhoneMmiCode;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -3144,7 +3144,7 @@ public class GsmCdmaPhone extends Phone {
                                simOperatorNumeric);
                    }
                }
                updateDataConnectionTracker();
                updateCurrentCarrierInProvider();
            }
        }

@@ -4013,10 +4013,9 @@ public class GsmCdmaPhone extends Phone {
        return dialString;
    }

    /**
     * @return operator numeric.
     */
    private String getOperatorNumeric() {
    @Override
    @NonNull
    public String getOperatorNumeric() {
        String operatorNumeric = null;
        if (isPhoneTypeGsm()) {
            IccRecords r = mIccRecords.get();
@@ -4058,7 +4057,7 @@ public class GsmCdmaPhone extends Phone {
                    + " operatorNumeric = " + operatorNumeric);

        }
        return operatorNumeric;
        return TextUtils.emptyIfNull(operatorNumeric);
    }

    /**
+10 −10
Original line number Diff line number Diff line
@@ -4006,16 +4006,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return getLocaleFromCarrierProperties();
    }

    public void updateDataConnectionTracker() {
        if (mTransportManager != null) {
            for (int transport : mTransportManager.getAvailableTransports()) {
                if (getDcTracker(transport) != null) {
                    getDcTracker(transport).update();
                }
            }
        }
    }

    public boolean updateCurrentCarrierInProvider() {
        return false;
    }
@@ -4210,6 +4200,16 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return RIL.RADIO_HAL_VERSION_UNKNOWN;
    }

    /**
     * Get the SIM's MCC/MNC
     *
     * @return MCC/MNC in string format, empty string if not available.
     */
    @NonNull
    public String getOperatorNumeric() {
        return "";
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+0 −17
Original line number Diff line number Diff line
@@ -1272,9 +1272,6 @@ public class SubscriptionController extends ISub.Stub {
                    if (DBG) logdl("[addSubInfoRecord] sim name = " + nameToSet);
                }

                // Once the records are loaded, notify DcTracker
                PhoneFactory.getPhone(slotIndex).updateDataConnectionTracker();

                if (DBG) logdl("[addSubInfoRecord]- info size=" + sSlotIndexToSubIds.size());
            }

@@ -2386,9 +2383,6 @@ public class SubscriptionController extends ISub.Stub {
                }
            }

            // FIXME is this still needed?
            updateAllDataConnectionTrackers();

            int previousDefaultSub = getDefaultSubId();
            Settings.Global.putInt(mContext.getContentResolver(),
                    Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, subId);
@@ -2402,17 +2396,6 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    @UnsupportedAppUsage
    private void updateAllDataConnectionTrackers() {
        // Tell Phone Proxies to update data connection tracker
        int len = TelephonyManager.from(mContext).getActiveModemCount();
        if (DBG) logd("[updateAllDataConnectionTrackers] activeModemCount=" + len);
        for (int phoneId = 0; phoneId < len; phoneId++) {
            if (DBG) logd("[updateAllDataConnectionTrackers] phoneId=" + phoneId);
            PhoneFactory.getPhone(phoneId).updateDataConnectionTracker();
        }
    }

    @UnsupportedAppUsage
    private void broadcastDefaultDataSubIdChanged(int subId) {
        // Broadcast an Intent for default data sub change
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class DataConnectionReasons {

        // Belows are all hard failure reasons.
        NOT_ATTACHED(true),
        RECORD_NOT_LOADED(true),
        SIM_NOT_READY(true),
        INVALID_PHONE_STATE(true),
        CONCURRENT_VOICE_DATA_NOT_ALLOWED(true),
        PS_RESTRICTED(true),
+89 −178

File changed.

Preview size limit exceeded, changes collapsed.

Loading