Merge "Update the anomaly type constants" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-04-05 21:23:24 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 11 deletions

View File

@@ -144,7 +144,8 @@ public class AnomalyDetectionJobService extends JobService {
if (!powerWhitelistBackend.isSysWhitelistedExceptIdle(packageName)
&& !isSystemUid(uid)) {
boolean anomalyDetected = true;
if (anomalyInfo.anomalyType == StatsManagerConfig.AnomalyType.EXCESSIVE_BG) {
if (anomalyInfo.anomalyType
== StatsManagerConfig.AnomalyType.EXCESSIVE_BACKGROUND_SERVICE) {
if (!batteryUtils.isPreOApp(packageName)
|| !batteryUtils.isAppHeavilyUsed(batteryStatsHelper, userManager, uid,
policy.excessiveBgDrainPercentage)) {

View File

@@ -23,8 +23,6 @@ import com.google.common.hash.Hashing;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
import java.util.Map;
/**
* This class provides all the configs needed if we want to use {@link android.app.StatsManager}
@@ -43,16 +41,20 @@ public class StatsManagerConfig {
@Retention(RetentionPolicy.SOURCE)
@IntDef({AnomalyType.NULL,
AnomalyType.WAKE_LOCK,
AnomalyType.WAKEUP_ALARM,
AnomalyType.BLUETOOTH_SCAN,
AnomalyType.EXCESSIVE_BG})
AnomalyType.UNKNOWN_REASON,
AnomalyType.EXCESSIVE_WAKELOCK_ALL_SCREEN_OFF,
AnomalyType.EXCESSIVE_WAKEUPS_IN_BACKGROUND,
AnomalyType.EXCESSIVE_UNOPTIMIZED_BLE_SCAN,
AnomalyType.EXCESSIVE_BACKGROUND_SERVICE,
AnomalyType.EXCESSIVE_WIFI_SCAN})
public @interface AnomalyType {
int NULL = -1;
int WAKE_LOCK = 0;
int WAKEUP_ALARM = 1;
int BLUETOOTH_SCAN = 2;
int EXCESSIVE_BG = 3;
int UNKNOWN_REASON = 0;
int EXCESSIVE_WAKELOCK_ALL_SCREEN_OFF = 1;
int EXCESSIVE_WAKEUPS_IN_BACKGROUND = 2;
int EXCESSIVE_UNOPTIMIZED_BLE_SCAN = 3;
int EXCESSIVE_BACKGROUND_SERVICE = 4;
int EXCESSIVE_WIFI_SCAN = 5;
}
}