public boolean isConnectionMetered() { if (mNoNetworkPermission) { return false; } return ConnectivityManagerCompat.isActiveNetworkMetered(mConnectivityManager); }
@Override public boolean isActiveNetworkMetered(ConnectivityManager cm) { return ConnectivityManagerCompatGingerbread.isActiveNetworkMetered(cm); } }
@Override public boolean isActiveNetworkMetered(ConnectivityManager cm) { return ConnectivityManagerCompatJellyBean.isActiveNetworkMetered(cm); } }
@Override public void incrementOperationCount(int tag, int operationCount) { TrafficStatsCompatIcs.incrementOperationCount(tag, operationCount); }
/** * Increment count of network operations performed under the accounting tag * currently active on the calling thread. This can be used to derive * bytes-per-operation. * * @param operationCount Number of operations to increment count by. */ public static void incrementOperationCount(int operationCount) { IMPL.incrementOperationCount(operationCount); }
@Override protected SocketTags initialValue() { return new SocketTags(); } };
@Override public void tagSocket(Socket socket) throws SocketException { TrafficStatsCompatIcs.tagSocket(socket); }
/** * Clear active tag used when accounting {@link Socket} traffic originating * from the current thread. */ public static void clearThreadStatsTag() { IMPL.clearThreadStatsTag(); }
@Override public boolean isActiveNetworkMetered(ConnectivityManager cm) { return ConnectivityManagerCompatHoneycombMR2.isActiveNetworkMetered(cm); } }
@Override public void untagSocket(Socket socket) throws SocketException { TrafficStatsCompatIcs.untagSocket(socket); } }
/** * Get the active tag used when accounting {@link Socket} traffic originating * from the current thread. Only one active tag per thread is supported. * {@link #tagSocket(Socket)}. */ public static int getThreadStatsTag() { return IMPL.getThreadStatsTag(); }
/** * Remove any statistics parameters from the given {@link Socket}. */ public static void untagSocket(Socket socket) throws SocketException { IMPL.untagSocket(socket); } }
@Override public void clearThreadStatsTag() { TrafficStatsCompatIcs.clearThreadStatsTag(); }
@Override public int getThreadStatsTag() { return TrafficStatsCompatIcs.getThreadStatsTag(); }
/** * Returns if the currently active data network is metered. A network is * classified as metered when the user is sensitive to heavy data usage on * that connection. You should check this before doing large data transfers, * and warn the user or delay the operation until another network is * available. */ public static boolean isActiveNetworkMetered(ConnectivityManager cm) { return IMPL.isActiveNetworkMetered(cm); }
/** * Tag the given {@link Socket} with any statistics parameters active for * the current thread. Subsequent calls always replace any existing * parameters. When finished, call {@link #untagSocket(Socket)} to remove * statistics parameters. * * @see #setThreadStatsTag(int) */ public static void tagSocket(Socket socket) throws SocketException { IMPL.tagSocket(socket); }
/** Returns true if the currently active network is unmetered. */ private static boolean isNetworkUnmetered(ConnectivityManager connectivityManager) { return !ConnectivityManagerCompat.isActiveNetworkMetered(connectivityManager); } }
@Override public void incrementOperationCount(int operationCount) { TrafficStatsCompatIcs.incrementOperationCount(operationCount); }
/** * Increment count of network operations performed under the given * accounting tag. This can be used to derive bytes-per-operation. * * @param tag Accounting tag used in {@link #setThreadStatsTag(int)}. * @param operationCount Number of operations to increment count by. */ public static void incrementOperationCount(int tag, int operationCount) { IMPL.incrementOperationCount(tag, operationCount); }
boolean metered = ConnectivityManagerCompat.isActiveNetworkMetered(connectivityManager); if (!metered) { return JobRequest.NetworkType.UNMETERED;