Add anomaly detection method to AnomalyUtils

So we could reuse it in different loaders.

Bug: 63900914
Test: robotests still pass
Change-Id: I038085f53b9d0a05b8c4849c7544567434885821
This commit is contained in:
jackqdyulei
2017-07-21 12:18:33 -07:00
parent 6666bf5605
commit 8dba5a03a1
2 changed files with 28 additions and 9 deletions

View File

@@ -98,15 +98,7 @@ public class AnomalyLoader extends AsyncLoader<List<Anomaly>> {
mUserManager.getUserProfiles());
}
final List<Anomaly> anomalies = new ArrayList<>();
for (@Anomaly.AnomalyType int type : Anomaly.ANOMALY_TYPE_LIST) {
if (mPolicy.isAnomalyDetectorEnabled(type)) {
anomalies.addAll(mAnomalyUtils.getAnomalyDetector(type).detectAnomalies(
mBatteryStatsHelper, mPackageName));
}
}
return anomalies;
return mAnomalyUtils.detectAnomalies(mBatteryStatsHelper, mPolicy, mPackageName);
}
@VisibleForTesting