Testing property to verify roaming behavior.
Jeff Sharkey [Mon, 25 Mar 2013 21:22:39 +0000 (14:22 -0700)]
Bug: 6777372
Change-Id: Ia698f0eca6f05a6327f6c8b36cfe14f51f01e6e3

README.txt
src/java/com/android/internal/telephony/ServiceStateTracker.java
src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java

index 4afeefc..083e15a 100644 (file)
@@ -23,7 +23,7 @@ thread. Without this change there was a dead lock when
 sendMessageSynchronously blocks.
 
 
-Testing:
+== Testing ==
 
 There are three Intents that can be sent for testing pruproses:
 
@@ -43,13 +43,30 @@ To simplify testing we also have detach and attach simulations below where {x} i
   adb shell am broadcast -a com.android.internal.telephony.{x}.action_attached
 
 
-Additionally, you on DEGUGGABLE builds (userdebug, eng) you can replace the retry configuration
-by setting the SystemProperty: test.data_retry_config for instance:
+== Testing on Debuggable Builds ==
 
-  adb shell setprop test.data_retry_config "5000,5000,5000"
+On debuggable builds (userdebug, eng) you can change additional
+settings through system properties.  These properties can be set with
+"setprop" for the current boot, or added to local.prop to persist
+across boots.
 
-Which changes the retry to 3 retires at 5 second intervals. This can be added to
-/data/local.prop, don't forget to "adb shell chmod 0600 /data/local.prop":
-  $ cat local.prop.test.data_retry_config
-  test.data_retry_config=5000,5000,5000,5000
+device# setprop key value
 
+device# echo "key=value" >> /data/local.prop
+device# chmod 644 /data/local.prop
+
+
+-- Retry configuration --
+
+You can replace the connection retry configuration.  For example, you
+could change it to perform 4 retries at 5 second intervals:
+
+device# setprop test.data_retry_config "5000,5000,5000"
+
+
+-- Roaming --
+
+You can force the telephony stack to always assume that it's roaming
+to verify higher-level framework functionality:
+
+device# setprop telephony.test.forceRoaming true
index 37ad8d3..47fb63f 100644 (file)
@@ -40,6 +40,7 @@ import com.android.internal.telephony.uicc.UiccController;
  * {@hide}
  */
 public abstract class ServiceStateTracker extends Handler {
+    protected static final String PROP_FORCE_ROAMING = "telephony.test.forceRoaming";
 
     protected CommandsInterface mCi;
     protected UiccController mUiccController = null;
index 795a7e0..b333837 100644 (file)
 
 package com.android.internal.telephony.cdma;
 
-import com.android.internal.telephony.CommandException;
-import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.dataconnection.DcTrackerBase;
-import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.MccTable;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.ServiceStateTracker;
-import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.telephony.TelephonyProperties;
-import com.android.internal.telephony.CommandsInterface.RadioState;
-import com.android.internal.telephony.uicc.UiccCardApplication;
-import com.android.internal.telephony.uicc.UiccController;
-
 import android.app.AlarmManager;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.database.ContentObserver;
 import android.os.AsyncResult;
+import android.os.Build;
 import android.os.Handler;
 import android.os.Message;
 import android.os.PowerManager;
@@ -48,14 +35,28 @@ import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 import android.telephony.CellInfo;
 import android.telephony.CellInfoCdma;
+import android.telephony.Rlog;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
 import android.telephony.cdma.CdmaCellLocation;
 import android.text.TextUtils;
 import android.util.EventLog;
-import android.telephony.Rlog;
 import android.util.TimeUtils;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.CommandsInterface.RadioState;
+import com.android.internal.telephony.EventLogTags;
+import com.android.internal.telephony.MccTable;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.ServiceStateTracker;
+import com.android.internal.telephony.TelephonyIntents;
+import com.android.internal.telephony.TelephonyProperties;
+import com.android.internal.telephony.dataconnection.DcTrackerBase;
+import com.android.internal.telephony.uicc.UiccCardApplication;
+import com.android.internal.telephony.uicc.UiccController;
+
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.Arrays;
@@ -959,6 +960,10 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
     protected void pollStateDone() {
         if (DBG) log("pollStateDone: cdma oldSS=[" + mSS + "] newSS=[" + mNewSS + "]");
 
+        if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean(PROP_FORCE_ROAMING, false)) {
+            mNewSS.setRoaming(true);
+        }
+
         boolean hasRegistered =
             mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
             && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;
index 6823b14..d4d2edc 100644 (file)
 
 package com.android.internal.telephony.gsm;
 
-import com.android.internal.telephony.CommandException;
-import com.android.internal.telephony.CommandsInterface;
-import com.android.internal.telephony.dataconnection.DcTrackerBase;
-import com.android.internal.telephony.EventLogTags;
-import com.android.internal.telephony.MccTable;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.RestrictedState;
-import com.android.internal.telephony.RILConstants;
-import com.android.internal.telephony.ServiceStateTracker;
-import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.telephony.TelephonyProperties;
-import com.android.internal.telephony.uicc.IccRecords;
-import com.android.internal.telephony.uicc.SIMRecords;
-import com.android.internal.telephony.uicc.UiccCardApplication;
-import com.android.internal.telephony.uicc.UiccController;
-import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
-
 import android.app.AlarmManager;
 import android.app.Notification;
 import android.app.NotificationManager;
@@ -45,6 +28,7 @@ import android.content.IntentFilter;
 import android.content.res.Resources;
 import android.database.ContentObserver;
 import android.os.AsyncResult;
+import android.os.Build;
 import android.os.Handler;
 import android.os.Message;
 import android.os.PowerManager;
@@ -54,14 +38,31 @@ import android.os.UserHandle;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 import android.telephony.CellInfoGsm;
+import android.telephony.Rlog;
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
 import android.telephony.gsm.GsmCellLocation;
 import android.text.TextUtils;
 import android.util.EventLog;
-import android.telephony.Rlog;
 import android.util.TimeUtils;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.EventLogTags;
+import com.android.internal.telephony.MccTable;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.RILConstants;
+import com.android.internal.telephony.RestrictedState;
+import com.android.internal.telephony.ServiceStateTracker;
+import com.android.internal.telephony.TelephonyIntents;
+import com.android.internal.telephony.TelephonyProperties;
+import com.android.internal.telephony.dataconnection.DcTrackerBase;
+import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
+import com.android.internal.telephony.uicc.IccRecords;
+import com.android.internal.telephony.uicc.SIMRecords;
+import com.android.internal.telephony.uicc.UiccCardApplication;
+import com.android.internal.telephony.uicc.UiccController;
+
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -801,6 +802,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
                 " mNewReasonDataDenied=" + mNewReasonDataDenied);
         }
 
+        if (Build.IS_DEBUGGABLE && SystemProperties.getBoolean(PROP_FORCE_ROAMING, false)) {
+            mNewSS.setRoaming(true);
+        }
+
         boolean hasRegistered =
             mSS.getVoiceRegState() != ServiceState.STATE_IN_SERVICE
             && mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE;