summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java
diff options
context:
space:
mode:
authorjackqdyulei <jackqdyulei@google.com>2017-05-23 10:57:35 -0700
committerjackqdyulei <jackqdyulei@google.com>2017-05-23 13:34:17 -0700
commitfa4939bbc931221a0687b78c6f592a080833a5d3 (patch)
treeb4da7aab8b4ae6472f0e099ac7f9c6bfafc28eeb /src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java
parent4d815d93ad9106c6ff3754881420f65dc00246d5 (diff)
downloadpackages_apps_Settings-fa4939bbc931221a0687b78c6f592a080833a5d3.tar.gz
packages_apps_Settings-fa4939bbc931221a0687b78c6f592a080833a5d3.tar.bz2
packages_apps_Settings-fa4939bbc931221a0687b78c6f592a080833a5d3.zip
Add flag for wakeup alarm
Also hook up it to WakeupAlarmAnomalyDetector Bug: 38233931 Test: RunSettingsRoboTests Change-Id: Iceae37dcd2e6a6f1a044fa36efb416f11703c431
Diffstat (limited to 'src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java')
-rw-r--r--src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java b/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java
index eacb31f910..603bca02e8 100644
--- a/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java
+++ b/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicy.java
@@ -35,7 +35,11 @@ public class AnomalyDetectionPolicy {
@VisibleForTesting
static final String KEY_WAKELOCK_DETECTION_ENABLED = "wakelock_enabled";
@VisibleForTesting
+ static final String KEY_WAKEUP_ALARM_DETECTION_ENABLED = "wakeup_alarm_enabled";
+ @VisibleForTesting
static final String KEY_WAKELOCK_THRESHOLD = "wakelock_threshold";
+ @VisibleForTesting
+ static final String KEY_WAKEUP_ALARM_THRESHOLD = "wakeup_alarm_threshold";
/**
* {@code true} if general anomaly detection is enabled
@@ -54,6 +58,14 @@ public class AnomalyDetectionPolicy {
public final boolean wakeLockDetectionEnabled;
/**
+ * {@code true} if wakeup alarm detection is enabled
+ *
+ * @see Settings.Global#ANOMALY_DETECTION_CONSTANTS
+ * @see #KEY_WAKEUP_ALARM_DETECTION_ENABLED
+ */
+ public final boolean wakeupAlarmDetectionEnabled;
+
+ /**
* Threshold for wakelock time in milli seconds
*
* @see Settings.Global#ANOMALY_DETECTION_CONSTANTS
@@ -61,6 +73,14 @@ public class AnomalyDetectionPolicy {
*/
public final long wakeLockThreshold;
+ /**
+ * Threshold for wakeup alarm count per hour
+ *
+ * @see Settings.Global#ANOMALY_DETECTION_CONSTANTS
+ * @see #KEY_WAKEUP_ALARM_THRESHOLD
+ */
+ public final long wakeupAlarmThreshold;
+
private final KeyValueListParserWrapper mParserWrapper;
public AnomalyDetectionPolicy(Context context) {
@@ -81,8 +101,11 @@ public class AnomalyDetectionPolicy {
anomalyDetectionEnabled = mParserWrapper.getBoolean(KEY_ANOMALY_DETECTION_ENABLED, true);
wakeLockDetectionEnabled = mParserWrapper.getBoolean(KEY_WAKELOCK_DETECTION_ENABLED, true);
+ wakeupAlarmDetectionEnabled = mParserWrapper.getBoolean(KEY_WAKEUP_ALARM_DETECTION_ENABLED,
+ true);
wakeLockThreshold = mParserWrapper.getLong(KEY_WAKELOCK_THRESHOLD,
DateUtils.HOUR_IN_MILLIS);
+ wakeupAlarmThreshold = mParserWrapper.getLong(KEY_WAKEUP_ALARM_THRESHOLD, 60);
}
}