use of android.net.INetworkStatsSession in project android_frameworks_base by crdroidandroid.
the class DataIdleTest method fetchStats.
/**
* Helper method that fetches all the network stats available and reports it
* to instrumentation out.
* @param template {@link NetworkTemplate} to match.
*/
private void fetchStats(NetworkTemplate template) {
INetworkStatsSession session = null;
try {
mStatsService.forceUpdate();
session = mStatsService.openSession();
final NetworkStats stats = session.getSummaryForAllUid(template, Long.MIN_VALUE, Long.MAX_VALUE, false);
reportStats(stats);
} catch (RemoteException e) {
Log.w(LOG_TAG, "Failed to fetch network stats.");
} finally {
TrafficStats.closeQuietly(session);
}
}
Aggregations