Merge "Cleaning up NetworkStatsManager." into nyc-dev am: c45f0aea71 am: f49cbec84c
am: cc1524eded * commit 'cc1524edede07e2139cd072d6256fa96952f4004': Cleaning up NetworkStatsManager. Change-Id: I3f669191e7c7739870dc098d5d6357d1d3ceb6dd
This commit is contained in:
@@ -240,18 +240,13 @@ public class NetworkStatsManager {
|
||||
* {@link java.lang.System#currentTimeMillis}.
|
||||
* @param uid UID of app
|
||||
* @param tag TAG of interest. Use {@link NetworkStats.Bucket#TAG_NONE} for no tags.
|
||||
* @return Statistics object or null if permissions are insufficient or error happened during
|
||||
* statistics collection.
|
||||
* @return Statistics object or null if an error happened during statistics collection.
|
||||
* @throws SecurityException if permissions are insufficient to read network statistics.
|
||||
*/
|
||||
public NetworkStats queryDetailsForUidTag(int networkType, String subscriberId,
|
||||
long startTime, long endTime, int uid, int tag) {
|
||||
long startTime, long endTime, int uid, int tag) throws SecurityException {
|
||||
NetworkTemplate template;
|
||||
try {
|
||||
template = createTemplate(networkType, subscriberId);
|
||||
} catch (IllegalArgumentException e) {
|
||||
if (DBG) Log.e(TAG, "Cannot create template", e);
|
||||
return null;
|
||||
}
|
||||
template = createTemplate(networkType, subscriberId);
|
||||
|
||||
NetworkStats result;
|
||||
try {
|
||||
@@ -303,17 +298,6 @@ public class NetworkStatsManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @removed */
|
||||
public void registerDataUsageCallback(DataUsagePolicy policy, DataUsageCallback callback,
|
||||
@Nullable Handler handler) {}
|
||||
|
||||
/** @removed */
|
||||
public void registerDataUsageCallback(DataUsagePolicy policy, UsageCallback callback,
|
||||
@Nullable Handler handler) {}
|
||||
|
||||
/** @removed */
|
||||
public void unregisterDataUsageCallback(DataUsageCallback callback) {}
|
||||
|
||||
/**
|
||||
* Registers to receive notifications about data usage on specified networks.
|
||||
*
|
||||
@@ -396,13 +380,6 @@ public class NetworkStatsManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** @removed */
|
||||
public static abstract class DataUsageCallback {
|
||||
/** @removed */
|
||||
@Deprecated
|
||||
public void onLimitReached() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for usage callbacks. Should be extended by applications wanting notifications.
|
||||
*/
|
||||
|
||||
@@ -190,11 +190,9 @@ class NetworkStatsObservers {
|
||||
|
||||
private void handleUpdateStats(StatsContext statsContext) {
|
||||
if (mDataUsageRequests.size() == 0) {
|
||||
if (LOGV) Slog.v(TAG, "No registered listeners of data usage");
|
||||
return;
|
||||
}
|
||||
|
||||
if (LOGV) Slog.v(TAG, "Checking if any registered observer needs to be notified");
|
||||
for (int i = 0; i < mDataUsageRequests.size(); i++) {
|
||||
RequestInfo requestInfo = mDataUsageRequests.valueAt(i);
|
||||
requestInfo.updateStats(statsContext);
|
||||
@@ -371,9 +369,6 @@ class NetworkStatsObservers {
|
||||
NetworkStats stats = mCollection.getSummary(template,
|
||||
Long.MIN_VALUE /* start */, Long.MAX_VALUE /* end */,
|
||||
mAccessLevel, mCallingUid);
|
||||
if (LOGV) {
|
||||
Slog.v(TAG, "Netstats for " + template + ": " + stats);
|
||||
}
|
||||
return stats.getTotalBytes();
|
||||
}
|
||||
}
|
||||
@@ -391,11 +386,6 @@ class NetworkStatsObservers {
|
||||
|
||||
for (int i = 0; i < uidsToMonitor.length; i++) {
|
||||
long bytesSoFar = getTotalBytesForNetworkUid(mRequest.template, uidsToMonitor[i]);
|
||||
|
||||
if (LOGV) {
|
||||
Slog.v(TAG, bytesSoFar + " bytes so far since notification for "
|
||||
+ mRequest.template + " for uid=" + uidsToMonitor[i]);
|
||||
}
|
||||
if (bytesSoFar > mRequest.thresholdInBytes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user