Search in sources :

Example 31 with AppInfo

use of com.android.settings.fuelgauge.batterytip.AppInfo in project android_packages_apps_Settings by omnirom.

the class BatteryFixSliceTest method getSlice_unimportantSlice_shouldSkip.

@Test
public void getSlice_unimportantSlice_shouldSkip() {
    final List<BatteryTip> tips = new ArrayList<>();
    final List<AppInfo> appList = new ArrayList<>();
    appList.add(new AppInfo.Builder().setPackageName("com.android.settings").setScreenOnTimeMs(10000L).build());
    tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false));
    tips.add(new EarlyWarningTip(BatteryTip.StateType.HANDLED, false));
    tips.add(new HighUsageTip(1000L, appList));
    ShadowBatteryTipLoader.setBatteryTips(tips);
    BatteryFixSlice.refreshBatteryTips(mContext);
    final Slice slice = mSlice.getSlice();
    assertThat(SliceMetadata.from(mContext, slice).isErrorSlice()).isTrue();
}
Also used : EarlyWarningTip(com.android.settings.fuelgauge.batterytip.tips.EarlyWarningTip) HighUsageTip(com.android.settings.fuelgauge.batterytip.tips.HighUsageTip) 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) AppInfo(com.android.settings.fuelgauge.batterytip.AppInfo) Test(org.junit.Test)

Aggregations

AppInfo (com.android.settings.fuelgauge.batterytip.AppInfo)31 Test (org.junit.Test)11 Parcel (android.os.Parcel)4 VisibleForTesting (androidx.annotation.VisibleForTesting)4 CheckBoxPreference (androidx.preference.CheckBoxPreference)4 BatteryTipDialogFragment (com.android.settings.fuelgauge.batterytip.BatteryTipDialogFragment)4 RestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip)4 UnrestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip)4 AppCheckBoxPreference (com.android.settings.widget.AppCheckBoxPreference)4 Before (org.junit.Before)4 BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)3 HighUsageTip (com.android.settings.fuelgauge.batterytip.tips.HighUsageTip)3 ArrayList (java.util.ArrayList)3 Context (android.content.Context)2 Intent (android.content.Intent)2 ApplicationInfo (android.content.pm.ApplicationInfo)2 PackageManager (android.content.pm.PackageManager)2 Bundle (android.os.Bundle)2 SparseLongArray (android.util.SparseLongArray)2 Slice (androidx.slice.Slice)1