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:
@@ -499,7 +499,8 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
BatteryInfo batteryInfo = getBatteryInfo(elapsedRealtimeUs, batteryBroadcast);
|
||||
updateHeaderPreference(batteryInfo);
|
||||
|
||||
final long runningTime = calculateRunningTimeBasedOnStatsType();
|
||||
final long runningTime = mBatteryUtils.calculateRunningTimeBasedOnStatsType(mStatsHelper,
|
||||
mStatsType);
|
||||
updateScreenPreference();
|
||||
updateLastFullChargePreference(runningTime);
|
||||
|
||||
@@ -655,14 +656,6 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
timeSequence));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
long calculateRunningTimeBasedOnStatsType() {
|
||||
final long elapsedRealtimeUs = mBatteryUtils.convertMsToUs(SystemClock.elapsedRealtime());
|
||||
// Return the battery time (millisecond) on status mStatsType
|
||||
return mStatsHelper.getStats().computeBatteryRealtime(elapsedRealtimeUs,
|
||||
mStatsType /* STATS_SINCE_CHARGED */) / 1000;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void updateHeaderPreference(BatteryInfo info) {
|
||||
final Context context = getContext();
|
||||
|
Reference in New Issue
Block a user