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

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

Cleaned up the flag dsrs_diagnostics_enabled

Cleaned up the 24Q3 flag dsrs_diagnostics_enabled.

Test: atest FrameworksTelephonyTests
Test: Basic telephony functionality tests
Bug: 319601607
Flag: EXEMPT flag cleanup
Change-Id: I36459f736590125b3481119061185d999919631e
parent 3de51440
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -41,14 +41,6 @@ flag {
  bug:"286171724"
}

# OWNER=jackyu TARGET=24Q3
flag {
  name: "dsrs_diagnostics_enabled"
  namespace: "telephony"
  description: "Enable DSRS diagnostics."
  bug: "319601607"
}

# OWNER=jackyu TARGET=24Q3
flag {
  name: "data_rat_metric_enabled"
+7 −13
Original line number Diff line number Diff line
@@ -571,16 +571,12 @@ public class DataStallRecoveryManager extends Handler {
    private void onInternetValidationStatusChanged(@ValidationStatus int status) {
        logl("onInternetValidationStatusChanged: " + DataUtils.validationStatusToString(status));
        final boolean isValid = status == NetworkAgent.VALIDATION_STATUS_VALID;
        if (mFeatureFlags.dsrsDiagnosticsEnabled()) {
        mValidationCount += 1;
        mActionValidationCount += 1;
        }
        setNetworkValidationState(isValid);
        if (isValid) {
            if (mFeatureFlags.dsrsDiagnosticsEnabled()) {
            // Broadcast intent that data stall recovered.
            broadcastDataStallDetected(mLastAction);
            }
            reset();
        } else if (isRecoveryNeeded(true)) {
            // Set the network as invalid, because recovery is needed
@@ -620,7 +616,7 @@ public class DataStallRecoveryManager extends Handler {
    @VisibleForTesting
    public void setRecoveryAction(@RecoveryAction int action) {
        // Reset the validation count for action change
        if (mFeatureFlags.dsrsDiagnosticsEnabled() && mRecoveryAction != action) {
        if (mRecoveryAction != action) {
            mActionValidationCount = 0;
        }
        mRecoveryAction = action;
@@ -702,10 +698,8 @@ public class DataStallRecoveryManager extends Handler {
        final int duration = (int) (SystemClock.elapsedRealtime() - mDataStallStartMs);
        @RecoveredReason final int reason = getRecoveredReason(mIsValidNetwork);
        final int durationOfAction = (int) getDurationOfCurrentRecoveryMs();
        if (mFeatureFlags.dsrsDiagnosticsEnabled()) {
        log("mValidationCount=" + mValidationCount
                + ", mActionValidationCount=" + mActionValidationCount);
        }

        // Get the bundled DSRS stats.
        Bundle bundle = mStats.getDataStallRecoveryMetricsData(
+77 −110
Original line number Diff line number Diff line
@@ -89,9 +89,6 @@ public class DataStallRecoveryStats {
    private final @NonNull TelephonyManager mTelephonyManager;
    private final @NonNull FeatureFlags mFeatureFlags;

    // Flag to control the DSRS diagnostics
    private final boolean mIsDsrsDiagnosticsEnabled;

    // The interface name of the internet network.
    private @Nullable String mIfaceName = null;

@@ -172,8 +169,6 @@ public class DataStallRecoveryStats {
                }
            });

        mIsDsrsDiagnosticsEnabled = mFeatureFlags.dsrsDiagnosticsEnabled();
        if (mIsDsrsDiagnosticsEnabled) {
        try {
            // Register ConnectivityDiagnosticsCallback to get diagnostics states
            mConnectivityDiagnosticsManager =
@@ -210,7 +205,6 @@ public class DataStallRecoveryStats {
            mConnectivityDiagnosticsCallback = null;
        }
    }
    }

    /**
     * Create and push new atom when there is a data stall recovery event.
@@ -293,7 +287,6 @@ public class DataStallRecoveryStats {
        mPhoneId = mPhone.getPhoneId() + 1;
        mCarrierId = mPhone.getCarrierId();
        mSignalStrength = mPhone.getSignalStrength().getLevel();
        if (mIsDsrsDiagnosticsEnabled) {
        // Get the MCCMNC and convert it to an int
        String networkOperator = mTelephonyManager.getNetworkOperator();
        if (!TextUtils.isEmpty(networkOperator)) {
@@ -306,7 +299,6 @@ public class DataStallRecoveryStats {
        } else {
            mConvertedMccMnc = -1;
        }
        }

        // Update the bandwidth.
        updateBandwidths();
@@ -430,7 +422,6 @@ public class DataStallRecoveryStats {
            int actionValidationCount,
            int durationOfAction) {

        if (mIsDsrsDiagnosticsEnabled) {
        // Refresh data if the data has not been updated within 3 minutes
        final long refreshDuration = SystemClock.elapsedRealtime() - mMetricsReflashTime;
        if (refreshDuration > REFRESH_DURATION_IN_MILLIS) {
@@ -441,11 +432,9 @@ public class DataStallRecoveryStats {
                loge("The metrics data cannot be refreshed.", e);
            }
        }
        }

        Bundle bundle = new Bundle();

        if (mIsDsrsDiagnosticsEnabled) {
        bundle.putInt("Action", action);
        bundle.putInt("IsRecovered", isRecovered ? 1 : 0);
        bundle.putInt("Duration", duration);
@@ -473,28 +462,6 @@ public class DataStallRecoveryStats {
        bundle.putInt("TcpMetricsCollectionPeriodMillis", mTcpMetricsCollectionPeriodMillis);
        bundle.putInt("TcpPacketFailRate", mTcpPacketFailRate);
        bundle.putInt("DnsConsecutiveTimeouts", mDnsConsecutiveTimeouts);
        } else {
            bundle.putInt("Action", action);
            bundle.putBoolean("IsRecovered", isRecovered);
            bundle.putInt("Duration", duration);
            bundle.putInt("Reason", reason);
            bundle.putBoolean("IsFirstValidation", validationCount == 1);
            bundle.putInt("DurationOfAction", durationOfAction);
            bundle.putInt("PhoneId", mPhoneId);
            bundle.putInt("CarrierId", mCarrierId);
            bundle.putInt("SignalStrength", mSignalStrength);
            bundle.putInt("Band", mBand);
            bundle.putInt("Rat", mRat);
            bundle.putBoolean("IsOpportunistic", mIsOpportunistic);
            bundle.putBoolean("IsMultiSim", mIsMultiSim);
            bundle.putInt("NetworkRegState", mNetworkRegState);
            bundle.putInt("OtherSignalStrength", mOtherSignalStrength);
            bundle.putInt("OtherNetworkRegState", mOtherNetworkRegState);
            bundle.putInt("InternetLinkStatus", mInternetLinkStatus);
            bundle.putInt("LinkDownBandwidthKbps", mLinkDownBandwidthKbps);
            bundle.putInt("LinkUpBandwidthKbps", mLinkUpBandwidthKbps);
        }

        return bundle;
    }

+2 −9
Original line number Diff line number Diff line
@@ -91,7 +91,6 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {
        Field field = DataStallRecoveryManager.class.getDeclaredField("mPredictWaitingMillis");
        field.setAccessible(true);

        doReturn(true).when(mFeatureFlags).dsrsDiagnosticsEnabled();
        mFakeContentResolver = new FakeContentResolver();
        doReturn(mFakeContentResolver).when(mContext).getContentResolver();
        // Set the global settings for action enabled state and duration to
@@ -433,7 +432,6 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {
    @Test
    public void testSendDSRMData() throws Exception {
        ArgumentCaptor<Intent> captorIntent = ArgumentCaptor.forClass(Intent.class);
        boolean isDsrsDiagnosticsEnabled = mFeatureFlags.dsrsDiagnosticsEnabled();

        logd("Set phone status to normal status.");
        sendOnInternetDataNetworkCallback(true);
@@ -465,13 +463,8 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {
            logd(bundle.toString());
            int size = bundle.size();
            logd("bundle size is " + size);
            if (isDsrsDiagnosticsEnabled) {
            // Check if bundle size is 27
            assertThat(size).isEqualTo(27);
            } else {
                // Check if bundle size is 19
                assertThat(size).isEqualTo(19);
            }
        }
    }