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

Commit f81dce0f authored by Luke Huang's avatar Luke Huang Committed by android-build-merger
Browse files

Merge "Refactor tetherGetStats by using stable aidl structure"

am: 335253df

Change-Id: Ibaefeee3e115cc04163f1b07cdba148f9e9ab3b5
parents 7886cfcf 335253df
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -691,6 +691,7 @@ java_defaults {
        "android.hardware.radio-V1.0-java",
        "android.hardware.radio-V1.3-java",
        "android.hardware.usb.gadget-V1.0-java",
        "netd_aidl_interface-java",
    ],

    // Loaded with System.loadLibrary by android.view.textclassifier
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ java_library_static {
        "android.hardware.configstore-V1.0-java",
        "android.hardware.contexthub-V1.0-java",
        "android.hidl.manager-V1.0-java",
        "netd_aidl_interface-java",
    ],
}

+11 −11
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.INetd;
import android.net.TetherStatsParcel;
import android.net.INetworkManagementEventObserver;
import android.net.ITetheringStatsProvider;
import android.net.InterfaceConfiguration;
@@ -1839,31 +1840,30 @@ public class NetworkManagementService extends INetworkManagementService.Stub
                return new NetworkStats(SystemClock.elapsedRealtime(), 0);
            }

            final PersistableBundle bundle;
            final TetherStatsParcel[] tetherStatsVec;
            try {
                bundle = mNetdService.tetherGetStats();
                tetherStatsVec = mNetdService.tetherGetStats();
            } catch (RemoteException | ServiceSpecificException e) {
                throw new IllegalStateException("problem parsing tethering stats: ", e);
            }

            final NetworkStats stats = new NetworkStats(SystemClock.elapsedRealtime(),
                    bundle.size());
                tetherStatsVec.length);
            final NetworkStats.Entry entry = new NetworkStats.Entry();

            for (String iface : bundle.keySet()) {
                long[] statsArray = bundle.getLongArray(iface);
            for (TetherStatsParcel tetherStats : tetherStatsVec) {
                try {
                    entry.iface = iface;
                    entry.iface = tetherStats.iface;
                    entry.uid = UID_TETHERING;
                    entry.set = SET_DEFAULT;
                    entry.tag = TAG_NONE;
                    entry.rxBytes   = statsArray[INetd.TETHER_STATS_RX_BYTES];
                    entry.rxPackets = statsArray[INetd.TETHER_STATS_RX_PACKETS];
                    entry.txBytes   = statsArray[INetd.TETHER_STATS_TX_BYTES];
                    entry.txPackets = statsArray[INetd.TETHER_STATS_TX_PACKETS];
                    entry.rxBytes   = tetherStats.rxBytes;
                    entry.rxPackets = tetherStats.rxPackets;
                    entry.txBytes   = tetherStats.txBytes;
                    entry.txPackets = tetherStats.txPackets;
                    stats.combineValues(entry);
                } catch (ArrayIndexOutOfBoundsException e) {
                    throw new IllegalStateException("invalid tethering stats for " + iface, e);
                    throw new IllegalStateException("invalid tethering stats " + e);
                }
            }

+4 −2
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ LOCAL_JNI_SHARED_LIBRARIES := \
    libunwindstack \
    libutilscallstack \
    libziparchive \
    libz
    libz \
    netd_aidl_interface-cpp

LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk

@@ -92,7 +93,8 @@ LOCAL_SHARED_LIBRARIES := \
  liblog \
  libcutils \
  libnativehelper \
  libnetdaidl
  libnetdaidl \
  netd_aidl_interface-cpp

LOCAL_STATIC_LIBRARIES := \
  libpcap \