Search in sources :

Example 1 with LowBatteryTip

use of com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BatteryFixSliceTest method getSlice_unimportantSlice_shouldSkip.

@Test
public void getSlice_unimportantSlice_shouldSkip() {
    final List<BatteryTip> tips = new ArrayList<>();
    tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false, ""));
    tips.add(new EarlyWarningTip(BatteryTip.StateType.HANDLED, false));
    ShadowBatteryTipLoader.setBatteryTips(tips);
    BatteryFixSlice.updateBatteryTipAvailabilityCache(mContext);
    final Slice slice = mSlice.getSlice();
    assertThat(SliceMetadata.from(mContext, slice).isErrorSlice()).isTrue();
}
Also used : EarlyWarningTip(com.android.settings.fuelgauge.batterytip.tips.EarlyWarningTip) Slice(androidx.slice.Slice) ArrayList(java.util.ArrayList) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) Test(org.junit.Test)

Example 2 with LowBatteryTip

use of com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BatteryTipLoader method getFakeData.

private List<BatteryTip> getFakeData() {
    final List<BatteryTip> tips = new ArrayList<>();
    tips.add(new SummaryTip(BatteryTip.StateType.NEW, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN));
    tips.add(new LowBatteryTip(BatteryTip.StateType.NEW, false, /* powerSaveModeOn */
    "Fake data"));
    return tips;
}
Also used : SummaryTip(com.android.settings.fuelgauge.batterytip.tips.SummaryTip) ArrayList(java.util.ArrayList) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)

Example 3 with LowBatteryTip

use of com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BatteryFixSliceTest method updateBatteryTipAvailabilityCache_hasImportantTip_shouldReturnTrue.

@Test
public void updateBatteryTipAvailabilityCache_hasImportantTip_shouldReturnTrue() {
    final List<BatteryTip> tips = new ArrayList<>();
    tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false, ""));
    tips.add(new EarlyWarningTip(BatteryTip.StateType.NEW, false));
    ShadowBatteryTipLoader.setBatteryTips(tips);
    BatteryFixSlice.updateBatteryTipAvailabilityCache(mContext);
    assertThat(BatteryFixSlice.isBatteryTipAvailableFromCache(mContext)).isTrue();
}
Also used : EarlyWarningTip(com.android.settings.fuelgauge.batterytip.tips.EarlyWarningTip) ArrayList(java.util.ArrayList) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) Test(org.junit.Test)

Aggregations

BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)3 LowBatteryTip (com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)3 ArrayList (java.util.ArrayList)3 EarlyWarningTip (com.android.settings.fuelgauge.batterytip.tips.EarlyWarningTip)2 Test (org.junit.Test)2 Slice (androidx.slice.Slice)1 SummaryTip (com.android.settings.fuelgauge.batterytip.tips.SummaryTip)1