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

@@ -34,9 +34,11 @@ import java.util.Objects;
*/
public class Anomaly implements Parcelable {
@Retention(RetentionPolicy.SOURCE)
@IntDef({AnomalyType.WAKE_LOCK})
@IntDef({AnomalyType.WAKE_LOCK,
AnomalyType.WAKEUP_ALARM})
public @interface AnomalyType {
int WAKE_LOCK = 0;
int WAKEUP_ALARM = 1;
}
@Retention(RetentionPolicy.SOURCE)
@@ -46,7 +48,9 @@ public class Anomaly implements Parcelable {
}
@AnomalyType
public static final int[] ANOMALY_TYPE_LIST = {AnomalyType.WAKE_LOCK};
public static final int[] ANOMALY_TYPE_LIST =
{AnomalyType.WAKE_LOCK,
AnomalyType.WAKEUP_ALARM};
/**
* Type of this this anomaly