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

Commit d646dda1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Cap BW estimation sample by per-RAT static BW" into sc-qpr1-dev am: 81f65cc7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15749347

Change-Id: I79dc26e24d241f16ef8a5384b19deee45ff490b6
parents 70863971 81f65cc7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ public class LinkBandwidthEstimator extends Handler {
    // Used to derive byte count threshold from avg BW
    private static final int LOW_BW_TO_AVG_BW_RATIO_NUM = 3;
    private static final int LOW_BW_TO_AVG_BW_RATIO_DEN = 8;
    private static final int MAX_BW_TO_STATIC_BW_RATIO = 15;
    private static final int BYTE_DELTA_THRESHOLD_MIN_KB = 10;
    private static final int MAX_ERROR_PERCENT = 100 * 100;
    private static final String[] AVG_BW_PER_RAT = {
@@ -606,7 +607,8 @@ public class LinkBandwidthEstimator extends Handler {
                return;
            }
            long linkBandwidthLongKbps = bytesDelta * 8 / timeDeltaMs * 1000 / 1024;
            if (linkBandwidthLongKbps > Integer.MAX_VALUE || linkBandwidthLongKbps < 0) {
            if (linkBandwidthLongKbps > (long) mStaticBwKbps * MAX_BW_TO_STATIC_BW_RATIO
                    || linkBandwidthLongKbps < 0) {
                return;
            }
            int linkBandwidthKbps = (int) linkBandwidthLongKbps;
+5 −4
Original line number Diff line number Diff line
@@ -634,7 +634,7 @@ public class LinkBandwidthEstimatorTest extends TelephonyTest {


    @Test
    public void testVeryHighByteCountReturnNonNegativeValue() throws Exception {
    public void testVeryHighRxLinkBandwidthEstimationIgnored() throws Exception {
        mLBE.obtainMessage(MSG_SCREEN_STATE_CHANGED, true).sendToTarget();
        processAllMessages();
        mLBE.obtainMessage(MSG_SIGNAL_STRENGTH_CHANGED, mSignalStrength).sendToTarget();
@@ -650,11 +650,12 @@ public class LinkBandwidthEstimatorTest extends TelephonyTest {
            processAllMessages();
        }

        // This will result in link bandwidth estimation value 128Gbps which is too high for LTE.
        // So it will be ignored by the estimator.
        LinkBandwidthEstimator.NetworkBandwidth network = mLBE.lookupNetwork("310260", 366, "LTE");

        assertEquals(BW_STATS_COUNT_THRESHOLD + 4, network.getCount(LINK_RX, 1));
        assertEquals(0, network.getCount(LINK_RX, 1));
        assertEquals(0, network.getValue(LINK_TX, 1));
        assertEquals(16_000_000_000L * 8 / 1024 * (BW_STATS_COUNT_THRESHOLD + 4),
                network.getValue(LINK_RX, 1));
        assertEquals(0, network.getValue(LINK_RX, 1));
    }
}