Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d6d7d6c authored by Jack Yu's avatar Jack Yu
Browse files

Fixed data retry issues.

1. Fixed that data retry does not happen on time. Now we use the
   exact timer to make sure retry will happen on time.
2. Fixed that data retry timer got started twice every time when retry
   should happen.

bug: 27293537, 27158552
Change-Id: I05bbf0cb2717269984f3dc892af2a7a438ffd8f0
parent b24d183c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -505,6 +505,7 @@ public class RetryManager {
                mSameApnRetryCount < MAX_SAME_APN_RETRY) {
            // If the modem explicitly suggests a retry delay, we should use it, even in fail fast
            // mode.
            log("Modem suggested retry in " + mModemSuggestedDelay + " ms.");
            return mModemSuggestedDelay;
        }

@@ -523,7 +524,10 @@ public class RetryManager {

            // If we've already cycled through all the APNs, that means all APNs have
            // permanently failed
            if (index == mCurrentApnIndex) return NO_RETRY;
            if (index == mCurrentApnIndex) {
                log("All APNs have permanently failed.");
                return NO_RETRY;
            }
        }

        long delay;
+1 −3
Original line number Diff line number Diff line
@@ -568,9 +568,7 @@ public final class DataConnection extends StateMachine {
            // Get the completed message but only use it once
            Message connectionCompletedMsg = cp.mOnCompletedMsg;
            cp.mOnCompletedMsg = null;
            if (connectionCompletedMsg.obj instanceof ApnContext) {
                alreadySent = (ApnContext)connectionCompletedMsg.obj;
            }
            alreadySent = cp.mApnContext;

            long timeStamp = System.currentTimeMillis();
            connectionCompletedMsg.arg1 = mCid;
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import com.android.internal.telephony.Phone;
 * adb shell am broadcast -a com.android.internal.telephony.dataconnection.action_deactivate_all
 */
public class DcTesterDeactivateAll {
    private static final String LOG_TAG = "DcTesterDeacativeAll";
    private static final String LOG_TAG = "DcTesterDeacativateAll";
    private static final boolean DBG = true;

    private Phone mPhone;
+4 −1
Original line number Diff line number Diff line
@@ -2186,7 +2186,10 @@ public class DcTracker extends Handler {
        PendingIntent alarmIntent = PendingIntent.getBroadcast(mPhone.getContext(), 0,
                                        intent, PendingIntent.FLAG_UPDATE_CURRENT);
        apnContext.setReconnectIntent(alarmIntent);
        mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,

        // Use the exact timer instead of the inexact one to provide better user experience.
        // In some extreme cases, we saw the retry was delayed for few minutes.
        mAlarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                SystemClock.elapsedRealtime() + delay, alarmIntent);
    }

+23 −18
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public class SimulatedCommands extends BaseCommands

    int mNextCallFailCause = CallFailCause.NORMAL_CLEARING;

    private boolean mDcSuccess = true;
    private DataCallResponse mDcResponse;

    //***** Constructor
@@ -141,7 +142,7 @@ public class SimulatedCommands extends BaseCommands
        if(mIccCardStatus!=null) {
            resultSuccess(result, mIccCardStatus);
        } else {
            resultFail(result, new RuntimeException("IccCardStatus not set"));
            resultFail(result, null, new RuntimeException("IccCardStatus not set"));
        }
    }

@@ -494,9 +495,8 @@ public class SimulatedCommands extends BaseCommands
            resultSuccess(result, simulatedCallState.getDriverCalls());
        } else {
            //Rlog.i("GSM", "[SimCmds] getCurrentCalls: RADIO_OFF or SIM not ready!");
            resultFail(result,
                new CommandException(
                    CommandException.Error.RADIO_NOT_AVAILABLE));
            resultFail(result, null,
                new CommandException(CommandException.Error.RADIO_NOT_AVAILABLE));
        }
    }

@@ -618,7 +618,7 @@ public class SimulatedCommands extends BaseCommands

        if (!success){
            Rlog.i("GSM", "[SimCmd] hangupConnection: resultFail");
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            Rlog.i("GSM", "[SimCmd] hangupConnection: resultSuccess");
            resultSuccess(result, null);
@@ -640,7 +640,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('0', '\0');

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -662,7 +662,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('1', '\0');

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -684,7 +684,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('2', '\0');

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -705,7 +705,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('3', '\0');

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -726,7 +726,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('4', '\0');

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -745,7 +745,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('2', ch);

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -765,7 +765,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onAnswer();

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -784,7 +784,7 @@ public class SimulatedCommands extends BaseCommands
        success = simulatedCallState.onChld('0', '\0');

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
            resultFail(result, null, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
@@ -1066,8 +1066,9 @@ public class SimulatedCommands extends BaseCommands
        unimplemented(response);
    }

    public void setDataCallResponse(final DataCallResponse dcResponse) {
    public void setDataCallResponse(final boolean success, final DataCallResponse dcResponse) {
        mDcResponse = dcResponse;
        mDcSuccess = success;
    }

    @Override
@@ -1093,7 +1094,11 @@ public class SimulatedCommands extends BaseCommands
            mDcResponse.pcscf = new String[]{};
        }

        if (mDcSuccess) {
            resultSuccess(result, mDcResponse);
        } else {
            resultFail(result, mDcResponse, new RuntimeException("Setup data call failed!"));
        }
    }

    @Override
@@ -1553,9 +1558,9 @@ public class SimulatedCommands extends BaseCommands
        }
    }

    private void resultFail(Message result, Throwable tr) {
    private void resultFail(Message result, Object ret, Throwable tr) {
        if (result != null) {
            AsyncResult.forMessage(result).exception = tr;
            AsyncResult.forMessage(result, ret, tr);
            if (mPausedResponseCount > 0) {
                mPausedResponses.add(result);
            } else {
@@ -1836,7 +1841,7 @@ public class SimulatedCommands extends BaseCommands
        if(mIccIoResultForApduLogicalChannel!=null) {
            resultSuccess(response, mIccIoResultForApduLogicalChannel);
        }else {
            resultFail(response, new RuntimeException("IccIoResult not set"));
            resultFail(response, null, new RuntimeException("IccIoResult not set"));
        }
    }

Loading