• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings.fuelgauge;
18 
19 import android.content.Context;
20 import android.content.Intent;
21 import android.util.SparseIntArray;
22 
23 import com.android.internal.os.BatterySipper;
24 
25 /**
26  * Feature Provider used in power usage
27  */
28 public interface PowerUsageFeatureProvider {
29 
30     /**
31      * Check whether location setting is enabled
32      */
isLocationSettingEnabled(String[] packages)33     boolean isLocationSettingEnabled(String[] packages);
34 
35     /**
36      * Check whether additional battery info feature is enabled.
37      */
isAdditionalBatteryInfoEnabled()38     boolean isAdditionalBatteryInfoEnabled();
39 
40     /**
41      * Gets an {@link Intent} to show additional battery info.
42      */
getAdditionalBatteryInfoIntent()43     Intent getAdditionalBatteryInfoIntent();
44 
45     /**
46      * Check whether advanced ui is enabled
47      */
isAdvancedUiEnabled()48     boolean isAdvancedUiEnabled();
49 
50     /**
51      * Check whether it is type service
52      */
isTypeService(BatterySipper sipper)53     boolean isTypeService(BatterySipper sipper);
54 
55     /**
56      * Check whether it is type system
57      */
isTypeSystem(BatterySipper sipper)58     boolean isTypeSystem(BatterySipper sipper);
59 
60     /**
61      * Check whether the toggle for power accounting is enabled
62      */
isPowerAccountingToggleEnabled()63     boolean isPowerAccountingToggleEnabled();
64 
65     /**
66      * Returns an improved prediction for battery time remaining.
67      */
getEnhancedBatteryPrediction(Context context)68     Estimate getEnhancedBatteryPrediction(Context context);
69 
70     /**
71      * Returns an improved projection curve for future battery level.
72      * @param zeroTime timestamps (array keys) are shifted by this amount
73      */
getEnhancedBatteryPredictionCurve(Context context, long zeroTime)74     SparseIntArray getEnhancedBatteryPredictionCurve(Context context, long zeroTime);
75 
76     /**
77      * Checks whether the toggle for enhanced battery predictions is enabled.
78      */
isEnhancedBatteryPredictionEnabled(Context context)79     boolean isEnhancedBatteryPredictionEnabled(Context context);
80 
81     /**
82      * Checks whether debugging should be enabled for battery estimates.
83      * @return
84      */
isEstimateDebugEnabled()85     boolean isEstimateDebugEnabled();
86 
87     /**
88      * Converts the provided string containing the remaining time into a debug string for enhanced
89      * estimates.
90      * @param timeRemaining
91      * @return A string containing the estimate and a label indicating it is an enhanced estimate
92      */
getEnhancedEstimateDebugString(String timeRemaining)93     String getEnhancedEstimateDebugString(String timeRemaining);
94 
95     /**
96      * Converts the provided string containing the remaining time into a debug string.
97      * @param timeRemaining
98      * @return A string containing the estimate and a label indicating it is a normal estimate
99      */
getOldEstimateDebugString(String timeRemaining)100     String getOldEstimateDebugString(String timeRemaining);
101 
102     /**
103      * Returns the string to show in the advanced usage battery page when enhanced estimates are
104      * enabled. This string notifies users that the estimate is using enhanced prediction.
105      */
getAdvancedUsageScreenInfoString()106     String getAdvancedUsageScreenInfoString();
107 
108     /**
109      * Returns a signal to indicate if the device will need to warn the user they may not make it
110      * to their next charging time.
111      *
112      * @param id Optional string used to identify the caller for metrics. Usually the class name of
113      * the caller
114      */
getEarlyWarningSignal(Context context, String id)115     boolean getEarlyWarningSignal(Context context, String id);
116 
117     /**
118      * Checks whether smart battery feature is supported in this device
119      */
isSmartBatterySupported()120     boolean isSmartBatterySupported();
121 }
122