Add whitelist for anomaly detection.

Even though we can add whitelist in config, we still need to have a
on device whitelist to reduce the size of config.

Use doze whitelist here because we already used it to detect whether
we can restrict the app in battery detail page.

Bug: 74241534
Test: RunSettingsRoboTests
Change-Id: I35b6f3eba9fbc8ae51bb02cd9d5416e4360c388e
This commit is contained in:
jackqdyulei
2018-03-06 13:19:15 -08:00
committed by Lei Yu
parent 3c5aeac39f
commit 10051afb96
3 changed files with 105 additions and 24 deletions

View File

@@ -18,10 +18,10 @@ package com.android.settings.fuelgauge.batterytip;
import static com.android.settings.fuelgauge.batterytip.AnomalyDatabaseHelper.AnomalyColumns
.ANOMALY_STATE;
import static com.android.settings.fuelgauge.batterytip.AnomalyDatabaseHelper.AnomalyColumns
.PACKAGE_NAME;
import static com.android.settings.fuelgauge.batterytip.AnomalyDatabaseHelper.AnomalyColumns
.ANOMALY_TYPE;
import static com.android.settings.fuelgauge.batterytip.AnomalyDatabaseHelper.AnomalyColumns
.PACKAGE_NAME;
import static com.android.settings.fuelgauge.batterytip.AnomalyDatabaseHelper.AnomalyColumns
.TIME_STAMP_MS;
import static com.android.settings.fuelgauge.batterytip.AnomalyDatabaseHelper.AnomalyColumns.UID;
@@ -61,10 +61,11 @@ public class BatteryDatabaseManager {
/**
* Insert an anomaly log to database.
* @param packageName the package name of the app
* @param type the type of the anomaly
* @param anomalyState the state of the anomaly
* @param timestampMs the time when it is happened
*
* @param packageName the package name of the app
* @param type the type of the anomaly
* @param anomalyState the state of the anomaly
* @param timestampMs the time when it is happened
*/
public synchronized void insertAnomaly(int uid, String packageName, int type, int anomalyState,
long timestampMs) {