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

Commit 5df1d21c authored by Willy Hu's avatar Willy Hu
Browse files

[DSRM] Store the duration of current action

- Add one more parameter to save the duration of current action
- Calculate the duration of current recovery action

Bug: 272415977
Test: Manual test passed.
Change-Id: Id41cdb64699dfc907ac5e22fedd6705a964d0dca
Merged-In: Id41cdb64699dfc907ac5e22fedd6705a964d0dca
parent cdda0a04
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -176,6 +176,8 @@ public class DataStallRecoveryManager extends Handler {
    private boolean mIsAttemptedAllSteps;
    /** Whether internet network connected. */
    private boolean mIsInternetNetworkConnected;
    /** The durations for current recovery action */
    private @ElapsedRealtimeLong long mTimeElapsedOfCurrentAction;

    /** The array for the timers between recovery actions. */
    private @NonNull long[] mDataStallRecoveryDelayMillisArray;
@@ -468,6 +470,15 @@ public class DataStallRecoveryManager extends Handler {
        return (SystemClock.elapsedRealtime() - mTimeLastRecoveryStartMs);
    }

    /**
     * Get duration time for current recovery action.
     *
     * @return the time duration for current recovery action.
     */
    private long getDurationOfCurrentRecoveryMs() {
        return (SystemClock.elapsedRealtime() - mTimeElapsedOfCurrentAction);
    }

    /**
     * Broadcast intent when data stall occurred.
     *
@@ -595,6 +606,7 @@ public class DataStallRecoveryManager extends Handler {
    private void setNetworkValidationState(boolean isValid) {
        boolean isLogNeeded = false;
        int timeDuration = 0;
        int timeDurationOfCurrentAction = 0;
        boolean isFirstDataStall = false;
        boolean isFirstValidationAfterDoRecovery = false;
        @RecoveredReason int reason = getRecoveredReason(isValid);
@@ -627,9 +639,11 @@ public class DataStallRecoveryManager extends Handler {
        }

        if (isLogNeeded) {
            timeDurationOfCurrentAction =
                (isFirstDataStall == true ? 0 : (int) getDurationOfCurrentRecoveryMs());
            DataStallRecoveryStats.onDataStallEvent(
                    mLastAction, mPhone, isValid, timeDuration, reason,
                    isFirstValidationAfterDoRecovery);
                    isFirstValidationAfterDoRecovery, timeDurationOfCurrentAction);
            logl(
                    "data stall: "
                    + (isFirstDataStall == true ? "start" : isValid == false ? "in process" : "end")
@@ -642,7 +656,9 @@ public class DataStallRecoveryManager extends Handler {
                    + ", isFirstValidationAfterDoRecovery="
                    + isFirstValidationAfterDoRecovery
                    + ", TimeDuration="
                    + timeDuration);
                    + timeDuration
                    + ", TimeDurationForCurrentRecoveryAction="
                    + timeDurationOfCurrentAction);
        }
    }

@@ -693,6 +709,7 @@ public class DataStallRecoveryManager extends Handler {
        mLastActionReported = false;
        broadcastDataStallDetected(recoveryAction);
        mNetworkCheckTimerStarted = false;
        mTimeElapsedOfCurrentAction = SystemClock.elapsedRealtime();

        switch (recoveryAction) {
            case RECOVERY_ACTION_GET_DATA_CALL_LIST:
+7 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public class DataStallRecoveryStats {
                .REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
        boolean isFirstValidation = false;
        int phoneId = 0;
        int durationMillisOfCurrentAction = 0;
        TelephonyStatsLog.write(
                TelephonyStatsLog.DATA_STALL_RECOVERY_REPORTED,
                carrierId,
@@ -89,7 +90,8 @@ public class DataStallRecoveryStats {
                otherNetworkRegState,
                phoneNetworkRegState,
                isFirstValidation,
                phoneId);
                phoneId,
                durationMillisOfCurrentAction);
    }

    /**
@@ -108,7 +110,8 @@ public class DataStallRecoveryStats {
            boolean isRecovered,
            int durationMillis,
            @DataStallRecoveryManager.RecoveredReason int reason,
            boolean isFirstValidation) {
            boolean isFirstValidation,
            int durationMillisOfCurrentAction) {
        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            phone = phone.getDefaultPhone();
        }
@@ -163,7 +166,8 @@ public class DataStallRecoveryStats {
                otherNetworkRegState,
                phoneNetworkRegState,
                isFirstValidation,
                phoneId);
                phoneId,
                durationMillisOfCurrentAction);
    }

    /** Returns the RAT used for data (including IWLAN). */