Class ShadowTrafficStats

java.lang.Object
org.robolectric.shadows.ShadowTrafficStats

@Implements(android.net.TrafficStats.class) public class ShadowTrafficStats extends Object
  • Constructor Details

    • ShadowTrafficStats

      public ShadowTrafficStats()
  • Method Details

    • setThreadStatsTag

      @Implementation protected static void setThreadStatsTag(int tag)
    • getThreadStatsTag

      @Implementation protected static int getThreadStatsTag()
    • clearThreadStatsTag

      @Implementation protected static void clearThreadStatsTag()
    • tagSocket

      @Implementation protected static void tagSocket(Socket socket) throws SocketException
      Throws:
      SocketException
    • tagDatagramSocket

      @Implementation(minSdk=24) protected static void tagDatagramSocket(DatagramSocket socket) throws SocketException
      No-op in tests.
      Throws:
      SocketException
    • untagSocket

      @Implementation protected static void untagSocket(Socket socket) throws SocketException
      Throws:
      SocketException
    • incrementOperationCount

      @Implementation protected static void incrementOperationCount(int operationCount)
    • incrementOperationCount

      @Implementation protected static void incrementOperationCount(int tag, int operationCount)
    • getMobileTxPackets

      @Implementation protected static long getMobileTxPackets()
    • getMobileRxPackets

      @Implementation protected static long getMobileRxPackets()
    • getMobileTxBytes

      @Implementation protected static long getMobileTxBytes()
    • getMobileRxBytes

      @Implementation protected static long getMobileRxBytes()
    • getTotalTxPackets

      @Implementation protected static long getTotalTxPackets()
    • getTotalRxPackets

      @Implementation protected static long getTotalRxPackets()
    • getTotalTxBytes

      @Implementation protected static long getTotalTxBytes()
    • getTotalRxBytes

      @Implementation protected static long getTotalRxBytes()
    • getUidTxBytes

      @Implementation protected static long getUidTxBytes(int i)
    • getUidRxBytes

      @Implementation protected static long getUidRxBytes(int i)
    • getUidTxPackets

      @Implementation protected static long getUidTxPackets(int i)
    • getUidRxPackets

      @Implementation protected static long getUidRxPackets(int i)
    • getUidTcpTxBytes

      @Implementation protected static long getUidTcpTxBytes(int i)
    • getUidTcpRxBytes

      @Implementation protected static long getUidTcpRxBytes(int i)
    • getUidUdpTxBytes

      @Implementation protected static long getUidUdpTxBytes(int i)
    • getUidUdpRxBytes

      @Implementation protected static long getUidUdpRxBytes(int i)
    • getUidTcpTxSegments

      @Implementation protected static long getUidTcpTxSegments(int i)
    • getUidTcpRxSegments

      @Implementation protected static long getUidTcpRxSegments(int i)
    • getUidUdpTxPackets

      @Implementation protected static long getUidUdpTxPackets(int i)
    • getUidUdpRxPackets

      @Implementation protected static long getUidUdpRxPackets(int i)
    • setMobileTxPackets

      public static void setMobileTxPackets(int mobileTxPackets)
      Sets the value returned by getMobileTxPackets() for testing
    • setMobileRxPackets

      public static void setMobileRxPackets(int mobileRxPackets)
      Sets the value returned by getMobileRxPackets() for testing
    • setMobileTxBytes

      public static void setMobileTxBytes(int mobileTxBytes)
      Sets the value returned by getMobileTxBytes() for testing
    • setMobileRxBytes

      public static void setMobileRxBytes(int mobileRxBytes)
      Sets the value returned by getMobileRxBytes() for testing
    • setTotalTxPackets

      public static void setTotalTxPackets(int totalTxPackets)
      Sets the value returned by getTotalTxPackets() for testing
    • setTotalRxPackets

      public static void setTotalRxPackets(int totalRxPackets)
      Sets the value returned by getTotalRxPackets() for testing
    • setTotalTxBytes

      public static void setTotalTxBytes(int totalTxBytes)
      Sets the value returned by getTotalTxBytes() for testing
    • setTotalRxBytes

      public static void setTotalRxBytes(int totalRxBytes)
      Sets the value returned by getTotalRxBytes() for testing
    • restoreDefaults

      @Resetter public static void restoreDefaults()
      Updates all non UID specific fields back to TrafficStats.UNSUPPORTED