[SP04] add unit test for NetworkStatsProvider am: a97b5c3bb3 am: a51ef24361
Change-Id: I0ce508b3ccf22b01603de7246b2068d3b1a2afcd
This commit is contained in:
@@ -182,7 +182,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
* This avoids firing the global alert too often on devices with high transfer speeds and
|
* This avoids firing the global alert too often on devices with high transfer speeds and
|
||||||
* high quota.
|
* high quota.
|
||||||
*/
|
*/
|
||||||
private static final int PERFORM_POLL_DELAY_MS = 1000;
|
private static final int DEFAULT_PERFORM_POLL_DELAY_MS = 1000;
|
||||||
|
|
||||||
private static final String TAG_NETSTATS_ERROR = "netstats_error";
|
private static final String TAG_NETSTATS_ERROR = "netstats_error";
|
||||||
|
|
||||||
@@ -226,6 +226,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
*/
|
*/
|
||||||
public interface NetworkStatsSettings {
|
public interface NetworkStatsSettings {
|
||||||
public long getPollInterval();
|
public long getPollInterval();
|
||||||
|
public long getPollDelay();
|
||||||
public boolean getSampleEnabled();
|
public boolean getSampleEnabled();
|
||||||
public boolean getAugmentEnabled();
|
public boolean getAugmentEnabled();
|
||||||
|
|
||||||
@@ -1116,7 +1117,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
// such a call pending; UID stats are handled during normal polling interval.
|
// such a call pending; UID stats are handled during normal polling interval.
|
||||||
if (!mHandler.hasMessages(MSG_PERFORM_POLL_REGISTER_ALERT)) {
|
if (!mHandler.hasMessages(MSG_PERFORM_POLL_REGISTER_ALERT)) {
|
||||||
mHandler.sendEmptyMessageDelayed(MSG_PERFORM_POLL_REGISTER_ALERT,
|
mHandler.sendEmptyMessageDelayed(MSG_PERFORM_POLL_REGISTER_ALERT,
|
||||||
PERFORM_POLL_DELAY_MS);
|
mSettings.getPollDelay());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1995,6 +1996,10 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
return getGlobalLong(NETSTATS_POLL_INTERVAL, 30 * MINUTE_IN_MILLIS);
|
return getGlobalLong(NETSTATS_POLL_INTERVAL, 30 * MINUTE_IN_MILLIS);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public long getPollDelay() {
|
||||||
|
return DEFAULT_PERFORM_POLL_DELAY_MS;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public long getGlobalAlertBytes(long def) {
|
public long getGlobalAlertBytes(long def) {
|
||||||
return getGlobalLong(NETSTATS_GLOBAL_ALERT_BYTES, def);
|
return getGlobalLong(NETSTATS_GLOBAL_ALERT_BYTES, def);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user