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

Commit ce0eb1a9 authored by Sungmin Choi's avatar Sungmin Choi Committed by Vineeta Srivastava
Browse files

telephony: Set roam though same named operator

Show roaming icon though same named operators.
Though same mcc and same operator name, some operator want to roam.
For example, users of 40485 should see the roaming icon as using 40483
network though same Reliance network.

Bug: 10699045, 10703022
Change-Id: Ife1024ef10a29e43e32040800b25feca9f51fb62
parent d1b11a34
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -746,7 +746,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
             * agreements and MVNO's.
             */
            boolean roaming = (mGsmRoaming || mDataRoaming);
            if ((mGsmRoaming && isSameNamedOperators(mNewSS))
            if ((mGsmRoaming && isSameNamedOperators(mNewSS)
                        && !isSameNamedOperatorConsideredRoaming(mNewSS))
                    || isOperatorConsideredNonRoaming(mNewSS)) {
                roaming = false;
            }
@@ -1372,6 +1373,23 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
        return false;
    }

    private boolean isSameNamedOperatorConsideredRoaming(ServiceState s) {
        String operatorNumeric = s.getOperatorNumeric();
        String[] numericArray = mPhone.getContext().getResources().getStringArray(
                    com.android.internal.R.array.config_sameNamedOperatorConsideredRoaming);

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

        for (String numeric : numericArray) {
            if (operatorNumeric.startsWith(numeric))
                return true;
            else
                return false;
        }
        return false;
    }

    /**
     * @return The current GPRS state. IN_SERVICE is the same as "attached"
     * and OUT_OF_SERVICE is the same as detached.