Change to consider SIGNAL_LOST as permanenet failure only if not attached.
Amit Mahajan [Fri, 24 Oct 2014 01:30:52 +0000 (18:30 -0700)]
Bug: 18062475
Change-Id: I6c1b220fbb3cc9798419ec190e83d3eaea16ec69

src/java/com/android/internal/telephony/dataconnection/DataConnection.java
src/java/com/android/internal/telephony/dataconnection/DcController.java
src/java/com/android/internal/telephony/dataconnection/DcTracker.java
src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java

index c87c4fb..d83da44 100644 (file)
@@ -1588,16 +1588,16 @@ public final class DataConnection extends StateMachine {
                                         + " isRetryNeeded=" + mRetryManager.isRetryNeeded()
                                         + " result=" + result
                                         + " result.isRestartRadioFail=" +
-                                                result.mFailCause.isRestartRadioFail()
+                                        result.mFailCause.isRestartRadioFail()
                                         + " result.isPermanentFail=" +
-                                                result.mFailCause.isPermanentFail());
+                                        mDct.isPermanentFail(result.mFailCause));
                             }
                             if (result.mFailCause.isRestartRadioFail()) {
                                 if (DBG) log("DcActivatingState: ERR_RilError restart radio");
                                 mDct.sendRestartRadio();
                                 mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                                 transitionTo(mInactiveState);
-                            } else if (result.mFailCause.isPermanentFail()) {
+                            } else if (mDct.isPermanentFail(result.mFailCause)) {
                                 if (DBG) log("DcActivatingState: ERR_RilError perm error");
                                 mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                                 transitionTo(mInactiveState);
@@ -1662,7 +1662,7 @@ public final class DataConnection extends StateMachine {
                             mDct.sendRestartRadio();
                             mInactiveState.setEnterNotificationParams(cp, cause);
                             transitionTo(mInactiveState);
-                        } else if (cause.isPermanentFail()) {
+                        } else if (mDct.isPermanentFail(cause)) {
                             if (DBG) log("DcActivatingState: EVENT_GET_LAST_FAIL_DONE perm er");
                             mInactiveState.setEnterNotificationParams(cp, cause);
                             transitionTo(mInactiveState);
index 3d45ced..c7ef159 100644 (file)
@@ -245,7 +245,7 @@ class DcController extends StateMachine {
                             if (failCause.isRestartRadioFail()) {
                                 if (DBG) log("onDataStateChanged: X restart radio");
                                 mDct.sendRestartRadio();
-                            } else if (failCause.isPermanentFail()) {
+                            } else if (mDct.isPermanentFail(failCause)) {
                                 if (DBG) log("onDataStateChanged: inactive, add to cleanup list");
                                 apnsToCleanup.addAll(dc.mApnContexts);
                             } else {
index ae6fcf6..20eeec5 100644 (file)
@@ -1194,6 +1194,12 @@ public final class DcTracker extends DcTrackerBase {
         return false;
     }
 
+    @Override
+    protected boolean isPermanentFail(DcFailCause dcFailCause) {
+        return (dcFailCause.isPermanentFail() &&
+                (mAttached.get() == false || dcFailCause != DcFailCause.SIGNAL_LOST));
+    }
+
     private ApnSetting makeApnSetting(Cursor cursor) {
         String[] types = parseTypes(
                 cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.TYPE)));
@@ -1538,7 +1544,7 @@ public final class DcTracker extends DcTrackerBase {
     private void notifyNoData(DcFailCause lastFailCauseCode,
                               ApnContext apnContext) {
         if (DBG) log( "notifyNoData: type=" + apnContext.getApnType());
-        if (lastFailCauseCode.isPermanentFail()
+        if (isPermanentFail(lastFailCauseCode)
             && (!apnContext.getApnType().equals(PhoneConstants.APN_TYPE_DEFAULT))) {
             mPhone.notifyDataConnectionFailed(apnContext.getReason(), apnContext.getApnType());
         }
@@ -2008,7 +2014,7 @@ public final class DcTracker extends DcTrackerBase {
                     apnContext.getApnType(), apn != null ? apn.apn : "unknown", cause.toString());
 
             // Count permanent failures and remove the APN we just tried
-            if (cause.isPermanentFail()) apnContext.decWaitingApnsPermFailCount();
+            if (isPermanentFail(cause)) apnContext.decWaitingApnsPermFailCount();
 
             apnContext.removeWaitingApn(apnContext.getApnSetting());
             if (DBG) {
index 0ba61c2..c209642 100644 (file)
@@ -767,6 +767,7 @@ public abstract class DcTrackerBase extends Handler {
     public abstract String[] getPcscfAddress(String apnType);
     public abstract void setImsRegistrationState(boolean registered);
     protected abstract boolean mvnoMatches(IccRecords r, String mvno_type, String mvno_match_data);
+    protected abstract boolean isPermanentFail(DcFailCause dcFailCause);
 
     @Override
     public void handleMessage(Message msg) {