Revert "Revert "telephony: Set roam though same named operator""
Vineeta Srivastava [Thu, 26 Sep 2013 20:11:19 +0000 (20:11 +0000)]
This reverts commit cd338fdb16422f47788c3bc3cdf6391f1268bbfe.

Change-Id: Ib7aa6ce911a22098461c76b5e0be191852d34bb1

src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java

index ca1e08d..5884aeb 100644 (file)
@@ -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.