package org.robolectric.shadows;

import android.net.TrafficStats;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

@Implements(TrafficStats.class)
public class ShadowTrafficStats {

  @Implementation
  protected static void setThreadStatsTag(int tag) {
  }

  @Implementation
  protected static int getThreadStatsTag() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static void clearThreadStatsTag() {
  }

  @Implementation
  protected static void tagSocket(java.net.Socket socket) throws java.net.SocketException {
  }

  @Implementation
  protected static void untagSocket(java.net.Socket socket) throws java.net.SocketException {
  }

  @Implementation
  protected static void incrementOperationCount(int operationCount) {
  }

  @Implementation
  protected static void incrementOperationCount(int tag, int operationCount) {
  }

  @Implementation
  protected static long getMobileTxPackets() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getMobileRxPackets() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getMobileTxBytes() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getMobileRxBytes() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getTotalTxPackets() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getTotalRxPackets() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getTotalTxBytes() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getTotalRxBytes() {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidTxBytes(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidRxBytes(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidTxPackets(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidRxPackets(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidTcpTxBytes(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidTcpRxBytes(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidUdpTxBytes(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidUdpRxBytes(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidTcpTxSegments(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidTcpRxSegments(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidUdpTxPackets(int i) {
    return TrafficStats.UNSUPPORTED;
  }

  @Implementation
  protected static long getUidUdpRxPackets(int i) {
    return TrafficStats.UNSUPPORTED;
  }
}


@@ -60,16 +60,41 @@
 cStats;%0A
+import android.os.Build;%0A
 import o
@@ -319,19 +319,16 @@
 t tag) %7B
-%0A  
 %7D%0A%0A  @Im
@@ -492,19 +492,16 @@
 sTag() %7B
-%0A  
 %7D%0A%0A  @Im
@@ -596,35 +596,220 @@
 ocketException %7B
+%7D%0A
 %0A  
+/** No-op in tests. */%0A  @Implementation(minSdk = Build.VERSION_CODES.N)%0A  public static void tagDatagramSocket(java.net.DatagramSocket socket)%0A      throws java.net.SocketException %7B
 %7D%0A%0A  @Implementa
@@ -906,19 +906,16 @@
 eption %7B
-%0A  
 %7D%0A%0A  @Im
@@ -988,35 +988,32 @@
 perationCount) %7B
-%0A  
 %7D%0A%0A  @Implementa
@@ -1095,19 +1095,16 @@
 Count) %7B
-%0A  
 %7D%0A%0A  @Im
@@ -3265,9 +3265,8 @@
 ;%0A  %7D%0A%7D%0A
-%0A

Add tagDatagramSocket in ShadowTrafficStats.