telephony: Set roam though same named operator
Sungmin Choi [Mon, 23 Sep 2013 06:06:26 +0000 (23:06 -0700)]
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

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.