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

Commit 9a11271e authored by Chi Zhang's avatar Chi Zhang Committed by Gerrit Code Review
Browse files

Merge "Add more data stall recovery info"

parents bc6f5ae3 18e7897c
Loading
Loading
Loading
Loading
+41 −1
Original line number Diff line number Diff line
@@ -4973,6 +4973,14 @@ public class DcTracker extends Handler {
        private long mTimeLastRecoveryStartMs;
        // Whether current network good or not
        private boolean mIsValidNetwork;
        // Whether data stall happened or not.
        private boolean mWasDataStall;
        // Whether the result of last action(RADIO_RESTART) reported.
        private boolean mLastActionReported;
        // The real time for data stall start.
        private long mDataStallStartMs;
        // Last data stall action.
        private @RecoveryAction int mLastAction;

        public DataStallRecoveryHandler() {
            reset();
@@ -4983,6 +4991,36 @@ public class DcTracker extends Handler {
            putRecoveryAction(RECOVERY_ACTION_GET_DATA_CALL_LIST);
        }

        private void setNetworkValidationState(boolean isValid) {
            // Validation status is true and was not data stall.
            if (isValid && !mWasDataStall) {
                return;
            }

            if (!mWasDataStall) {
                mWasDataStall = true;
                mDataStallStartMs = SystemClock.elapsedRealtime();
                if (DBG) log("data stall: start time = " + mDataStallStartMs);
                return;
            }

            if (!mLastActionReported) {
                int timeDuration = (int) (SystemClock.elapsedRealtime() - mDataStallStartMs);
                if (DBG) {
                    log("data stall: lastaction = " + mLastAction + ", isRecovered = "
                            + isValid + ", mTimeDuration = " + timeDuration);
                }
                DataStallRecoveryStats.onDataStallEvent(mLastAction, mPhone, isValid,
                                                        timeDuration);
                mLastActionReported = true;
            }

            if (isValid) {
                mLastActionReported = false;
                mWasDataStall = false;
            }
        }

        public boolean isAggressiveRecovery() {
            @RecoveryAction int action = getRecoveryAction();

@@ -5059,7 +5097,8 @@ public class DcTracker extends Handler {
                        mPhone.getPhoneId(), signalStrength);
                TelephonyMetrics.getInstance().writeDataStallEvent(
                        mPhone.getPhoneId(), recoveryAction);
                DataStallRecoveryStats.onDataStallEvent(recoveryAction, mPhone);
                mLastAction = recoveryAction;
                mLastActionReported = false;
                broadcastDataStallDetected(recoveryAction);

                switch (recoveryAction) {
@@ -5103,6 +5142,7 @@ public class DcTracker extends Handler {
        }

        public void processNetworkStatusChanged(boolean isValid) {
            setNetworkValidationState(isValid);
            if (isValid) {
                mIsValidNetwork = true;
                reset();
+3 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class DataStallRecoveryStats {
     * @param phone
     */
    public static void onDataStallEvent(@DcTracker.RecoveryAction int recoveryAction,
            Phone phone) {
            Phone phone, boolean isRecovered, int durationMillis) {
        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
            phone = phone.getDefaultPhone();
        }
@@ -50,7 +50,8 @@ public class DataStallRecoveryStats {
        boolean isMultiSim = SimSlotState.getCurrentState().numActiveSims > 1;

        TelephonyStatsLog.write(TelephonyStatsLog.DATA_STALL_RECOVERY_REPORTED, carrierId, rat,
                signalStrength, recoveryAction, isOpportunistic, isMultiSim, band);
                signalStrength, recoveryAction, isOpportunistic, isMultiSim, band, isRecovered,
                durationMillis);
    }

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