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

Commit c66be4d0 authored by Junyu Lai's avatar Junyu Lai Committed by Automerger Merge Worker
Browse files

Merge changes Ib048c18b,Ie7694a63 am: 2963649f am: 76ba518d am: ac2fa455 am: 3d0da216

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1777887

Change-Id: I100b99df2cb67a7bf85c3d494234bf4f723524d3
parents f1e660fa 3d0da216
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -289,8 +289,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
    private String mActiveIface;

    /** Set of any ifaces associated with mobile networks since boot. */
    @GuardedBy("mStatsLock")
    private String[] mMobileIfaces = new String[0];
    private volatile String[] mMobileIfaces = new String[0];

    /** Set of all ifaces currently used by traffic that does not explicitly specify a Network. */
    @GuardedBy("mStatsLock")
@@ -935,7 +934,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {

    @Override
    public String[] getMobileIfaces() {
        return mMobileIfaces;
        // TODO (b/192758557): Remove debug log.
        if (ArrayUtils.contains(mMobileIfaces, null)) {
            throw new NullPointerException(
                    "null element in mMobileIfaces: " + Arrays.toString(mMobileIfaces));
        }
        return mMobileIfaces.clone();
    }

    @Override
@@ -1084,7 +1088,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
    }

    @Override
    public long getIfaceStats(String iface, int type) {
    public long getIfaceStats(@NonNull String iface, int type) {
        Objects.requireNonNull(iface);
        long nativeIfaceStats = nativeGetIfaceStat(iface, type, checkBpfStatsEnable());
        if (nativeIfaceStats == -1) {
            return nativeIfaceStats;
@@ -1382,7 +1387,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
            }
        }

        mMobileIfaces = mobileIfaces.toArray(new String[mobileIfaces.size()]);
        mMobileIfaces = mobileIfaces.toArray(new String[0]);
        // TODO (b/192758557): Remove debug log.
        if (ArrayUtils.contains(mMobileIfaces, null)) {
            throw new NullPointerException(
                    "null element in mMobileIfaces: " + Arrays.toString(mMobileIfaces));
        }
    }

    private static int getSubIdForMobile(@NonNull NetworkStateSnapshot state) {