Search in sources :

Example 1 with BatteryDefenderTip

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

the class BatteryTipDialogFragmentTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    FakeFeatureFactory.setupForTest();
    ShadowUtils.setApplicationLabel(PACKAGE_NAME, DISPLAY_NAME);
    mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
    final ApplicationInfo applicationInfo = new ApplicationInfo();
    applicationInfo.name = DISPLAY_NAME;
    applicationInfo.packageName = PACKAGE_NAME;
    final PackageInfo packageInfo = new PackageInfo();
    packageInfo.packageName = PACKAGE_NAME;
    packageInfo.applicationInfo = applicationInfo;
    mPackageManager.addPackage(packageInfo);
    mPackageManager.setApplicationIcon(PACKAGE_NAME, new ColorDrawable());
    List<AppInfo> highUsageTips = new ArrayList<>();
    mAppInfo = new AppInfo.Builder().setScreenOnTimeMs(SCREEN_TIME_MS).setPackageName(PACKAGE_NAME).build();
    highUsageTips.add(mAppInfo);
    mHighUsageTip = new HighUsageTip(SCREEN_TIME_MS, highUsageTips);
    final List<AppInfo> restrictApps = new ArrayList<>();
    restrictApps.add(mAppInfo);
    mRestrictedOneAppTip = new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>(restrictApps));
    restrictApps.add(mAppInfo);
    mRestrictTwoAppsTip = new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>(restrictApps));
    mUnrestrictAppTip = new UnrestrictAppTip(BatteryTip.StateType.NEW, mAppInfo);
    mSummaryTip = spy(new SummaryTip(BatteryTip.StateType.NEW, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN));
    mDefenderTip = new BatteryDefenderTip(BatteryTip.StateType.NEW);
}
Also used : HighUsageTip(com.android.settings.fuelgauge.batterytip.tips.HighUsageTip) BatteryDefenderTip(com.android.settings.fuelgauge.batterytip.tips.BatteryDefenderTip) ColorDrawable(android.graphics.drawable.ColorDrawable) PackageInfo(android.content.pm.PackageInfo) RestrictAppTip(com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip) SummaryTip(com.android.settings.fuelgauge.batterytip.tips.SummaryTip) ApplicationInfo(android.content.pm.ApplicationInfo) ArrayList(java.util.ArrayList) UnrestrictAppTip(com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip) Before(org.junit.Before)

Aggregations

ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageInfo (android.content.pm.PackageInfo)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 BatteryDefenderTip (com.android.settings.fuelgauge.batterytip.tips.BatteryDefenderTip)1 HighUsageTip (com.android.settings.fuelgauge.batterytip.tips.HighUsageTip)1 RestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip)1 SummaryTip (com.android.settings.fuelgauge.batterytip.tips.SummaryTip)1 UnrestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.UnrestrictAppTip)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1