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

Commit de386ed2 authored by Zhengyu Zhan's avatar Zhengyu Zhan Committed by Lili Lin
Browse files

Support Dual ViLTE stats

Some operator supports multiple VILTE,
both two SIM cards can make VILTE call.
We need to record VILTE data to different interface.
Now NetworkStatsService has only one VILTE data
interface: "vt_data0". All VILTE data stats will
be recorded in this interface.

Bug: 130871087
Test: NetworkStatsServiceTest#testDualVilteProviderStats
Change-Id: I1248b78e628bdf1f6b7bee360bdaecd283799c8e
parent 57ac4d56
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -4259,7 +4259,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        // the only thing we can do here is splitting the usage into half rx and half tx.
        // Uid -1 indicates this is for the overall device data usage.
        vtDataUsageSnapshot.combineValues(new NetworkStats.Entry(
                NetworkStats.IFACE_VT, -1, NetworkStats.SET_FOREGROUND,
                getVtInterface(), -1, NetworkStats.SET_FOREGROUND,
                NetworkStats.TAG_NONE, NetworkStats.METERED_YES, isRoaming,
                NetworkStats.DEFAULT_NETWORK_YES, delta / 2, 0, delta / 2, 0, 0));
        mVtDataUsageSnapshot = vtDataUsageSnapshot;
@@ -4282,12 +4282,17 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        // Since the modem only reports the total vt data usage rather than rx/tx separately,
        // the only thing we can do here is splitting the usage into half rx and half tx.
        vtDataUsageUidSnapshot.combineValues(new NetworkStats.Entry(
                NetworkStats.IFACE_VT, mDefaultDialerUid.get(),
                getVtInterface(), mDefaultDialerUid.get(),
                NetworkStats.SET_FOREGROUND, NetworkStats.TAG_NONE, NetworkStats.METERED_YES,
                isRoaming, NetworkStats.DEFAULT_NETWORK_YES, delta / 2, 0, delta / 2, 0, 0));
        mVtDataUsageUidSnapshot = vtDataUsageUidSnapshot;
    }

    @VisibleForTesting(visibility = PRIVATE)
    public String getVtInterface() {
        return NetworkStats.IFACE_VT + mPhone.getSubId();
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @Override
    protected void log(String msg) {
+1 −1
Original line number Diff line number Diff line
@@ -1337,7 +1337,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {

        if (rxBytes != 0 || txBytes != 0) {
            expectedStats = expectedStats.addEntry(
                    new Entry(NetworkStats.IFACE_VT, UID_ALL, SET_FOREGROUND,
                    new Entry(mCTUT.getVtInterface(), UID_ALL, SET_FOREGROUND,
                            TAG_NONE, METERED_YES, ROAMING_NO, DEFAULT_NETWORK_YES, rxBytes, 0L,
                            txBytes, 0L, 0L));
        }