use of com.android.settings.fuelgauge.batterytip.AppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HighUsageDetectorTest method testDetect_containsHighUsageApp_tipVisibleAndSorted.
@Test
public void testDetect_containsHighUsageApp_tipVisibleAndSorted() {
doReturn(true).when(mDataParser).isDeviceHeavilyUsed();
final HighUsageTip highUsageTip = (HighUsageTip) mHighUsageDetector.detect();
assertThat(highUsageTip.isVisible()).isTrue();
// Contain two appInfo and large one comes first
final List<AppInfo> appInfos = highUsageTip.getHighUsageAppList();
assertThat(appInfos).containsExactly(mLowAppInfo, mHighAppInfo);
assertThat(appInfos.get(0)).isEqualTo(mHighAppInfo);
}
use of com.android.settings.fuelgauge.batterytip.AppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RestrictAppTipTest method parcelable.
@Test
public void parcelable() {
Parcel parcel = Parcel.obtain();
mNewBatteryTip.writeToParcel(parcel, mNewBatteryTip.describeContents());
parcel.setDataPosition(0);
final RestrictAppTip parcelTip = new RestrictAppTip(parcel);
assertThat(parcelTip.getType()).isEqualTo(BatteryTip.TipType.APP_RESTRICTION);
assertThat(parcelTip.getState()).isEqualTo(BatteryTip.StateType.NEW);
final AppInfo app = parcelTip.getRestrictAppList().get(0);
assertThat(app.packageName).isEqualTo(PACKAGE_NAME);
}
use of com.android.settings.fuelgauge.batterytip.AppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UnrestrictAppTipTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
AppInfo appInfo = new AppInfo.Builder().setPackageName(PACKAGE_NAME).build();
mBatteryTip = new UnrestrictAppTip(BatteryTip.StateType.NEW, appInfo);
}
use of com.android.settings.fuelgauge.batterytip.AppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BackgroundActivityPreferenceController method showDialog.
@VisibleForTesting
void showDialog(boolean restricted) {
final AppInfo appInfo = new AppInfo.Builder().setUid(mUid).setPackageName(mTargetPackage).build();
BatteryTip tip = restricted ? new UnrestrictAppTip(BatteryTip.StateType.NEW, appInfo) : new RestrictAppTip(BatteryTip.StateType.NEW, appInfo);
final BatteryTipDialogFragment dialogFragment = BatteryTipDialogFragment.newInstance(tip, mFragment.getMetricsCategory());
dialogFragment.setTargetFragment(mFragment, 0);
dialogFragment.show(mFragment.getFragmentManager(), TAG);
}
use of com.android.settings.fuelgauge.batterytip.AppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RestrictedAppDetails method onBatteryTipHandled.
@Override
public void onBatteryTipHandled(BatteryTip batteryTip) {
final AppInfo appInfo;
final boolean isRestricted = batteryTip instanceof RestrictAppTip;
if (isRestricted) {
appInfo = ((RestrictAppTip) batteryTip).getRestrictAppList().get(0);
} else {
appInfo = ((UnrestrictAppTip) batteryTip).getUnrestrictAppInfo();
}
CheckBoxPreference preference = (CheckBoxPreference) mRestrictedAppListGroup.findPreference(getKeyFromAppInfo(appInfo));
if (preference != null) {
preference.setChecked(isRestricted);
}
}
Aggregations