Merge "Allow 0.0.0.0 and :: as default gateways" into jb-mr2-dev
diff --git a/src/java/com/android/internal/telephony/uicc/IccRecords.java b/src/java/com/android/internal/telephony/uicc/IccRecords.java
index dc24d89..140277a 100644
--- a/src/java/com/android/internal/telephony/uicc/IccRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/IccRecords.java
@@ -24,6 +24,7 @@
 import android.os.RegistrantList;
 
 import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -91,6 +92,7 @@
     public static final int EVENT_SPN = 2; // Service Provider Name
 
     public static final int EVENT_GET_ICC_RECORD_DONE = 100;
+    protected static final int EVENT_APP_READY = 1;
 
     @Override
     public String toString() {
@@ -366,6 +368,17 @@
      */
     public abstract void onRefresh(boolean fileChanged, int[] fileList);
 
+    /**
+     * Called by subclasses (SimRecords and RuimRecords) whenever
+     * IccRefreshResponse.REFRESH_RESULT_INIT event received
+     */
+    protected void onIccRefreshInit() {
+        mAdnCache.reset();
+        if (mParentApp.getState() == AppState.APPSTATE_READY) {
+            // This will cause files to be reread
+            sendMessage(obtainMessage(EVENT_APP_READY));
+        }
+    }
 
     public boolean getRecordsLoaded() {
         if (mRecordsToLoad == 0 && mRecordsRequested == true) {
diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
index 5b2fc59..4f6a130 100755
--- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
@@ -82,7 +82,6 @@
     }
 
     // ***** Event Constants
-    private static final int EVENT_APP_READY = 1;
     private static final int EVENT_GET_IMSI_DONE = 3;
     private static final int EVENT_GET_DEVICE_IDENTITY_DONE = 4;
     private static final int EVENT_GET_ICCID_DONE = 5;
@@ -774,7 +773,7 @@
             case IccRefreshResponse.REFRESH_RESULT_INIT:
                 if (DBG) log("handleRuimRefresh with SIM_REFRESH_INIT");
                 // need to reload all files (that we care about)
-                fetchRuimRecords();
+                onIccRefreshInit();
                 break;
             case IccRefreshResponse.REFRESH_RESULT_RESET:
                 if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET");
diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
index 8688786..2927e86 100644
--- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
@@ -124,8 +124,6 @@
     private static final int CPHS_SST_MBN_ENABLED = 0x30;
 
     // ***** Event Constants
-
-    private static final int EVENT_APP_READY = 1;
     private static final int EVENT_GET_IMSI_DONE = 3;
     private static final int EVENT_GET_ICCID_DONE = 4;
     private static final int EVENT_GET_MBI_DONE = 5;
@@ -1206,8 +1204,7 @@
             case IccRefreshResponse.REFRESH_RESULT_INIT:
                 if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT");
                 // need to reload all files (that we care about)
-                mAdnCache.reset();
-                fetchSimRecords();
+                onIccRefreshInit();
                 break;
             case IccRefreshResponse.REFRESH_RESULT_RESET:
                 if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");