Useful annotations for code documentation.
Bug: 6537978 Change-Id: I806c3c09e3255f8789455f13bf37c1dde2a93f1f
This commit is contained in:
@@ -21,6 +21,7 @@ import android.os.Parcelable;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.internal.util.Objects;
|
import com.android.internal.util.Objects;
|
||||||
|
|
||||||
@@ -190,14 +191,14 @@ public class NetworkStats implements Parcelable {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public NetworkStats addIfaceValues(
|
public NetworkStats addIfaceValues(
|
||||||
String iface, long rxBytes, long rxPackets, long txBytes, long txPackets) {
|
String iface, long rxBytes, long rxPackets, long txBytes, long txPackets) {
|
||||||
return addValues(
|
return addValues(
|
||||||
iface, UID_ALL, SET_DEFAULT, TAG_NONE, rxBytes, rxPackets, txBytes, txPackets, 0L);
|
iface, UID_ALL, SET_DEFAULT, TAG_NONE, rxBytes, rxPackets, txBytes, txPackets, 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public NetworkStats addValues(String iface, int uid, int set, int tag, long rxBytes,
|
public NetworkStats addValues(String iface, int uid, int set, int tag, long rxBytes,
|
||||||
long rxPackets, long txBytes, long txPackets, long operations) {
|
long rxPackets, long txBytes, long txPackets, long operations) {
|
||||||
return addValues(new Entry(
|
return addValues(new Entry(
|
||||||
@@ -269,7 +270,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public int internalSize() {
|
public int internalSize() {
|
||||||
return iface.length;
|
return iface.length;
|
||||||
}
|
}
|
||||||
@@ -335,7 +336,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
* Find first stats index that matches the requested parameters, starting
|
* Find first stats index that matches the requested parameters, starting
|
||||||
* search around the hinted index as an optimization.
|
* search around the hinted index as an optimization.
|
||||||
*/
|
*/
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public int findIndexHinted(String iface, int uid, int set, int tag, int hintIndex) {
|
public int findIndexHinted(String iface, int uid, int set, int tag, int hintIndex) {
|
||||||
for (int offset = 0; offset < size; offset++) {
|
for (int offset = 0; offset < size; offset++) {
|
||||||
final int halfOffset = offset / 2;
|
final int halfOffset = offset / 2;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import android.content.res.Resources;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.Objects;
|
import com.android.internal.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,7 +64,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
|
|
||||||
private static boolean sForceAllNetworkTypes = false;
|
private static boolean sForceAllNetworkTypes = false;
|
||||||
|
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public static void forceAllNetworkTypes() {
|
public static void forceAllNetworkTypes() {
|
||||||
sForceAllNetworkTypes = true;
|
sForceAllNetworkTypes = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.net.NetworkStats;
|
|||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.ProcFileReader;
|
import com.android.internal.util.ProcFileReader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -53,7 +54,7 @@ public class NetworkStatsFactory {
|
|||||||
this(new File("/proc/"));
|
this(new File("/proc/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public NetworkStatsFactory(File procRoot) {
|
public NetworkStatsFactory(File procRoot) {
|
||||||
mStatsXtIfaceAll = new File(procRoot, "net/xt_qtaguid/iface_stat_all");
|
mStatsXtIfaceAll = new File(procRoot, "net/xt_qtaguid/iface_stat_all");
|
||||||
mStatsXtIfaceFmt = new File(procRoot, "net/xt_qtaguid/iface_stat_fmt");
|
mStatsXtIfaceFmt = new File(procRoot, "net/xt_qtaguid/iface_stat_fmt");
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.os.SystemClock;
|
|||||||
import android.util.LocalLog;
|
import android.util.LocalLog;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.google.android.collect.Lists;
|
import com.google.android.collect.Lists;
|
||||||
|
|
||||||
import java.nio.charset.Charsets;
|
import java.nio.charset.Charsets;
|
||||||
@@ -400,7 +401,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
* Append the given argument to {@link StringBuilder}, escaping as needed,
|
* Append the given argument to {@link StringBuilder}, escaping as needed,
|
||||||
* and surrounding with quotes when it contains spaces.
|
* and surrounding with quotes when it contains spaces.
|
||||||
*/
|
*/
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
static void appendEscaped(StringBuilder builder, String arg) {
|
static void appendEscaped(StringBuilder builder, String arg) {
|
||||||
final boolean hasSpaces = arg.indexOf(' ') >= 0;
|
final boolean hasSpaces = arg.indexOf(' ') >= 0;
|
||||||
if (hasSpaces) {
|
if (hasSpaces) {
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ import android.util.Slog;
|
|||||||
import android.util.SparseIntArray;
|
import android.util.SparseIntArray;
|
||||||
import android.util.TrustedTime;
|
import android.util.TrustedTime;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.internal.util.FileRotator;
|
import com.android.internal.util.FileRotator;
|
||||||
import com.android.internal.util.IndentingPrintWriter;
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
@@ -165,7 +166,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
|
|
||||||
private IConnectivityManager mConnManager;
|
private IConnectivityManager mConnManager;
|
||||||
|
|
||||||
// @VisibleForTesting
|
@VisibleForTesting
|
||||||
public static final String ACTION_NETWORK_STATS_POLL =
|
public static final String ACTION_NETWORK_STATS_POLL =
|
||||||
"com.android.server.action.NETWORK_STATS_POLL";
|
"com.android.server.action.NETWORK_STATS_POLL";
|
||||||
public static final String ACTION_NETWORK_STATS_UPDATED =
|
public static final String ACTION_NETWORK_STATS_UPDATED =
|
||||||
|
|||||||
Reference in New Issue
Block a user