Home
last modified time | relevance | path

Searched refs:BatteryTip (Results 1 – 25 of 52) sorted by relevance

123

/packages/apps/Settings/src/com/android/settings/homepage/contextualcards/slices/
DBatteryFixSlice.java51 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
74 UNIMPORTANT_BATTERY_TIPS.put(BatteryTip.TipType.SUMMARY, in UNIMPORTANT_BATTERY_TIPS.put()
75 Arrays.asList(BatteryTip.StateType.NEW, BatteryTip.StateType.HANDLED)); in UNIMPORTANT_BATTERY_TIPS.put()
76 UNIMPORTANT_BATTERY_TIPS.put(BatteryTip.TipType.HIGH_DEVICE_USAGE, in UNIMPORTANT_BATTERY_TIPS.put()
77 Arrays.asList(BatteryTip.StateType.NEW, BatteryTip.StateType.HANDLED)); in UNIMPORTANT_BATTERY_TIPS.put()
78 UNIMPORTANT_BATTERY_TIPS.put(BatteryTip.TipType.BATTERY_SAVER, in UNIMPORTANT_BATTERY_TIPS.put()
79 Arrays.asList(BatteryTip.StateType.HANDLED)); in UNIMPORTANT_BATTERY_TIPS.put()
106 final List<BatteryTip> batteryTips = worker != null ? worker.getResults() : null; in getSlice()
113 for (BatteryTip batteryTip : batteryTips) { in getSlice()
114 if (batteryTip.getState() == BatteryTip.StateType.INVISIBLE) { in getSlice()
[all …]
/packages/apps/Settings/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/
DRestrictAppTipTest.java99 mNewBatteryTip = new RestrictAppTip(BatteryTip.StateType.NEW, mUsageAppList); in setUp()
100 mHandledBatteryTip = new RestrictAppTip(BatteryTip.StateType.HANDLED, mUsageAppList); in setUp()
101 mInvisibleBatteryTip = new RestrictAppTip(BatteryTip.StateType.INVISIBLE, in setUp()
119 assertThat(parcelTip.getType()).isEqualTo(BatteryTip.TipType.APP_RESTRICTION); in parcelable()
120 assertThat(parcelTip.getState()).isEqualTo(BatteryTip.StateType.NEW); in parcelable()
138 mHandledBatteryTip = new RestrictAppTip(BatteryTip.StateType.HANDLED, mUsageAppList); in getTitle_moreAppsHandled_showHandledTitle()
158 mHandledBatteryTip = new RestrictAppTip(BatteryTip.StateType.HANDLED, mUsageAppList); in getSummary_moreAppsHandled_showHandledSummary()
168 assertThat(mNewBatteryTip.getState()).isEqualTo(BatteryTip.StateType.HANDLED); in update_anomalyBecomeInvisible_stateHandled()
175 assertThat(mHandledBatteryTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE); in update_handledAnomlayBecomeInvisible_stateInvisible()
181 assertThat(mInvisibleBatteryTip.getState()).isEqualTo(BatteryTip.StateType.NEW); in update_newAnomalyComes_stateNew()
[all …]
DEarlyWarningTipTest.java51 new EarlyWarningTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */); in setUp()
68 new EarlyWarningTip(BatteryTip.StateType.NEW, false /* powerModeOn */); in testInfo_stateNew_displayPowerModeInfo()
79 new EarlyWarningTip(BatteryTip.StateType.INVISIBLE, true /* powerModeOn */); in testUpdate_powerModeTurnedOn_typeBecomeInvisible()
83 assertThat(mEarlyWarningTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE); in testUpdate_powerModeTurnedOn_typeBecomeInvisible()
88 final EarlyWarningTip nextTip = new EarlyWarningTip(BatteryTip.StateType.INVISIBLE, in testUpdate_devicePluggedIn_typeBecomeInvisible()
93 assertThat(mEarlyWarningTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE); in testUpdate_devicePluggedIn_typeBecomeInvisible()
98 final EarlyWarningTip earlyWarningTip = new EarlyWarningTip(BatteryTip.StateType.INVISIBLE, in testUpdate_turnOnLowPowerModeExplicitly_typeStillInvisible()
100 final EarlyWarningTip nextTip = new EarlyWarningTip(BatteryTip.StateType.INVISIBLE, in testUpdate_turnOnLowPowerModeExplicitly_typeStillInvisible()
105 assertThat(earlyWarningTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE); in testUpdate_turnOnLowPowerModeExplicitly_typeStillInvisible()
110 final EarlyWarningTip earlyWarningTip = new EarlyWarningTip(BatteryTip.StateType.HANDLED, in testUpdate_turnOffLowPowerModeExplicitly_typeBecomeInvisible()
[all …]
DBatteryTipTest.java69 final BatteryTip batteryTip = new TestBatteryTip(); in parcelable()
75 final BatteryTip parcelTip = new TestBatteryTip(parcel); in parcelable()
86 for (int i = 0, size = BatteryTip.TIP_ORDER.size(); i < size; i++) { in tipOrder_orderUnique()
87 orders.add(BatteryTip.TIP_ORDER.valueAt(i)); in tipOrder_orderUnique()
101 public static class TestBatteryTip extends BatteryTip {
126 public void updateState(BatteryTip tip) { in updateState()
136 public BatteryTip createFromParcel(Parcel in) {
140 public BatteryTip[] newArray(int size) {
/packages/apps/Settings/src/com/android/settings/fuelgauge/batterytip/
DBatteryTipPreferenceController.java31 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
52 private List<BatteryTip> mBatteryTips;
53 private Map<String, BatteryTip> mBatteryTipMap;
97 public void updateBatteryTips(List<BatteryTip> batteryTips) { in updateBatteryTips()
112 final BatteryTip batteryTip = mBatteryTips.get(i); in updateBatteryTips()
114 if (batteryTip.getState() != BatteryTip.StateType.INVISIBLE) { in updateBatteryTips()
127 final BatteryTip batteryTip = mBatteryTipMap.get(preference.getKey()); in handlePreferenceTreeClick()
153 List<BatteryTip> batteryTips = bundle.getParcelableArrayList(KEY_BATTERY_TIPS); in restoreInstanceState()
170 public BatteryTip getCurrentBatteryTip() { in getCurrentBatteryTip()
175 return mBatteryTips.stream().anyMatch(BatteryTip::isVisible) in getCurrentBatteryTip()
[all …]
DBatteryTipLoader.java31 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
45 public class BatteryTipLoader extends AsyncLoaderCompat<List<BatteryTip>> {
61 public List<BatteryTip> loadInBackground() { in loadInBackground()
65 final List<BatteryTip> tips = new ArrayList<>(); in loadInBackground()
85 protected void onDiscardResult(List<BatteryTip> result) { in onDiscardResult()
88 private List<BatteryTip> getFakeData() { in getFakeData()
89 final List<BatteryTip> tips = new ArrayList<>(); in getFakeData()
90 tips.add(new SummaryTip(BatteryTip.StateType.NEW, in getFakeData()
92 tips.add(new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */)); in getFakeData()
DBatteryTipUtils.java41 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
94 public static BatteryTipAction getActionForBatteryTip(BatteryTip batteryTip, in getActionForBatteryTip()
97 case BatteryTip.TipType.SMART_BATTERY_MANAGER: in getActionForBatteryTip()
99 case BatteryTip.TipType.BATTERY_SAVER: in getActionForBatteryTip()
100 case BatteryTip.TipType.LOW_BATTERY: in getActionForBatteryTip()
102 case BatteryTip.TipType.APP_RESTRICTION: in getActionForBatteryTip()
103 if (batteryTip.getState() == BatteryTip.StateType.HANDLED) { in getActionForBatteryTip()
108 case BatteryTip.TipType.REMOVE_APP_RESTRICTION: in getActionForBatteryTip()
110 case BatteryTip.TipType.BATTERY_DEFENDER: in getActionForBatteryTip()
DBatteryTipDialogFragment.java38 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
55 BatteryTip mBatteryTip;
59 public static BatteryTipDialogFragment newInstance(BatteryTip batteryTip, int metricsKey) { in newInstance()
79 case BatteryTip.TipType.SUMMARY: in onCreateDialog()
84 case BatteryTip.TipType.HIGH_DEVICE_USAGE: in onCreateDialog()
99 case BatteryTip.TipType.APP_RESTRICTION: in onCreateDialog()
130 case BatteryTip.TipType.REMOVE_APP_RESTRICTION: in onCreateDialog()
/packages/apps/Settings/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/
DBatteryFixSliceTest.java37 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
87 final List<BatteryTip> tips = new ArrayList<>(); in refreshBatteryTips_hasImportantTip_shouldReturnTrue()
88 tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false)); in refreshBatteryTips_hasImportantTip_shouldReturnTrue()
89 tips.add(new EarlyWarningTip(BatteryTip.StateType.NEW, false)); in refreshBatteryTips_hasImportantTip_shouldReturnTrue()
99 final List<BatteryTip> tips = new ArrayList<>(); in getSlice_unimportantSlice_shouldSkip()
105 tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false)); in getSlice_unimportantSlice_shouldSkip()
106 tips.add(new EarlyWarningTip(BatteryTip.StateType.HANDLED, false)); in getSlice_unimportantSlice_shouldSkip()
122 final List<BatteryTip> tips = new ArrayList<>(); in getSlice_hasImportantTip_shouldTintIcon()
123 tips.add(new EarlyWarningTip(BatteryTip.StateType.NEW, false)); in getSlice_hasImportantTip_shouldTintIcon()
150 private static List<BatteryTip> sBatteryTips = new ArrayList<>();
[all …]
/packages/apps/Settings/tests/robotests/src/com/android/settings/fuelgauge/batterytip/
DBatteryTipUtilsTest.java31 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
66 mRestrictAppTip = spy(new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>())); in setUp()
68 new EarlyWarningTip(BatteryTip.StateType.NEW, true /* powerSaveModeOn */)); in setUp()
70 new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */)); in setUp()
71 mBatteryDefenderTip = spy(new BatteryDefenderTip(BatteryTip.StateType.NEW)); in setUp()
76 when(mRestrictAppTip.getState()).thenReturn(BatteryTip.StateType.NEW); in testGetActionForBatteryTip_typeRestrictStateNew_returnActionRestrict()
84 when(mRestrictAppTip.getState()).thenReturn(BatteryTip.StateType.HANDLED); in testGetActionForBatteryTip_typeRestrictStateHandled_returnActionOpen()
92 when(mEarlyWarningTip.getState()).thenReturn(BatteryTip.StateType.NEW); in testGetActionForBatteryTip_typeEarlyWarningStateNew_returnActionOpen()
100 when(mLowBatteryTip.getState()).thenReturn(BatteryTip.StateType.NEW); in testGetActionForBatteryTip_typeLowBatteryStateNew_returnActionOpen()
109 when(mBatteryDefenderTip.getState()).thenReturn(BatteryTip.StateType.NEW); in testGetActionForBatteryTip_typeBatteryDefenderStateNew_returnActionBatteryDefender()
DBatteryTipPreferenceControllerTest.java18 import static com.android.settings.fuelgauge.batterytip.tips.BatteryTip.TipType
39 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
67 private BatteryTip mBatteryTip;
76 private List<BatteryTip> mOldBatteryTips;
77 private List<BatteryTip> mNewBatteryTips;
91 mOldBatteryTips.add(new SummaryTip(BatteryTip.StateType.NEW, AVERAGE_TIME_MS)); in setUp()
93 mNewBatteryTips.add(new SummaryTip(BatteryTip.StateType.INVISIBLE, AVERAGE_TIME_MS)); in setUp()
127 BatteryTip.StateType.NEW); in testUpdateBatteryTips_logBatteryTip()
146 BatteryTip.TipType.SUMMARY); in testGetCurrentBatteryTip_tipsVisible_returnTips()
178 List<BatteryTip> batteryTips = new ArrayList<>(); in testHandlePreferenceTreeClick_noDialog_invokeCallback()
DBatteryTipLoaderTest.java34 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
53 BatteryTip.TipType.BATTERY_SAVER,
54 BatteryTip.TipType.LOW_BATTERY,
55 BatteryTip.TipType.BATTERY_DEFENDER,
56 BatteryTip.TipType.HIGH_DEVICE_USAGE,
57 BatteryTip.TipType.SMART_BATTERY_MANAGER};
92 final List<BatteryTip> batteryTips = mBatteryTipLoader.loadInBackground(); in testLoadBackground_containsAllTipsWithOrder()
/packages/apps/Settings/src/com/android/settings/fuelgauge/batterytip/detectors/
DRestrictAppDetector.java32 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
63 public BatteryTip detect() { in detect()
74 return new RestrictAppTip(BatteryTip.StateType.NEW, highUsageApps); in detect()
81 return new RestrictAppTip(autoHandledApps.isEmpty() ? BatteryTip.StateType.INVISIBLE in detect()
82 : BatteryTip.StateType.HANDLED, autoHandledApps); in detect()
85 return new RestrictAppTip(BatteryTip.StateType.INVISIBLE, new ArrayList<>()); in detect()
89 private BatteryTip getFakeData() { in getFakeData()
94 return new RestrictAppTip(BatteryTip.StateType.NEW, highUsageApps); in getFakeData()
DEarlyWarningDetector.java27 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
49 public BatteryTip detect() { in detect()
59 ? BatteryTip.StateType.INVISIBLE in detect()
61 ? BatteryTip.StateType.NEW in detect()
62 : BatteryTip.StateType.INVISIBLE; in detect()
DBatteryDefenderDetector.java22 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
35 public BatteryTip detect() { in detect()
38 ? BatteryTip.StateType.NEW in detect()
39 : BatteryTip.StateType.INVISIBLE; in detect()
DSummaryDetector.java20 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
37 public BatteryTip detect() { in detect()
40 ? BatteryTip.StateType.NEW in detect()
41 : BatteryTip.StateType.INVISIBLE; in detect()
DSmartBatteryDetector.java26 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
49 public BatteryTip detect() { in detect()
59 enableSmartBatteryTip ? BatteryTip.StateType.NEW : BatteryTip.StateType.INVISIBLE; in detect()
/packages/apps/Settings/src/com/android/settings/fuelgauge/
DPowerUsageSummary.java39 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
118 private LoaderManager.LoaderCallbacks<List<BatteryTip>> mBatteryTipsCallbacks =
119 new LoaderManager.LoaderCallbacks<List<BatteryTip>>() {
122 public Loader<List<BatteryTip>> onCreateLoader(int id, Bundle args) {
127 public void onLoadFinished(Loader<List<BatteryTip>> loader,
128 List<BatteryTip> data) {
135 public void onLoaderReset(Loader<List<BatteryTip>> loader) {
300 public void onBatteryTipHandled(BatteryTip batteryTip) { in onBatteryTipHandled()
/packages/apps/Settings/src/com/android/settings/fuelgauge/batterytip/tips/
DBatteryTip.java41 public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable { class
99 BatteryTip(Parcel in) { in BatteryTip() method in BatteryTip
106 BatteryTip(int type, int state, boolean showDialog) { in BatteryTip() method in BatteryTip
138 public abstract void updateState(BatteryTip tip); in updateState()
195 public int compareTo(BatteryTip o) { in compareTo()
DSmartBatteryTip.java29 public class SmartBatteryTip extends BatteryTip {
55 public void updateState(BatteryTip tip) { in updateState()
66 public BatteryTip createFromParcel(Parcel in) {
70 public BatteryTip[] newArray(int size) {
DBatteryDefenderTip.java29 public class BatteryDefenderTip extends BatteryTip {
55 public void updateState(BatteryTip tip) { in updateState()
66 public BatteryTip createFromParcel(Parcel in) {
70 public BatteryTip[] newArray(int size) {
DUnrestrictAppTip.java31 public class UnrestrictAppTip extends BatteryTip {
67 public void updateState(BatteryTip tip) { in updateState()
87 public BatteryTip createFromParcel(Parcel in) {
91 public BatteryTip[] newArray(int size) {
/packages/apps/Settings/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/
DRestrictAppDetectorTest.java40 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
128 assertThat(mRestrictAppDetector.detect().getState()).isEqualTo(BatteryTip.StateType.NEW); in testDetect_hasAnomaly_tipNew()
143 .isEqualTo(BatteryTip.StateType.HANDLED); in testDetect_hasAutoHandledAnomaly_tipHandled()
155 assertThat(restrictAppTip.getState()).isEqualTo(BatteryTip.StateType.NEW); in testDetect_typeNewHasUninstalledAnomaly_removeIt()
172 assertThat(restrictAppTip.getState()).isEqualTo(BatteryTip.StateType.NEW); in testDetect_typeNewHasRestrictedAnomaly_removeIt()
192 assertThat(restrictAppTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE); in testDetect_typeHandledHasUnRestrictedAnomaly_removeIt()
201 .isEqualTo(BatteryTip.StateType.INVISIBLE); in testDetect_noAnomaly_tipInvisible()
DLowBatteryDetectorTest.java28 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
79 assertThat(mLowBatteryDetector.detect().getState()).isEqualTo(BatteryTip.StateType.NEW); in testDetect_enabledByTest_tipNew()
86 assertThat(mLowBatteryDetector.detect().getState()).isEqualTo(BatteryTip.StateType.NEW); in testDetect_lowBattery_tipNew()
90 assertThat(mLowBatteryDetector.detect().getState()).isEqualTo(BatteryTip.StateType.NEW); in testDetect_lowBattery_tipNew()
98 .isEqualTo(BatteryTip.StateType.INVISIBLE); in testDetect_batterySaverOn_tipInvisible()
/packages/apps/Settings/tests/robotests/src/com/android/settings/fuelgauge/
DBatteryHeaderPreferenceControllerTest.java43 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
245 BatteryTip lowBatteryTip = new LowBatteryTip( in updateHeaderByBatteryTips_lowBatteryTip_showLowBattery()
246 BatteryTip.StateType.NEW, /* powerSaveModeOn */false); in updateHeaderByBatteryTips_lowBatteryTip_showLowBattery()
257 BatteryTip lowBatteryTip = new SmartBatteryTip(BatteryTip.StateType.NEW); in updateHeaderByBatteryTips_notLowBatteryTip_showRemainingLabel()
275 BatteryTip lowBatteryTip = new LowBatteryTip( in updateHeaderByBatteryTips_noBatteryInfo_noAction()
276 BatteryTip.StateType.NEW, /* powerSaveModeOn */false); in updateHeaderByBatteryTips_noBatteryInfo_noAction()

123