1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * 16 */ 17 18package com.android.settings.fuelgauge.anomaly.checker; 19 20import android.annotation.Nullable; 21 22import com.android.internal.os.BatteryStatsHelper; 23import com.android.settings.fuelgauge.anomaly.Anomaly; 24 25import java.util.List; 26 27public interface AnomalyDetector { 28 /** 29 * Detect whether there is anomaly among all the applications in the device 30 * 31 * @param batteryStatsHelper used to detect the anomaly 32 * @return anomaly list 33 */ 34 List<Anomaly> detectAnomalies(BatteryStatsHelper batteryStatsHelper); 35 36 /** 37 * Detect whether application with {@code targetPackageName} has anomaly. When 38 * {@code targetPackageName} is null, start detection among all the applications. 39 * 40 * @param batteryStatsHelper used to detect the anomaly 41 * @param targetPackageName represents the app need to be detected 42 * @return anomaly list 43 */ 44 List<Anomaly> detectAnomalies(BatteryStatsHelper batteryStatsHelper, 45 @Nullable String targetPackageName); 46} 47