Add wakeup alarm anomaly detector

Wakeup alarm count frequent is calculated by a / b, where
1. a: the total wakeup alarm count since the last full charge
2. b: total time running since last full charge
(include sleeping time)

This cl also has the following changes:
1. Move bunch of methods to BatteryUtils
2. Create type WAKEUP_ALARM
3. Add and update tests

Upcoming cl will make sure we get the threshold from
AnomalyDetectionPolicy

Bug: 36921529
Test: RunSettingsRoboTests
Change-Id: I4f7b85606df68b6057f6c7d3f3be7f9a9a747f1d
This commit is contained in:
jackqdyulei
2017-05-17 17:00:47 -07:00
parent 6976ccecee
commit 495de548bd
8 changed files with 303 additions and 24 deletions

View File

@@ -441,12 +441,6 @@ public class PowerUsageSummaryTest {
assertThat(percent).isWithin(PRECISION).of(POWER_USAGE_PERCENTAGE);
}
@Test
public void testCalculateRunningTimeBasedOnStatsType() {
assertThat(mFragment.calculateRunningTimeBasedOnStatsType()).isEqualTo(
TIME_SINCE_LAST_FULL_CHARGE_MS);
}
@Test
public void testNonIndexableKeys_MatchPreferenceKeys() {
final Context context = RuntimeEnvironment.application;