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

Commit 3d93b856 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Ricardo Cerqueira
Browse files

GsmSS: Use per-slot resources for carrier-bound options

The decision of whether an MVNO operator is roaming or not comes from
an mcc/mnc-specific resource. Relying on the global system resources
to provide the appropriate result for each of the slots on a multi-SIM
device is just wrong, since each SIM will have (and need) its own
separate preferences and arrays of compatible/blocked carriers.

Ref CYNGNOS-2534, CYNGNOS-3190

Change-Id: If3b45a4a4702cf45bc1d965e26c8df7ef3ff783b
(cherry picked from commit 658eea80)
parent f0925cb9
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -1652,8 +1652,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
     */
    private boolean isOperatorConsideredNonRoaming(ServiceState s) {
        String operatorNumeric = s.getOperatorNumeric();
        String[] numericArray = mPhone.getContext().getResources().getStringArray(
        String[] numericArray;
        int subId = mPhone.getSubId();
        if (subId >= 0) {
            numericArray = SubscriptionManager.getResourcesForSubId(mPhone.getContext(),subId)
                 .getStringArray(com.android.internal.R.array.config_operatorConsideredNonRoaming);
        } else {
            numericArray = mPhone.getContext().getResources().getStringArray(
                    com.android.internal.R.array.config_operatorConsideredNonRoaming);
        }

        if (numericArray.length == 0 || operatorNumeric == null) {
            return false;
@@ -1669,8 +1676,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {

    private boolean isOperatorConsideredRoaming(ServiceState s) {
        String operatorNumeric = s.getOperatorNumeric();
        String[] numericArray = mPhone.getContext().getResources().getStringArray(
        String[] numericArray;
        int subId = mPhone.getSubId();
        if (subId >= 0) {
            numericArray = SubscriptionManager.getResourcesForSubId(mPhone.getContext(),subId)
                .getStringArray(
                    com.android.internal.R.array.config_sameNamedOperatorConsideredRoaming);
        } else {
            numericArray = mPhone.getContext().getResources().getStringArray(
                    com.android.internal.R.array.config_sameNamedOperatorConsideredRoaming);
        }

        if (numericArray.length == 0 || operatorNumeric == null) {
            return false;