Use package from sipper if default is null
The BatteryEntry need a background thread to update the package name and icon. However in InstalledAppDetails we don't have this thread and it is unnecessary because we already has the package name. This cl: 1. Use the mPackageName from InstalledAppDetails directly in BatteryEntry 2. Double check the defaultPackageName in AdvancedPowerUsageDetail, use packageName from sipper if default is null This cl is cherry picked from oc-dr to fix the test breakage. Bug: 64127162 Test: RunSettingsRoboTests Change-Id: I5d21afca17f177817976758c28ed86b3a10e95eb
This commit is contained in:
@@ -368,6 +368,18 @@ public class AdvancedPowerUsageDetailTest {
|
||||
"0%");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartBatteryDetailPage_defaultPackageNull_chooseFromBatterySipper() {
|
||||
mBatteryEntry.defaultPackageName = null;
|
||||
mBatteryEntry.sipper.mPackages = PACKAGE_NAME;
|
||||
|
||||
AdvancedPowerUsageDetail.startBatteryDetailPage(mTestActivity, mBatteryUtils, null,
|
||||
mBatteryStatsHelper, 0, mBatteryEntry, USAGE_PERCENT, null);
|
||||
|
||||
assertThat(mBundle.getString(AdvancedPowerUsageDetail.EXTRA_PACKAGE_NAME)).isEqualTo(
|
||||
PACKAGE_NAME[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitPreference_hasCorrectSummary() {
|
||||
Bundle bundle = new Bundle(4);
|
||||
|
Reference in New Issue
Block a user