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

Commit 5ba11026 authored by Jack Yu's avatar Jack Yu Committed by Android Partner Code Review
Browse files

Merge "Fixed data retry issues." into mm-wireless-dev

parents 6ffa56f5 7d6d7d6c
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
@@ -117,6 +117,7 @@ public class SimulatedCommands extends BaseCommands

    int mNextCallFailCause = CallFailCause.NORMAL_CLEARING;

    private boolean mDcSuccess = true;
    private DataCallResponse mDcResponse;

    //***** Constructor
@@ -149,7 +150,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"));
        }
    }

@@ -502,9 +503,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));
        }
    }

@@ -636,7 +636,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);
@@ -658,7 +658,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);
        }
@@ -680,7 +680,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);
        }
@@ -702,7 +702,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);
        }
@@ -723,7 +723,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);
        }
@@ -744,7 +744,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);
        }
@@ -763,7 +763,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);
        }
@@ -783,7 +783,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);
        }
@@ -802,7 +802,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);
        }
@@ -1109,8 +1109,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
@@ -1136,7 +1137,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
@@ -1607,9 +1612,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 {
@@ -1892,7 +1897,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