Support suggestedRetryTime in CDMA DCT

Support suggestedRetryTime in SETUP_DATA response in CDMA DCT.

Bug: 5740832
Change-Id: I4abd884bec76f1d9ee29d1ba36c7ea2cac9e0fb3
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index 5889372..7f0f426 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -41,6 +41,7 @@
 import com.android.internal.telephony.DataConnectionTracker;
 import com.android.internal.telephony.EventLogTags;
 import com.android.internal.telephony.RetryManager;
+import com.android.internal.telephony.RILConstants;
 import com.android.internal.telephony.Phone;
 import com.android.internal.util.AsyncChannel;
 
@@ -506,7 +507,7 @@
         return retry;
     }
 
-    private void reconnectAfterFail(FailCause lastFailCauseCode, String reason) {
+    private void reconnectAfterFail(FailCause lastFailCauseCode, String reason, int retryOverride) {
         if (mState == State.FAILED) {
             /**
              * For now With CDMA we never try to reconnect on
@@ -514,9 +515,12 @@
              * at the last time until the state is changed.
              * TODO: Make this configurable?
              */
-            int nextReconnectDelay = mDataConnections.get(0).getRetryTimer();
+            int nextReconnectDelay = retryOverride;
+            if (nextReconnectDelay < 0) {
+                nextReconnectDelay = mDataConnections.get(0).getRetryTimer();
+                mDataConnections.get(0).increaseRetryCount();
+            }
             startAlarmForReconnect(nextReconnectDelay, reason);
-            mDataConnections.get(0).increaseRetryCount();
 
             if (!shouldPostNotification(lastFailCauseCode)) {
                 log("NOT Posting Data Connection Unavailable notification "
@@ -674,7 +678,17 @@
                 notifyNoData(cause);
                 return;
             }
-            startDelayedRetry(cause, reason);
+
+            int retryOverride = -1;
+            if (ar.exception instanceof DataConnection.CallSetupException) {
+                retryOverride =
+                    ((DataConnection.CallSetupException)ar.exception).getRetryOverride();
+            }
+            if (retryOverride == RILConstants.MAX_INT) {
+                if (DBG) log("No retry is suggested.");
+            } else {
+                startDelayedRetry(cause, reason, retryOverride);
+            }
         }
     }
 
@@ -907,9 +921,9 @@
         }
     }
 
-    private void startDelayedRetry(FailCause cause, String reason) {
+    private void startDelayedRetry(FailCause cause, String reason, int retryOverride) {
         notifyNoData(cause);
-        reconnectAfterFail(cause, reason);
+        reconnectAfterFail(cause, reason, retryOverride);
     }
 
     @Override