Package org.robolectric.shadows
Class ShadowTrafficStats
java.lang.Object
org.robolectric.shadows.ShadowTrafficStats
@Implements(android.net.TrafficStats.class) public class ShadowTrafficStats extends Object
-
Constructor Summary
Constructors Constructor Description ShadowTrafficStats()
-
Method Summary
Modifier and Type Method Description protected static void
clearThreadStatsTag()
protected static long
getMobileRxBytes()
protected static long
getMobileRxPackets()
protected static long
getMobileTxBytes()
protected static long
getMobileTxPackets()
protected static int
getThreadStatsTag()
protected static long
getTotalRxBytes()
protected static long
getTotalRxPackets()
protected static long
getTotalTxBytes()
protected static long
getTotalTxPackets()
protected static long
getUidRxBytes(int i)
protected static long
getUidRxPackets(int i)
protected static long
getUidTcpRxBytes(int i)
protected static long
getUidTcpRxSegments(int i)
protected static long
getUidTcpTxBytes(int i)
protected static long
getUidTcpTxSegments(int i)
protected static long
getUidTxBytes(int i)
protected static long
getUidTxPackets(int i)
protected static long
getUidUdpRxBytes(int i)
protected static long
getUidUdpRxPackets(int i)
protected static long
getUidUdpTxBytes(int i)
protected static long
getUidUdpTxPackets(int i)
protected static void
incrementOperationCount(int operationCount)
protected static void
incrementOperationCount(int tag, int operationCount)
static void
restoreDefaults()
Updates all non UID specific fields back toTrafficStats.UNSUPPORTED
static void
setMobileRxBytes(int mobileRxBytes)
Sets the value returned bygetMobileRxBytes()
for testingstatic void
setMobileRxPackets(int mobileRxPackets)
Sets the value returned bygetMobileRxPackets()
for testingstatic void
setMobileTxBytes(int mobileTxBytes)
Sets the value returned bygetMobileTxBytes()
for testingstatic void
setMobileTxPackets(int mobileTxPackets)
Sets the value returned bygetMobileTxPackets()
for testingprotected static void
setThreadStatsTag(int tag)
static void
setTotalRxBytes(int totalRxBytes)
Sets the value returned bygetTotalRxBytes()
for testingstatic void
setTotalRxPackets(int totalRxPackets)
Sets the value returned bygetTotalRxPackets()
for testingstatic void
setTotalTxBytes(int totalTxBytes)
Sets the value returned bygetTotalTxBytes()
for testingstatic void
setTotalTxPackets(int totalTxPackets)
Sets the value returned bygetTotalTxPackets()
for testingprotected static void
tagDatagramSocket(DatagramSocket socket)
No-op in tests.protected static void
tagSocket(Socket socket)
protected static void
untagSocket(Socket socket)
-
Constructor Details
-
ShadowTrafficStats
public ShadowTrafficStats()
-
-
Method Details
-
setThreadStatsTag
-
getThreadStatsTag
-
clearThreadStatsTag
-
tagSocket
- Throws:
SocketException
-
tagDatagramSocket
@Implementation(minSdk=24) protected static void tagDatagramSocket(DatagramSocket socket) throws SocketExceptionNo-op in tests.- Throws:
SocketException
-
untagSocket
- Throws:
SocketException
-
incrementOperationCount
-
incrementOperationCount
-
getMobileTxPackets
-
getMobileRxPackets
-
getMobileTxBytes
-
getMobileRxBytes
-
getTotalTxPackets
-
getTotalRxPackets
-
getTotalTxBytes
-
getTotalRxBytes
-
getUidTxBytes
-
getUidRxBytes
-
getUidTxPackets
-
getUidRxPackets
-
getUidTcpTxBytes
-
getUidTcpRxBytes
-
getUidUdpTxBytes
-
getUidUdpRxBytes
-
getUidTcpTxSegments
-
getUidTcpRxSegments
-
getUidUdpTxPackets
-
getUidUdpRxPackets
-
setMobileTxPackets
public static void setMobileTxPackets(int mobileTxPackets)Sets the value returned bygetMobileTxPackets()
for testing -
setMobileRxPackets
public static void setMobileRxPackets(int mobileRxPackets)Sets the value returned bygetMobileRxPackets()
for testing -
setMobileTxBytes
public static void setMobileTxBytes(int mobileTxBytes)Sets the value returned bygetMobileTxBytes()
for testing -
setMobileRxBytes
public static void setMobileRxBytes(int mobileRxBytes)Sets the value returned bygetMobileRxBytes()
for testing -
setTotalTxPackets
public static void setTotalTxPackets(int totalTxPackets)Sets the value returned bygetTotalTxPackets()
for testing -
setTotalRxPackets
public static void setTotalRxPackets(int totalRxPackets)Sets the value returned bygetTotalRxPackets()
for testing -
setTotalTxBytes
public static void setTotalTxBytes(int totalTxBytes)Sets the value returned bygetTotalTxBytes()
for testing -
setTotalRxBytes
public static void setTotalRxBytes(int totalRxBytes)Sets the value returned bygetTotalRxBytes()
for testing -
restoreDefaults
Updates all non UID specific fields back toTrafficStats.UNSUPPORTED
-