Cleaning up NetworkStatsManager.

- Throwing SecurityExceptionand and IllegalArgumentException instead of null for new APIs
- removing @removed APIs

Bug:27530098,27379882
Change-Id: Ifbe65bfc5051aa33aff2baa22cfa8e67b0f7c358
This commit is contained in:
Antonio Cansado
2016-05-25 09:57:21 -07:00
parent fe78ecbb2c
commit bfd4e42c8d
2 changed files with 4 additions and 37 deletions

View File

@@ -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.
*/