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

Commit 5a27a4c6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add more data stall recovery info" into sc-dev

parents 424dcb46 305b7201
Loading
Loading
Loading
Loading
+41 −1
Original line number Diff line number Diff line
@@ -4888,6 +4888,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();
@@ -4898,6 +4906,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();

@@ -4974,7 +5012,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) {
@@ -5016,6 +5055,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). */