TrafficStatsCompat.java 4.87 KB
package android.support.v4.net;

import android.net.TrafficStats;
import android.os.Build.VERSION;
import android.os.ParcelFileDescriptor;
import dq;
import java.net.DatagramSocket;
import java.net.Socket;
import java.net.SocketException;

public final class TrafficStatsCompat
{
  private static final d a = new b();
  
  static
  {
    if ("N".equals(Build.VERSION.CODENAME))
    {
      a = new a();
      return;
    }
    if (Build.VERSION.SDK_INT >= 14)
    {
      a = new c();
      return;
    }
  }
  
  public static void clearThreadStatsTag()
  {
    a.a();
  }
  
  public static int getThreadStatsTag()
  {
    return a.b();
  }
  
  public static void incrementOperationCount(int paramInt)
  {
    a.a(paramInt);
  }
  
  public static void incrementOperationCount(int paramInt1, int paramInt2)
  {
    a.a(paramInt1, paramInt2);
  }
  
  public static void setThreadStatsTag(int paramInt)
  {
    a.b(paramInt);
  }
  
  public static void tagDatagramSocket(DatagramSocket paramDatagramSocket)
    throws SocketException
  {
    a.a(paramDatagramSocket);
  }
  
  public static void tagSocket(Socket paramSocket)
    throws SocketException
  {
    a.a(paramSocket);
  }
  
  public static void untagDatagramSocket(DatagramSocket paramDatagramSocket)
    throws SocketException
  {
    a.b(paramDatagramSocket);
  }
  
  public static void untagSocket(Socket paramSocket)
    throws SocketException
  {
    a.b(paramSocket);
  }
  
  static final class a
    extends TrafficStatsCompat.c
  {
    public final void a(DatagramSocket paramDatagramSocket)
      throws SocketException
    {
      TrafficStatsCompatApi24.tagDatagramSocket(paramDatagramSocket);
    }
    
    public final void b(DatagramSocket paramDatagramSocket)
      throws SocketException
    {
      TrafficStatsCompatApi24.untagDatagramSocket(paramDatagramSocket);
    }
  }
  
  static final class b
    implements TrafficStatsCompat.d
  {
    private ThreadLocal<a> a = new ThreadLocal() {};
    
    public final void a()
    {
      ((a)this.a.get()).a = -1;
    }
    
    public final void a(int paramInt) {}
    
    public final void a(int paramInt1, int paramInt2) {}
    
    public final void a(DatagramSocket paramDatagramSocket) {}
    
    public final void a(Socket paramSocket) {}
    
    public final int b()
    {
      return ((a)this.a.get()).a;
    }
    
    public final void b(int paramInt)
    {
      ((a)this.a.get()).a = paramInt;
    }
    
    public final void b(DatagramSocket paramDatagramSocket) {}
    
    public final void b(Socket paramSocket) {}
    
    static final class a
    {
      public int a = -1;
    }
  }
  
  static class c
    implements TrafficStatsCompat.d
  {
    public final void a() {}
    
    public final void a(int paramInt)
    {
      TrafficStats.incrementOperationCount(paramInt);
    }
    
    public final void a(int paramInt1, int paramInt2)
    {
      TrafficStats.incrementOperationCount(paramInt1, paramInt2);
    }
    
    public void a(DatagramSocket paramDatagramSocket)
      throws SocketException
    {
      ParcelFileDescriptor localParcelFileDescriptor = ParcelFileDescriptor.fromDatagramSocket(paramDatagramSocket);
      TrafficStats.tagSocket(new dq(paramDatagramSocket, localParcelFileDescriptor.getFileDescriptor()));
      localParcelFileDescriptor.detachFd();
    }
    
    public final void a(Socket paramSocket)
      throws SocketException
    {
      TrafficStats.tagSocket(paramSocket);
    }
    
    public final int b()
    {
      return TrafficStats.getThreadStatsTag();
    }
    
    public final void b(int paramInt)
    {
      TrafficStats.setThreadStatsTag(paramInt);
    }
    
    public void b(DatagramSocket paramDatagramSocket)
      throws SocketException
    {
      ParcelFileDescriptor localParcelFileDescriptor = ParcelFileDescriptor.fromDatagramSocket(paramDatagramSocket);
      TrafficStats.untagSocket(new dq(paramDatagramSocket, localParcelFileDescriptor.getFileDescriptor()));
      localParcelFileDescriptor.detachFd();
    }
    
    public final void b(Socket paramSocket)
      throws SocketException
    {
      TrafficStats.untagSocket(paramSocket);
    }
  }
  
  static abstract interface d
  {
    public abstract void a();
    
    public abstract void a(int paramInt);
    
    public abstract void a(int paramInt1, int paramInt2);
    
    public abstract void a(DatagramSocket paramDatagramSocket)
      throws SocketException;
    
    public abstract void a(Socket paramSocket)
      throws SocketException;
    
    public abstract int b();
    
    public abstract void b(int paramInt);
    
    public abstract void b(DatagramSocket paramDatagramSocket)
      throws SocketException;
    
    public abstract void b(Socket paramSocket)
      throws SocketException;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/net/TrafficStatsCompat.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */