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

Commit 1110f0fd authored by Vineeta Srivastava's avatar Vineeta Srivastava
Browse files

Revert "Revert "telephony: Set roam though same named operator""

This reverts commit cd338fdb.

Change-Id: Ib7aa6ce911a22098461c76b5e0be191852d34bb1
parent cd338fdb
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.