Migrate bandwidth control to NMS, omit history.
Both stats and policy make NMS calls that depend on bandwidth control being enabled, so move enable/disable into NMS and drop calls when disabled. This avoids throwing heavy ISE exceptions when disabled. Only include recent data when writing NetworkStatsHistory as part of dumpsys call. Introduce manual poll event for Settings UI. Bug: 4982115, 4770435, 4515856 Change-Id: I257820b057af2f0f99c736fb4f61e55b9fdc3e66
This commit is contained in:
@@ -610,9 +610,6 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
|
|||||||
mAlarmManager.setInexactRepeating(
|
mAlarmManager.setInexactRepeating(
|
||||||
eq(AlarmManager.ELAPSED_REALTIME), anyLong(), anyLong(), isA(PendingIntent.class));
|
eq(AlarmManager.ELAPSED_REALTIME), anyLong(), anyLong(), isA(PendingIntent.class));
|
||||||
expectLastCall().atLeastOnce();
|
expectLastCall().atLeastOnce();
|
||||||
|
|
||||||
mNetManager.setBandwidthControlEnabled(true);
|
|
||||||
expectLastCall().atLeastOnce();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expectNetworkState(NetworkState... state) throws Exception {
|
private void expectNetworkState(NetworkState... state) throws Exception {
|
||||||
@@ -633,7 +630,6 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
|
|||||||
|
|
||||||
private void expectSettings(long persistThreshold, long bucketDuration, long maxHistory)
|
private void expectSettings(long persistThreshold, long bucketDuration, long maxHistory)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
expect(mSettings.getEnabled()).andReturn(true).anyTimes();
|
|
||||||
expect(mSettings.getPollInterval()).andReturn(HOUR_IN_MILLIS).anyTimes();
|
expect(mSettings.getPollInterval()).andReturn(HOUR_IN_MILLIS).anyTimes();
|
||||||
expect(mSettings.getPersistThreshold()).andReturn(persistThreshold).anyTimes();
|
expect(mSettings.getPersistThreshold()).andReturn(persistThreshold).anyTimes();
|
||||||
expect(mSettings.getNetworkBucketDuration()).andReturn(bucketDuration).anyTimes();
|
expect(mSettings.getNetworkBucketDuration()).andReturn(bucketDuration).anyTimes();
|
||||||
|
|||||||
Reference in New Issue
Block a user